Unnamed: 0
int64
0
0
repo_id
stringlengths
5
186
file_path
stringlengths
15
223
content
stringlengths
1
32.8M
0
repos/ryu/third_party/double-conversion/test
repos/ryu/third_party/double-conversion/test/cctest/gay-shortest.h
// Copyright 2006-2008 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef GAY_SHORTEST_H_ #define GAY_SHORTEST_H_ namespace double_conversion { struct PrecomputedShortest { double v; const char* representation; int decimal_point; }; Vector<const PrecomputedShortest> PrecomputedShortestRepresentations(); } // namespace double_conversion #endif // GAY_SHORTEST_H_
0
repos/ryu/third_party/double-conversion/test
repos/ryu/third_party/double-conversion/test/cctest/CMakeLists.txt
set(CCTEST_SRC cctest.cc gay-fixed.cc gay-precision.cc gay-shortest.cc gay-shortest-single.cc test-bignum.cc test-bignum-dtoa.cc test-conversions.cc test-diy-fp.cc test-dtoa.cc test-fast-dtoa.cc test-fixed-dtoa.cc test-ieee.cc test-strtod.cc ) add_executable(cctest ${CCTEST_SRC}) target_link_libraries(cctest double-conversion) add_test(NAME test_bignum WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND $<TARGET_FILE:cctest> test-bignum) add_test(NAME test_bignum_dtoa WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND $<TARGET_FILE:cctest> test-bignum-dtoa) add_test(NAME test_conversions WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND $<TARGET_FILE:cctest> test-conversions) add_test(NAME test_diy_fp WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND $<TARGET_FILE:cctest> test-diy-fp) add_test(NAME test_dtoa WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND $<TARGET_FILE:cctest> test-dtoa) add_test(NAME test_fast_dtoa WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND $<TARGET_FILE:cctest> test-fast-dtoa) add_test(NAME test_fixed_dtoa WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND $<TARGET_FILE:cctest> test-fixed-dtoa) add_test(NAME test_ieee WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND $<TARGET_FILE:cctest> test-ieee) add_test(NAME test_strtod WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND $<TARGET_FILE:cctest> test-strtod)
0
repos/ryu/third_party/double-conversion/test
repos/ryu/third_party/double-conversion/test/cctest/gay-precision.h
// Copyright 2006-2008 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef GAY_PRECISION_H_ #define GAY_PRECISION_H_ namespace double_conversion { struct PrecomputedPrecision { double v; int number_digits; const char* representation; int decimal_point; }; // Returns precomputed values of dtoa. The strings have been generated using // Gay's dtoa in mode "precision". Vector<const PrecomputedPrecision> PrecomputedPrecisionRepresentations(); } // namespace double_conversion #endif // GAY_PRECISION_H_
0
repos/ryu/third_party/double-conversion/test
repos/ryu/third_party/double-conversion/test/cctest/cctest.h
// Copyright 2008 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef CCTEST_H_ #define CCTEST_H_ #include <stdio.h> #include <string.h> #include "double-conversion/utils.h" #ifndef TEST #define TEST(Name) \ static void Test##Name(); \ CcTest register_test_##Name(Test##Name, __FILE__, #Name, NULL, true); \ static void Test##Name() #endif #ifndef DEPENDENT_TEST #define DEPENDENT_TEST(Name, Dep) \ static void Test##Name(); \ CcTest register_test_##Name(Test##Name, __FILE__, #Name, #Dep, true); \ static void Test##Name() #endif #ifndef DISABLED_TEST #define DISABLED_TEST(Name) \ static void Test##Name(); \ CcTest register_test_##Name(Test##Name, __FILE__, #Name, NULL, false); \ static void Test##Name() #endif #define CHECK(condition) CheckHelper(__FILE__, __LINE__, #condition, condition) #define CHECK_GE(a, b) CHECK((a) >= (b)) static inline void CheckHelper(const char* file, int line, const char* source, bool condition) { if (!condition) { printf("%s:%d:\n CHECK(%s) failed\n", file, line, source); abort(); } } #define CHECK_EQ(a, b) CheckEqualsHelper(__FILE__, __LINE__, #a, a, #b, b) static inline void CheckEqualsHelper(const char* file, int line, const char* expected_source, const char* expected, const char* value_source, const char* value) { if ((expected == NULL && value != NULL) || (expected != NULL && value == NULL)) { abort(); } if ((expected != NULL && value != NULL && strcmp(expected, value) != 0)) { printf("%s:%d:\n CHECK_EQ(%s, %s) failed\n" "# Expected: %s\n" "# Found: %s\n", file, line, expected_source, value_source, expected, value); abort(); } } static inline void CheckEqualsHelper(const char* file, int line, const char* expected_source, int expected, const char* value_source, int value) { if (expected != value) { printf("%s:%d:\n CHECK_EQ(%s, %s) failed\n" "# Expected: %d\n" "# Found: %d\n", file, line, expected_source, value_source, expected, value); abort(); } } static inline void CheckEqualsHelper(const char* file, int line, const char* expected_source, double expected, const char* value_source, double value) { // If expected and value are NaNs then expected != value. if (expected != value && (expected == expected || value == value)) { printf("%s:%d:\n CHECK_EQ(%s, %s) failed\n" "# Expected: %.30e\n" "# Found: %.30e\n", file, line, expected_source, value_source, expected, value); abort(); } } class CcTest { public: typedef void (TestFunction)(); CcTest(TestFunction* callback, const char* file, const char* name, const char* dependency, bool enabled); void Run() { callback_(); } static int test_count(); static CcTest* last() { return last_; } CcTest* prev() { return prev_; } const char* file() const { return file_; } const char* name() const { return name_; } const char* dependency() const { return dependency_; } bool enabled() const { return enabled_; } private: TestFunction* callback_; const char* file_; const char* name_; const char* dependency_; bool enabled_; static CcTest* last_; CcTest* prev_; }; #endif // ifndef CCTEST_H_
0
repos/ryu/third_party/double-conversion/test
repos/ryu/third_party/double-conversion/test/cctest/checks.h
// Copyright 2006-2008 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef V8_CHECKS_H_ #define V8_CHECKS_H_ #include <string.h> #include "flags.h" extern "C" void V8_Fatal(const char* file, int line, const char* format, ...); void API_Fatal(const char* location, const char* format, ...); // The FATAL, UNREACHABLE and UNIMPLEMENTED macros are useful during // development, but they should not be relied on in the final product. #ifdef DEBUG #define FATAL(msg) \ V8_Fatal(__FILE__, __LINE__, "%s", (msg)) #define UNIMPLEMENTED() \ V8_Fatal(__FILE__, __LINE__, "unimplemented code") #define UNREACHABLE() \ V8_Fatal(__FILE__, __LINE__, "unreachable code") #else #define FATAL(msg) \ V8_Fatal("", 0, "%s", (msg)) #define UNIMPLEMENTED() \ V8_Fatal("", 0, "unimplemented code") #define UNREACHABLE() ((void) 0) #endif // Used by the CHECK macro -- should not be called directly. static inline void CheckHelper(const char* file, int line, const char* source, bool condition) { if (!condition) V8_Fatal(file, line, "CHECK(%s) failed", source); } // The CHECK macro checks that the given condition is true; if not, it // prints a message to stderr and aborts. #define CHECK(condition) CheckHelper(__FILE__, __LINE__, #condition, condition) // Helper function used by the CHECK_EQ function when given int // arguments. Should not be called directly. static inline void CheckEqualsHelper(const char* file, int line, const char* expected_source, int expected, const char* value_source, int value) { if (expected != value) { V8_Fatal(file, line, "CHECK_EQ(%s, %s) failed\n# Expected: %i\n# Found: %i", expected_source, value_source, expected, value); } } // Helper function used by the CHECK_EQ function when given int64_t // arguments. Should not be called directly. static inline void CheckEqualsHelper(const char* file, int line, const char* expected_source, int64_t expected, const char* value_source, int64_t value) { if (expected != value) { // Print int64_t values in hex, as two int32s, // to avoid platform-dependencies. V8_Fatal(file, line, "CHECK_EQ(%s, %s) failed\n#" " Expected: 0x%08x%08x\n# Found: 0x%08x%08x", expected_source, value_source, static_cast<uint32_t>(expected >> 32), static_cast<uint32_t>(expected), static_cast<uint32_t>(value >> 32), static_cast<uint32_t>(value)); } } // Helper function used by the CHECK_NE function when given int // arguments. Should not be called directly. static inline void CheckNonEqualsHelper(const char* file, int line, const char* unexpected_source, int unexpected, const char* value_source, int value) { if (unexpected == value) { V8_Fatal(file, line, "CHECK_NE(%s, %s) failed\n# Value: %i", unexpected_source, value_source, value); } } // Helper function used by the CHECK function when given string // arguments. Should not be called directly. static inline void CheckEqualsHelper(const char* file, int line, const char* expected_source, const char* expected, const char* value_source, const char* value) { if ((expected == NULL && value != NULL) || (expected != NULL && value == NULL) || (expected != NULL && value != NULL && strcmp(expected, value) != 0)) { V8_Fatal(file, line, "CHECK_EQ(%s, %s) failed\n# Expected: %s\n# Found: %s", expected_source, value_source, expected, value); } } static inline void CheckNonEqualsHelper(const char* file, int line, const char* expected_source, const char* expected, const char* value_source, const char* value) { if (expected == value || (expected != NULL && value != NULL && strcmp(expected, value) == 0)) { V8_Fatal(file, line, "CHECK_NE(%s, %s) failed\n# Value: %s", expected_source, value_source, value); } } // Helper function used by the CHECK function when given pointer // arguments. Should not be called directly. static inline void CheckEqualsHelper(const char* file, int line, const char* expected_source, const void* expected, const char* value_source, const void* value) { if (expected != value) { V8_Fatal(file, line, "CHECK_EQ(%s, %s) failed\n# Expected: %p\n# Found: %p", expected_source, value_source, expected, value); } } static inline void CheckNonEqualsHelper(const char* file, int line, const char* expected_source, const void* expected, const char* value_source, const void* value) { if (expected == value) { V8_Fatal(file, line, "CHECK_NE(%s, %s) failed\n# Value: %p", expected_source, value_source, value); } } // Helper function used by the CHECK function when given floating // point arguments. Should not be called directly. static inline void CheckEqualsHelper(const char* file, int line, const char* expected_source, double expected, const char* value_source, double value) { // Force values to 64 bit memory to truncate 80 bit precision on IA32. volatile double* exp = new double[1]; *exp = expected; volatile double* val = new double[1]; *val = value; if (*exp != *val) { V8_Fatal(file, line, "CHECK_EQ(%s, %s) failed\n# Expected: %f\n# Found: %f", expected_source, value_source, *exp, *val); } delete[] exp; delete[] val; } static inline void CheckNonEqualsHelper(const char* file, int line, const char* expected_source, double expected, const char* value_source, double value) { // Force values to 64 bit memory to truncate 80 bit precision on IA32. volatile double* exp = new double[1]; *exp = expected; volatile double* val = new double[1]; *val = value; if (*exp == *val) { V8_Fatal(file, line, "CHECK_NE(%s, %s) failed\n# Value: %f", expected_source, value_source, *val); } delete[] exp; delete[] val; } namespace v8 { class Value; template <class T> class Handle; } void CheckNonEqualsHelper(const char* file, int line, const char* unexpected_source, v8::Handle<v8::Value> unexpected, const char* value_source, v8::Handle<v8::Value> value); void CheckEqualsHelper(const char* file, int line, const char* expected_source, v8::Handle<v8::Value> expected, const char* value_source, v8::Handle<v8::Value> value); #define CHECK_EQ(expected, value) CheckEqualsHelper(__FILE__, __LINE__, \ #expected, expected, #value, value) #define CHECK_NE(unexpected, value) CheckNonEqualsHelper(__FILE__, __LINE__, \ #unexpected, unexpected, #value, value) #define CHECK_GT(a, b) CHECK((a) > (b)) #define CHECK_GE(a, b) CHECK((a) >= (b)) // This is inspired by the static assertion facility in boost. This // is pretty magical. If it causes you trouble on a platform you may // find a fix in the boost code. template <bool> class StaticAssertion; template <> class StaticAssertion<true> { }; // This macro joins two tokens. If one of the tokens is a macro the // helper call causes it to be resolved before joining. #define SEMI_STATIC_JOIN(a, b) SEMI_STATIC_JOIN_HELPER(a, b) #define SEMI_STATIC_JOIN_HELPER(a, b) a##b // Causes an error during compilation of the condition is not // statically known to be true. It is formulated as a typedef so that // it can be used wherever a typedef can be used. Beware that this // actually causes each use to introduce a new defined type with a // name depending on the source line. template <int> class StaticAssertionHelper { }; #define STATIC_CHECK(test) \ typedef \ StaticAssertionHelper<sizeof(StaticAssertion<static_cast<bool>(test)>)> \ SEMI_STATIC_JOIN(__StaticAssertTypedef__, __LINE__) // The ASSERT macro is equivalent to CHECK except that it only // generates code in debug builds. #ifdef DEBUG #define ASSERT_RESULT(expr) CHECK(expr) #define ASSERT(condition) CHECK(condition) #define ASSERT_EQ(v1, v2) CHECK_EQ(v1, v2) #define ASSERT_NE(v1, v2) CHECK_NE(v1, v2) #define ASSERT_GE(v1, v2) CHECK_GE(v1, v2) #define SLOW_ASSERT(condition) if (FLAG_enable_slow_asserts) CHECK(condition) #else #define ASSERT_RESULT(expr) (expr) #define ASSERT(condition) ((void) 0) #define ASSERT_EQ(v1, v2) ((void) 0) #define ASSERT_NE(v1, v2) ((void) 0) #define ASSERT_GE(v1, v2) ((void) 0) #define SLOW_ASSERT(condition) ((void) 0) #endif // Static asserts has no impact on runtime performance, so they can be // safely enabled in release mode. Moreover, the ((void) 0) expression // obeys different syntax rules than typedef's, e.g. it can't appear // inside class declaration, this leads to inconsistency between debug // and release compilation modes behaviour. #define STATIC_ASSERT(test) STATIC_CHECK(test) #define ASSERT_TAG_ALIGNED(address) \ ASSERT((reinterpret_cast<intptr_t>(address) & kHeapObjectTagMask) == 0) #define ASSERT_SIZE_TAG_ALIGNED(size) ASSERT((size & kHeapObjectTagMask) == 0) #define ASSERT_NOT_NULL(p) ASSERT_NE(NULL, p) #endif // V8_CHECKS_H_
0
repos/ryu/third_party/jaffer/java/org/yuanheng
repos/ryu/third_party/jaffer/java/org/yuanheng/cookjson/DoubleUtils.java
/* * Copyright 2016 Heng Yuan * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.yuanheng.cookjson; import java.math.BigInteger; /** * The algorithm and code used here are from * Jaffer, Aubrey. "Easy Accurate Reading and Writing of Floating-Point * Numbers." arXiv preprint arXiv:1310.8121 (2013). * (<a href="https://arxiv.org/pdf/1310.8121.pdf">PDF</a>) * <p> * And here is the license given from him: * <pre> * Copyright (c) Aubrey Jaffer 2014 * Permission to copy this software, to modify it, to redistribute it, * to distribute modified versions, and to use it for any purpose is * granted, subject to the following restrictions and understandings. * * 1. Any copy made of this software must include this copyright notice * in full. * * 2. I have made no warranty or representation that the operation of * this software will be error-free, and I am under no obligation to * provide any services, by way of maintenance, update, or otherwise. * * 3. In conjunction with products arising from the use of this * material, there shall be no use of my name in any advertising, * promotional, or sales literature without prior written consent in * each case. * </pre> * <p> * I made minor modifications to fit my need. * * @author Heng Yuan */ @SuppressWarnings("IdentityBinaryExpression") public class DoubleUtils { private final static int dblMantDig = 53; private final static BigInteger[] bp5a = new BigInteger[326]; private static final long lp5[] = { 1L, 5L, 25L, 125L, 625L, 3125L, 15625L, 78125L, 390625L, 1953125L, 9765625L, 48828125L, 244140625L, 1220703125L, 6103515625L, 30517578125L, 152587890625L, 762939453125L, 3814697265625L, 19073486328125L, 95367431640625L, 476837158203125L, 2384185791015625L, 11920928955078125L, 59604644775390625L, 298023223876953125L, 1490116119384765625L, 7450580596923828125L }; private final static BigInteger bp5 (int p) { BigInteger[] pa = bp5a; if (pa[p] != null) return pa[p]; else if (p < lp5.length) { BigInteger v = BigInteger.valueOf (lp5[p]); pa[p] = v; return v; } else { // use divide-n-conquer strategy to compute the number int a = p >> 1; int b = p - a; // b has 50% chance being the same as a BigInteger v = bp5 (a).multiply (bp5 (b)); pa[p] = v; return v; } } private final static double llog2 = Math.log10 (2); private static long rq (BigInteger num, BigInteger den) { BigInteger quorem[] = num.divideAndRemainder (den); long quo = quorem[0].longValue (); int cmpflg = quorem[1].shiftLeft (1).compareTo (den); if ((quo & 1L) == 0L ? 1 == cmpflg : -1 < cmpflg) return quo + 1L; else return quo; } private static double metd (long lmant, int point) { BigInteger mant = BigInteger.valueOf (lmant); if (point >= 0) { BigInteger num = mant.multiply (bp5 (point)); int bex = num.bitLength () - dblMantDig; if (bex <= 0) return Math.scalb (num.doubleValue (), point); long quo = rq (num, BigInteger.ONE.shiftLeft (bex)); return Math.scalb ((double) quo, bex + point); } int maxpow = bp5a.length - 1; BigInteger scl = (-point <= maxpow) ? bp5 (-point) : bp5 (maxpow).multiply (bp5 (-point - maxpow)); int bex = mant.bitLength () - scl.bitLength () - dblMantDig; BigInteger num = mant.shiftLeft (-bex); long quo = rq (num, scl); if (64 - Long.numberOfLeadingZeros (quo) > dblMantDig) { bex++; quo = rq (num, scl.shiftLeft (1)); } return Math.scalb ((double) quo, bex + point); } /** * This function converts a double representation to a string format. * * @param f * A double value. * @return A string representation of the double value f. */ public static String toString (double f) { long lbits = Double.doubleToLongBits (f); if (f != f) return "NaN"; if (f + f == f) return (f == 0.0) ? "0" : ((f > 0) ? "Infinity" : "-Infinity"); StringBuilder str = new StringBuilder (24); if (f < 0) { str.append ('-'); // there is a rounding bug for negative values with positive // exp, such as -5e100. Negate the value to avoid the issue. f = -f; } int ue2 = (int) (lbits >>> 52 & 0x7ff); int e2 = ue2 - 1023 - 52 + (ue2 == 0 ? 1 : 0); int point = (int) Math.ceil (e2 * llog2); long lquo; long lmant = (lbits & ((1L << 52) - 1)) + (ue2 == 0 ? 0L : 1L << 52); BigInteger mant = BigInteger.valueOf (lmant); if (e2 > 0) { BigInteger num = mant.shiftLeft (e2 - point); lquo = rq (num, bp5 (point)); if (metd (lquo, point) != f) lquo = rq (num.shiftLeft (1), bp5 (--point)); } else { BigInteger num = mant.multiply (bp5 (-point)); BigInteger den = BigInteger.ONE.shiftLeft (point - e2); lquo = rq (num, den); if (metd (lquo, point) != f) { point--; lquo = rq (num.multiply (BigInteger.TEN), den); } } String sman = Long.toString (lquo); int len = sman.length (), lent = len; while (sman.charAt (lent - 1) == '0') { lent--; } int exp = point + len - 1; if (exp >= 0 && exp < len) { // length string is longer than exp // so the period is in the middle of sman ++exp; // exp is now the period location str.append (sman, 0, exp); if (lent > exp) { str.append ('.'); str.append (sman, exp, lent); } } else if (exp < 0 && exp > -5) { str.append ("0."); str.append ("0000".substring (0, -exp - 1)); str.append (sman, 0, lent); } else { // scientific notation str.append (sman, 0, 1); if (lent > 1) { str.append ('.'); str.append (sman, 1, lent); } if (exp != 0) { str.append ('e'); str.append (exp); } } return str.toString (); } }
0
repos/ryu/third_party/mersenne_java/java/info/adams
repos/ryu/third_party/mersenne_java/java/info/adams/random/MersenneTwister.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package info.adams.random; /** This class implements a powerful pseudo-random number generator * developed by Makoto Matsumoto and Takuji Nishimura during * 1996-1997. * <p>This generator features an extremely long period * (2<sup>19937</sup>-1) and 623-dimensional equidistribution up to 32 * bits accuracy. The home page for this generator is located at <a * href="http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html"> * http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html</a>.</p> * <p>This generator is described in a paper by Makoto Matsumoto and * Takuji Nishimura in 1998: <a * href="http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/ARTICLES/mt.pdf">Mersenne * Twister: A 623-Dimensionally Equidistributed Uniform Pseudo-Random * Number Generator</a>, ACM Transactions on Modeling and Computer * Simulation, Vol. 8, No. 1, January 1998, pp 3--30</p> * <p>This class is mainly a Java port of the 2002-01-26 version of * the generator written in C by Makoto Matsumoto and Takuji * Nishimura. Here is their original copyright:</p> * <table border="0" width="80%" cellpadding="10" align="center" bgcolor="#E0E0E0"> * <tr><td>Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, * All rights reserved.</td></tr> * <tr><td>Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * <ol> * <li>Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer.</li> * <li>Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution.</li> * <li>The names of its contributors may not be used to endorse or promote * products derived from this software without specific prior written * permission.</li> * </ol></td></tr> * <tr><td><strong>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE.</strong></td></tr> * </table> * @since 2.0 */ // Copied from // http://home.apache.org/~luc/commons-math-3.6-RC2-site/jacoco/org.apache.commons.math3.random/MersenneTwister.java.html public class MersenneTwister { /** Size of the bytes pool. */ private static final int N = 624; /** Period second parameter. */ private static final int M = 397; /** X * MATRIX_A for X = {0, 1}. */ private static final int[] MAG01 = { 0x0, 0x9908b0df }; /** Bytes pool. */ private int[] mt; /** Current index in the bytes pool. */ private int mti; /** Creates a new random number generator using a single int seed. * @param seed the initial seed (32 bits integer) */ public MersenneTwister(int seed) { mt = new int[N]; setSeed(seed); } /** Reinitialize the generator as if just built with the given int seed. * <p>The state of the generator is exactly the same as a new * generator built with the same seed.</p> * @param seed the initial seed (32 bits integer) */ public void setSeed(int seed) { // we use a long masked by 0xffffffffL as a poor man unsigned int long longMT = seed; // NB: unlike original C code, we are working with java longs, the cast below makes masking unnecessary mt[0]= (int) longMT; for (mti = 1; mti < N; ++mti) { // See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. // initializer from the 2002-01-09 C version by Makoto Matsumoto longMT = (1812433253l * (longMT ^ (longMT >> 30)) + mti) & 0xffffffffL; mt[mti]= (int) longMT; } } /** Generate next pseudorandom number. * <p>This method is the core generation algorithm. It is used by all the * public generation methods for the various primitive types {@link * #nextBoolean()}, {@link #nextBytes(byte[])}, {@link #nextDouble()}, * {@link #nextFloat()}, {@link #nextGaussian()}, {@link #nextInt()}, * {@link #next(int)} and {@link #nextLong()}.</p> * @param bits number of random bits to produce * @return random bits generated */ protected int next(int bits) { int y; if (mti >= N) { // generate N words at one time int mtNext = mt[0]; for (int k = 0; k < N - M; ++k) { int mtCurr = mtNext; mtNext = mt[k + 1]; y = (mtCurr & 0x80000000) | (mtNext & 0x7fffffff); mt[k] = mt[k + M] ^ (y >>> 1) ^ MAG01[y & 0x1]; } for (int k = N - M; k < N - 1; ++k) { int mtCurr = mtNext; mtNext = mt[k + 1]; y = (mtCurr & 0x80000000) | (mtNext & 0x7fffffff); mt[k] = mt[k + (M - N)] ^ (y >>> 1) ^ MAG01[y & 0x1]; } y = (mtNext & 0x80000000) | (mt[0] & 0x7fffffff); mt[N - 1] = mt[M - 1] ^ (y >>> 1) ^ MAG01[y & 0x1]; mti = 0; } y = mt[mti++]; // tempering y ^= y >>> 11; y ^= (y << 7) & 0x9d2c5680; y ^= (y << 15) & 0xefc60000; y ^= y >>> 18; return y >>> (32 - bits); } public int nextInt() { return next(32); } public long nextLong() { int a = next(32); int b = next(32); return (((long) a) << 32) | (b & 0xffffffffL); } }
0
repos/ryu/third_party
repos/ryu/third_party/mersenne/random.c
#include <stdint.h> // Copy of Mersenne Twister, originally from Wikipedia // https://github.com/bmurray7/mersenne-twister-examples // Define MT19937 constants (32-bit RNG) enum { // Assumes W = 32 (omitting this) N = 624, M = 397, R = 31, A = 0x9908B0DF, F = 1812433253, U = 11, // Assumes D = 0xFFFFFFFF (omitting this) S = 7, B = 0x9D2C5680, T = 15, C = 0xEFC60000, L = 18, MASK_LOWER = (1ull << R) - 1, MASK_UPPER = (1ull << R) }; static uint32_t mt[N]; static uint16_t index; // Re-init with a given seed void RandomInit(const uint32_t seed) { uint32_t i; mt[0] = seed; for ( i = 1; i < N; i++) { mt[i] = (F * (mt[i - 1] ^ (mt[i - 1] >> 30)) + i); } index = N; } static void Twist() { uint32_t i, x, xA; for ( i = 0; i < N; i++) { x = (mt[i] & MASK_UPPER) + (mt[(i + 1) % N] & MASK_LOWER); xA = x >> 1; if (x & 0x1) { xA ^= A; } mt[i] = mt[(i + M) % N] ^ xA; } index = 0; } // Obtain a 32-bit random number uint32_t RandomU32() { uint32_t y; int i = index; if (index >= N) { Twist(); i = index; } y = mt[i]; index = i + 1; y ^= (mt[i] >> U); y ^= (y << S) & B; y ^= (y << T) & C; y ^= (y >> L); return y; } uint64_t RandomU64() { uint32_t a = RandomU32(); uint32_t b = RandomU32(); return ((uint64_t) a) << 32 | b; }
0
repos/ryu/third_party
repos/ryu/third_party/mersenne/random.h
// Copyright 2018 Ulf Adams // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef __RANDOM #define __RANDOM #ifdef __cplusplus extern "C" { #endif void RandomInit(const uint32_t seed); uint32_t RandomU32(); uint64_t RandomU64(); #ifdef __cplusplus } #endif #endif // __RANDOM
0
repos/ryu/third_party
repos/ryu/third_party/gtest/gtest.h
// Copyright 2005, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Author: [email protected] (Zhanyong Wan) // // The Google C++ Testing Framework (Google Test) // // This header file defines the public API for Google Test. It should be // included by any test program that uses Google Test. // // IMPORTANT NOTE: Due to limitation of the C++ language, we have to // leave some internal implementation details in this header file. // They are clearly marked by comments like this: // // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. // // Such code is NOT meant to be used by a user directly, and is subject // to CHANGE WITHOUT NOTICE. Therefore DO NOT DEPEND ON IT in a user // program! // // Acknowledgment: Google Test borrowed the idea of automatic test // registration from Barthelemy Dagenais' ([email protected]) // easyUnit framework. #ifndef GTEST_INCLUDE_GTEST_GTEST_H_ #define GTEST_INCLUDE_GTEST_GTEST_H_ #include <limits> #include <ostream> #include <vector> // Copyright 2005, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Authors: [email protected] (Zhanyong Wan), [email protected] (Sean Mcafee) // // The Google C++ Testing Framework (Google Test) // // This header file declares functions and macros used internally by // Google Test. They are subject to change without notice. #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_ // Copyright 2005, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Authors: [email protected] (Zhanyong Wan) // // Low-level types and utilities for porting Google Test to various // platforms. All macros ending with _ and symbols defined in an // internal namespace are subject to change without notice. Code // outside Google Test MUST NOT USE THEM DIRECTLY. Macros that don't // end with _ are part of Google Test's public API and can be used by // code outside Google Test. // // This file is fundamental to Google Test. All other Google Test source // files are expected to #include this. Therefore, it cannot #include // any other Google Test header. #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_ // Environment-describing macros // ----------------------------- // // Google Test can be used in many different environments. Macros in // this section tell Google Test what kind of environment it is being // used in, such that Google Test can provide environment-specific // features and implementations. // // Google Test tries to automatically detect the properties of its // environment, so users usually don't need to worry about these // macros. However, the automatic detection is not perfect. // Sometimes it's necessary for a user to define some of the following // macros in the build script to override Google Test's decisions. // // If the user doesn't define a macro in the list, Google Test will // provide a default definition. After this header is #included, all // macros in this list will be defined to either 1 or 0. // // Notes to maintainers: // - Each macro here is a user-tweakable knob; do not grow the list // lightly. // - Use #if to key off these macros. Don't use #ifdef or "#if // defined(...)", which will not work as these macros are ALWAYS // defined. // // GTEST_HAS_CLONE - Define it to 1/0 to indicate that clone(2) // is/isn't available. // GTEST_HAS_EXCEPTIONS - Define it to 1/0 to indicate that exceptions // are enabled. // GTEST_HAS_GLOBAL_STRING - Define it to 1/0 to indicate that ::string // is/isn't available (some systems define // ::string, which is different to std::string). // GTEST_HAS_GLOBAL_WSTRING - Define it to 1/0 to indicate that ::string // is/isn't available (some systems define // ::wstring, which is different to std::wstring). // GTEST_HAS_POSIX_RE - Define it to 1/0 to indicate that POSIX regular // expressions are/aren't available. // GTEST_HAS_PTHREAD - Define it to 1/0 to indicate that <pthread.h> // is/isn't available. // GTEST_HAS_RTTI - Define it to 1/0 to indicate that RTTI is/isn't // enabled. // GTEST_HAS_STD_WSTRING - Define it to 1/0 to indicate that // std::wstring does/doesn't work (Google Test can // be used where std::wstring is unavailable). // GTEST_HAS_TR1_TUPLE - Define it to 1/0 to indicate tr1::tuple // is/isn't available. // GTEST_HAS_SEH - Define it to 1/0 to indicate whether the // compiler supports Microsoft's "Structured // Exception Handling". // GTEST_HAS_STREAM_REDIRECTION // - Define it to 1/0 to indicate whether the // platform supports I/O stream redirection using // dup() and dup2(). // GTEST_USE_OWN_TR1_TUPLE - Define it to 1/0 to indicate whether Google // Test's own tr1 tuple implementation should be // used. Unused when the user sets // GTEST_HAS_TR1_TUPLE to 0. // GTEST_LANG_CXX11 - Define it to 1/0 to indicate that Google Test // is building in C++11/C++98 mode. // GTEST_LINKED_AS_SHARED_LIBRARY // - Define to 1 when compiling tests that use // Google Test as a shared library (known as // DLL on Windows). // GTEST_CREATE_SHARED_LIBRARY // - Define to 1 when compiling Google Test itself // as a shared library. // Platform-indicating macros // -------------------------- // // Macros indicating the platform on which Google Test is being used // (a macro is defined to 1 if compiled on the given platform; // otherwise UNDEFINED -- it's never defined to 0.). Google Test // defines these macros automatically. Code outside Google Test MUST // NOT define them. // // GTEST_OS_AIX - IBM AIX // GTEST_OS_CYGWIN - Cygwin // GTEST_OS_FREEBSD - FreeBSD // GTEST_OS_HPUX - HP-UX // GTEST_OS_LINUX - Linux // GTEST_OS_LINUX_ANDROID - Google Android // GTEST_OS_MAC - Mac OS X // GTEST_OS_IOS - iOS // GTEST_OS_NACL - Google Native Client (NaCl) // GTEST_OS_OPENBSD - OpenBSD // GTEST_OS_QNX - QNX // GTEST_OS_SOLARIS - Sun Solaris // GTEST_OS_SYMBIAN - Symbian // GTEST_OS_WINDOWS - Windows (Desktop, MinGW, or Mobile) // GTEST_OS_WINDOWS_DESKTOP - Windows Desktop // GTEST_OS_WINDOWS_MINGW - MinGW // GTEST_OS_WINDOWS_MOBILE - Windows Mobile // GTEST_OS_WINDOWS_PHONE - Windows Phone // GTEST_OS_WINDOWS_RT - Windows Store App/WinRT // GTEST_OS_ZOS - z/OS // // Among the platforms, Cygwin, Linux, Max OS X, and Windows have the // most stable support. Since core members of the Google Test project // don't have access to other platforms, support for them may be less // stable. If you notice any problems on your platform, please notify // [email protected] (patches for fixing them are // even more welcome!). // // It is possible that none of the GTEST_OS_* macros are defined. // Feature-indicating macros // ------------------------- // // Macros indicating which Google Test features are available (a macro // is defined to 1 if the corresponding feature is supported; // otherwise UNDEFINED -- it's never defined to 0.). Google Test // defines these macros automatically. Code outside Google Test MUST // NOT define them. // // These macros are public so that portable tests can be written. // Such tests typically surround code using a feature with an #if // which controls that code. For example: // // #if GTEST_HAS_DEATH_TEST // EXPECT_DEATH(DoSomethingDeadly()); // #endif // // GTEST_HAS_COMBINE - the Combine() function (for value-parameterized // tests) // GTEST_HAS_DEATH_TEST - death tests // GTEST_HAS_PARAM_TEST - value-parameterized tests // GTEST_HAS_TYPED_TEST - typed tests // GTEST_HAS_TYPED_TEST_P - type-parameterized tests // GTEST_IS_THREADSAFE - Google Test is thread-safe. // GTEST_USES_POSIX_RE - enhanced POSIX regex is used. Do not confuse with // GTEST_HAS_POSIX_RE (see above) which users can // define themselves. // GTEST_USES_SIMPLE_RE - our own simple regex is used; // the above two are mutually exclusive. // GTEST_CAN_COMPARE_NULL - accepts untyped NULL in EXPECT_EQ(). // Misc public macros // ------------------ // // GTEST_FLAG(flag_name) - references the variable corresponding to // the given Google Test flag. // Internal utilities // ------------------ // // The following macros and utilities are for Google Test's INTERNAL // use only. Code outside Google Test MUST NOT USE THEM DIRECTLY. // // Macros for basic C++ coding: // GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning. // GTEST_ATTRIBUTE_UNUSED_ - declares that a class' instances or a // variable don't have to be used. // GTEST_DISALLOW_ASSIGN_ - disables operator=. // GTEST_DISALLOW_COPY_AND_ASSIGN_ - disables copy ctor and operator=. // GTEST_MUST_USE_RESULT_ - declares that a function's result must be used. // GTEST_INTENTIONAL_CONST_COND_PUSH_ - start code section where MSVC C4127 is // suppressed (constant conditional). // GTEST_INTENTIONAL_CONST_COND_POP_ - finish code section where MSVC C4127 // is suppressed. // // C++11 feature wrappers: // // testing::internal::move - portability wrapper for std::move. // // Synchronization: // Mutex, MutexLock, ThreadLocal, GetThreadCount() // - synchronization primitives. // // Template meta programming: // is_pointer - as in TR1; needed on Symbian and IBM XL C/C++ only. // IteratorTraits - partial implementation of std::iterator_traits, which // is not available in libCstd when compiled with Sun C++. // // Smart pointers: // scoped_ptr - as in TR2. // // Regular expressions: // RE - a simple regular expression class using the POSIX // Extended Regular Expression syntax on UNIX-like // platforms, or a reduced regular exception syntax on // other platforms, including Windows. // // Logging: // GTEST_LOG_() - logs messages at the specified severity level. // LogToStderr() - directs all log messages to stderr. // FlushInfoLog() - flushes informational log messages. // // Stdout and stderr capturing: // CaptureStdout() - starts capturing stdout. // GetCapturedStdout() - stops capturing stdout and returns the captured // string. // CaptureStderr() - starts capturing stderr. // GetCapturedStderr() - stops capturing stderr and returns the captured // string. // // Integer types: // TypeWithSize - maps an integer to a int type. // Int32, UInt32, Int64, UInt64, TimeInMillis // - integers of known sizes. // BiggestInt - the biggest signed integer type. // // Command-line utilities: // GTEST_DECLARE_*() - declares a flag. // GTEST_DEFINE_*() - defines a flag. // GetInjectableArgvs() - returns the command line as a vector of strings. // // Environment variable utilities: // GetEnv() - gets the value of an environment variable. // BoolFromGTestEnv() - parses a bool environment variable. // Int32FromGTestEnv() - parses an Int32 environment variable. // StringFromGTestEnv() - parses a string environment variable. #include <ctype.h> // for isspace, etc #include <stddef.h> // for ptrdiff_t #include <stdlib.h> #include <stdio.h> #include <string.h> #ifndef _WIN32_WCE # include <sys/types.h> # include <sys/stat.h> #endif // !_WIN32_WCE #if defined __APPLE__ # include <AvailabilityMacros.h> # include <TargetConditionals.h> #endif #include <algorithm> // NOLINT #include <iostream> // NOLINT #include <sstream> // NOLINT #include <string> // NOLINT #include <utility> #include <vector> // NOLINT // Copyright 2015, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // The Google C++ Testing Framework (Google Test) // // This header file defines the GTEST_OS_* macro. // It is separate from gtest-port.h so that custom/gtest-port.h can include it. #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_ // Determines the platform on which Google Test is compiled. #ifdef __CYGWIN__ # define GTEST_OS_CYGWIN 1 #elif defined __SYMBIAN32__ # define GTEST_OS_SYMBIAN 1 #elif defined _WIN32 # define GTEST_OS_WINDOWS 1 # ifdef _WIN32_WCE # define GTEST_OS_WINDOWS_MOBILE 1 # elif defined(__MINGW__) || defined(__MINGW32__) # define GTEST_OS_WINDOWS_MINGW 1 # elif defined(WINAPI_FAMILY) # include <winapifamily.h> # if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) # define GTEST_OS_WINDOWS_DESKTOP 1 # elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP) # define GTEST_OS_WINDOWS_PHONE 1 # elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) # define GTEST_OS_WINDOWS_RT 1 # else // WINAPI_FAMILY defined but no known partition matched. // Default to desktop. # define GTEST_OS_WINDOWS_DESKTOP 1 # endif # else # define GTEST_OS_WINDOWS_DESKTOP 1 # endif // _WIN32_WCE #elif defined __APPLE__ # define GTEST_OS_MAC 1 # if TARGET_OS_IPHONE # define GTEST_OS_IOS 1 # endif #elif defined __FreeBSD__ # define GTEST_OS_FREEBSD 1 #elif defined __linux__ # define GTEST_OS_LINUX 1 # if defined __ANDROID__ # define GTEST_OS_LINUX_ANDROID 1 # endif #elif defined __MVS__ # define GTEST_OS_ZOS 1 #elif defined(__sun) && defined(__SVR4) # define GTEST_OS_SOLARIS 1 #elif defined(_AIX) # define GTEST_OS_AIX 1 #elif defined(__hpux) # define GTEST_OS_HPUX 1 #elif defined __native_client__ # define GTEST_OS_NACL 1 #elif defined __OpenBSD__ # define GTEST_OS_OPENBSD 1 #elif defined __QNX__ # define GTEST_OS_QNX 1 #endif // __CYGWIN__ #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_ // Copyright 2015, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Injection point for custom user configurations. // The following macros can be defined: // // Flag related macros: // GTEST_FLAG(flag_name) // GTEST_USE_OWN_FLAGFILE_FLAG_ - Define to 0 when the system provides its // own flagfile flag parsing. // GTEST_DECLARE_bool_(name) // GTEST_DECLARE_int32_(name) // GTEST_DECLARE_string_(name) // GTEST_DEFINE_bool_(name, default_val, doc) // GTEST_DEFINE_int32_(name, default_val, doc) // GTEST_DEFINE_string_(name, default_val, doc) // // Test filtering: // GTEST_TEST_FILTER_ENV_VAR_ - The name of an environment variable that // will be used if --GTEST_FLAG(test_filter) // is not provided. // // Logging: // GTEST_LOG_(severity) // GTEST_CHECK_(condition) // Functions LogToStderr() and FlushInfoLog() have to be provided too. // // Threading: // GTEST_HAS_NOTIFICATION_ - Enabled if Notification is already provided. // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ - Enabled if Mutex and ThreadLocal are // already provided. // Must also provide GTEST_DECLARE_STATIC_MUTEX_(mutex) and // GTEST_DEFINE_STATIC_MUTEX_(mutex) // // GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks) // GTEST_LOCK_EXCLUDED_(locks) // // ** Custom implementation starts here ** #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_ #endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_ #if !defined(GTEST_DEV_EMAIL_) # define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com" # define GTEST_FLAG_PREFIX_ "gtest_" # define GTEST_FLAG_PREFIX_DASH_ "gtest-" # define GTEST_FLAG_PREFIX_UPPER_ "GTEST_" # define GTEST_NAME_ "Google Test" # define GTEST_PROJECT_URL_ "https://github.com/google/googletest/" #endif // !defined(GTEST_DEV_EMAIL_) #if !defined(GTEST_INIT_GOOGLE_TEST_NAME_) # define GTEST_INIT_GOOGLE_TEST_NAME_ "testing::InitGoogleTest" #endif // !defined(GTEST_INIT_GOOGLE_TEST_NAME_) // Determines the version of gcc that is used to compile this. #ifdef __GNUC__ // 40302 means version 4.3.2. # define GTEST_GCC_VER_ \ (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__) #endif // __GNUC__ // Macros for disabling Microsoft Visual C++ warnings. // // GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 4385) // /* code that triggers warnings C4800 and C4385 */ // GTEST_DISABLE_MSC_WARNINGS_POP_() #if _MSC_VER >= 1500 # define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings) \ __pragma(warning(push)) \ __pragma(warning(disable: warnings)) # define GTEST_DISABLE_MSC_WARNINGS_POP_() \ __pragma(warning(pop)) #else // Older versions of MSVC don't have __pragma. # define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings) # define GTEST_DISABLE_MSC_WARNINGS_POP_() #endif #ifndef GTEST_LANG_CXX11 // gcc and clang define __GXX_EXPERIMENTAL_CXX0X__ when // -std={c,gnu}++{0x,11} is passed. The C++11 standard specifies a // value for __cplusplus, and recent versions of clang, gcc, and // probably other compilers set that too in C++11 mode. # if __GXX_EXPERIMENTAL_CXX0X__ || __cplusplus >= 201103L // Compiling in at least C++11 mode. # define GTEST_LANG_CXX11 1 # else # define GTEST_LANG_CXX11 0 # endif #endif // Distinct from C++11 language support, some environments don't provide // proper C++11 library support. Notably, it's possible to build in // C++11 mode when targeting Mac OS X 10.6, which has an old libstdc++ // with no C++11 support. // // libstdc++ has sufficient C++11 support as of GCC 4.6.0, __GLIBCXX__ // 20110325, but maintenance releases in the 4.4 and 4.5 series followed // this date, so check for those versions by their date stamps. // https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html#abi.versioning #if GTEST_LANG_CXX11 && \ (!defined(__GLIBCXX__) || ( \ __GLIBCXX__ >= 20110325ul && /* GCC >= 4.6.0 */ \ /* Blacklist of patch releases of older branches: */ \ __GLIBCXX__ != 20110416ul && /* GCC 4.4.6 */ \ __GLIBCXX__ != 20120313ul && /* GCC 4.4.7 */ \ __GLIBCXX__ != 20110428ul && /* GCC 4.5.3 */ \ __GLIBCXX__ != 20120702ul)) /* GCC 4.5.4 */ # define GTEST_STDLIB_CXX11 1 #endif // Only use C++11 library features if the library provides them. #if GTEST_STDLIB_CXX11 # define GTEST_HAS_STD_BEGIN_AND_END_ 1 # define GTEST_HAS_STD_FORWARD_LIST_ 1 # define GTEST_HAS_STD_FUNCTION_ 1 # define GTEST_HAS_STD_INITIALIZER_LIST_ 1 # define GTEST_HAS_STD_MOVE_ 1 # define GTEST_HAS_STD_SHARED_PTR_ 1 # define GTEST_HAS_STD_TYPE_TRAITS_ 1 # define GTEST_HAS_STD_UNIQUE_PTR_ 1 #endif // C++11 specifies that <tuple> provides std::tuple. // Some platforms still might not have it, however. #if GTEST_LANG_CXX11 # define GTEST_HAS_STD_TUPLE_ 1 # if defined(__clang__) // Inspired by http://clang.llvm.org/docs/LanguageExtensions.html#__has_include # if defined(__has_include) && !__has_include(<tuple>) # undef GTEST_HAS_STD_TUPLE_ # endif # elif defined(_MSC_VER) // Inspired by boost/config/stdlib/dinkumware.hpp # if defined(_CPPLIB_VER) && _CPPLIB_VER < 520 # undef GTEST_HAS_STD_TUPLE_ # endif # elif defined(__GLIBCXX__) // Inspired by boost/config/stdlib/libstdcpp3.hpp, // http://gcc.gnu.org/gcc-4.2/changes.html and // http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt01ch01.html#manual.intro.status.standard.200x # if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2) # undef GTEST_HAS_STD_TUPLE_ # endif # endif #endif // Brings in definitions for functions used in the testing::internal::posix // namespace (read, write, close, chdir, isatty, stat). We do not currently // use them on Windows Mobile. #if GTEST_OS_WINDOWS # if !GTEST_OS_WINDOWS_MOBILE # include <direct.h> # include <io.h> # endif // In order to avoid having to include <windows.h>, use forward declaration // assuming CRITICAL_SECTION is a typedef of _RTL_CRITICAL_SECTION. // This assumption is verified by // WindowsTypesTest.CRITICAL_SECTIONIs_RTL_CRITICAL_SECTION. struct _RTL_CRITICAL_SECTION; #else // This assumes that non-Windows OSes provide unistd.h. For OSes where this // is not the case, we need to include headers that provide the functions // mentioned above. # include <unistd.h> # include <strings.h> #endif // GTEST_OS_WINDOWS #if GTEST_OS_LINUX_ANDROID // Used to define __ANDROID_API__ matching the target NDK API level. # include <android/api-level.h> // NOLINT #endif // Defines this to true iff Google Test can use POSIX regular expressions. #ifndef GTEST_HAS_POSIX_RE # if GTEST_OS_LINUX_ANDROID // On Android, <regex.h> is only available starting with Gingerbread. # define GTEST_HAS_POSIX_RE (__ANDROID_API__ >= 9) # else # define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS) # endif #endif #if GTEST_USES_PCRE // The appropriate headers have already been included. #elif GTEST_HAS_POSIX_RE // On some platforms, <regex.h> needs someone to define size_t, and // won't compile otherwise. We can #include it here as we already // included <stdlib.h>, which is guaranteed to define size_t through // <stddef.h>. # include <regex.h> // NOLINT # define GTEST_USES_POSIX_RE 1 #elif GTEST_OS_WINDOWS // <regex.h> is not available on Windows. Use our own simple regex // implementation instead. # define GTEST_USES_SIMPLE_RE 1 #else // <regex.h> may not be available on this platform. Use our own // simple regex implementation instead. # define GTEST_USES_SIMPLE_RE 1 #endif // GTEST_USES_PCRE #ifndef GTEST_HAS_EXCEPTIONS // The user didn't tell us whether exceptions are enabled, so we need // to figure it out. # if defined(_MSC_VER) || defined(__BORLANDC__) // MSVC's and C++Builder's implementations of the STL use the _HAS_EXCEPTIONS // macro to enable exceptions, so we'll do the same. // Assumes that exceptions are enabled by default. # ifndef _HAS_EXCEPTIONS # define _HAS_EXCEPTIONS 1 # endif // _HAS_EXCEPTIONS # define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS # elif defined(__clang__) // clang defines __EXCEPTIONS iff exceptions are enabled before clang 220714, // but iff cleanups are enabled after that. In Obj-C++ files, there can be // cleanups for ObjC exceptions which also need cleanups, even if C++ exceptions // are disabled. clang has __has_feature(cxx_exceptions) which checks for C++ // exceptions starting at clang r206352, but which checked for cleanups prior to // that. To reliably check for C++ exception availability with clang, check for // __EXCEPTIONS && __has_feature(cxx_exceptions). # define GTEST_HAS_EXCEPTIONS (__EXCEPTIONS && __has_feature(cxx_exceptions)) # elif defined(__GNUC__) && __EXCEPTIONS // gcc defines __EXCEPTIONS to 1 iff exceptions are enabled. # define GTEST_HAS_EXCEPTIONS 1 # elif defined(__SUNPRO_CC) // Sun Pro CC supports exceptions. However, there is no compile-time way of // detecting whether they are enabled or not. Therefore, we assume that // they are enabled unless the user tells us otherwise. # define GTEST_HAS_EXCEPTIONS 1 # elif defined(__IBMCPP__) && __EXCEPTIONS // xlC defines __EXCEPTIONS to 1 iff exceptions are enabled. # define GTEST_HAS_EXCEPTIONS 1 # elif defined(__HP_aCC) // Exception handling is in effect by default in HP aCC compiler. It has to // be turned of by +noeh compiler option if desired. # define GTEST_HAS_EXCEPTIONS 1 # else // For other compilers, we assume exceptions are disabled to be // conservative. # define GTEST_HAS_EXCEPTIONS 0 # endif // defined(_MSC_VER) || defined(__BORLANDC__) #endif // GTEST_HAS_EXCEPTIONS #if !defined(GTEST_HAS_STD_STRING) // Even though we don't use this macro any longer, we keep it in case // some clients still depend on it. # define GTEST_HAS_STD_STRING 1 #elif !GTEST_HAS_STD_STRING // The user told us that ::std::string isn't available. # error "Google Test cannot be used where ::std::string isn't available." #endif // !defined(GTEST_HAS_STD_STRING) #ifndef GTEST_HAS_GLOBAL_STRING // The user didn't tell us whether ::string is available, so we need // to figure it out. # define GTEST_HAS_GLOBAL_STRING 0 #endif // GTEST_HAS_GLOBAL_STRING #ifndef GTEST_HAS_STD_WSTRING // The user didn't tell us whether ::std::wstring is available, so we need // to figure it out. // TODO([email protected]): uses autoconf to detect whether ::std::wstring // is available. // Cygwin 1.7 and below doesn't support ::std::wstring. // Solaris' libc++ doesn't support it either. Android has // no support for it at least as recent as Froyo (2.2). # define GTEST_HAS_STD_WSTRING \ (!(GTEST_OS_LINUX_ANDROID || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS)) #endif // GTEST_HAS_STD_WSTRING #ifndef GTEST_HAS_GLOBAL_WSTRING // The user didn't tell us whether ::wstring is available, so we need // to figure it out. # define GTEST_HAS_GLOBAL_WSTRING \ (GTEST_HAS_STD_WSTRING && GTEST_HAS_GLOBAL_STRING) #endif // GTEST_HAS_GLOBAL_WSTRING // Determines whether RTTI is available. #ifndef GTEST_HAS_RTTI // The user didn't tell us whether RTTI is enabled, so we need to // figure it out. # ifdef _MSC_VER # ifdef _CPPRTTI // MSVC defines this macro iff RTTI is enabled. # define GTEST_HAS_RTTI 1 # else # define GTEST_HAS_RTTI 0 # endif // Starting with version 4.3.2, gcc defines __GXX_RTTI iff RTTI is enabled. # elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40302) # ifdef __GXX_RTTI // When building against STLport with the Android NDK and with // -frtti -fno-exceptions, the build fails at link time with undefined // references to __cxa_bad_typeid. Note sure if STL or toolchain bug, // so disable RTTI when detected. # if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR) && \ !defined(__EXCEPTIONS) # define GTEST_HAS_RTTI 0 # else # define GTEST_HAS_RTTI 1 # endif // GTEST_OS_LINUX_ANDROID && __STLPORT_MAJOR && !__EXCEPTIONS # else # define GTEST_HAS_RTTI 0 # endif // __GXX_RTTI // Clang defines __GXX_RTTI starting with version 3.0, but its manual recommends // using has_feature instead. has_feature(cxx_rtti) is supported since 2.7, the // first version with C++ support. # elif defined(__clang__) # define GTEST_HAS_RTTI __has_feature(cxx_rtti) // Starting with version 9.0 IBM Visual Age defines __RTTI_ALL__ to 1 if // both the typeid and dynamic_cast features are present. # elif defined(__IBMCPP__) && (__IBMCPP__ >= 900) # ifdef __RTTI_ALL__ # define GTEST_HAS_RTTI 1 # else # define GTEST_HAS_RTTI 0 # endif # else // For all other compilers, we assume RTTI is enabled. # define GTEST_HAS_RTTI 1 # endif // _MSC_VER #endif // GTEST_HAS_RTTI // It's this header's responsibility to #include <typeinfo> when RTTI // is enabled. #if GTEST_HAS_RTTI # include <typeinfo> #endif // Determines whether Google Test can use the pthreads library. #ifndef GTEST_HAS_PTHREAD // The user didn't tell us explicitly, so we make reasonable assumptions about // which platforms have pthreads support. // // To disable threading support in Google Test, add -DGTEST_HAS_PTHREAD=0 // to your compiler flags. # define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX \ || GTEST_OS_QNX || GTEST_OS_FREEBSD || GTEST_OS_NACL) #endif // GTEST_HAS_PTHREAD #if GTEST_HAS_PTHREAD // gtest-port.h guarantees to #include <pthread.h> when GTEST_HAS_PTHREAD is // true. # include <pthread.h> // NOLINT // For timespec and nanosleep, used below. # include <time.h> // NOLINT #endif // Determines if hash_map/hash_set are available. // Only used for testing against those containers. #if !defined(GTEST_HAS_HASH_MAP_) # if _MSC_VER # define GTEST_HAS_HASH_MAP_ 1 // Indicates that hash_map is available. # define GTEST_HAS_HASH_SET_ 1 // Indicates that hash_set is available. # endif // _MSC_VER #endif // !defined(GTEST_HAS_HASH_MAP_) // Determines whether Google Test can use tr1/tuple. You can define // this macro to 0 to prevent Google Test from using tuple (any // feature depending on tuple with be disabled in this mode). #ifndef GTEST_HAS_TR1_TUPLE # if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR) // STLport, provided with the Android NDK, has neither <tr1/tuple> or <tuple>. # define GTEST_HAS_TR1_TUPLE 0 # else // The user didn't tell us not to do it, so we assume it's OK. # define GTEST_HAS_TR1_TUPLE 1 # endif #endif // GTEST_HAS_TR1_TUPLE // Determines whether Google Test's own tr1 tuple implementation // should be used. #ifndef GTEST_USE_OWN_TR1_TUPLE // The user didn't tell us, so we need to figure it out. // We use our own TR1 tuple if we aren't sure the user has an // implementation of it already. At this time, libstdc++ 4.0.0+ and // MSVC 2010 are the only mainstream standard libraries that come // with a TR1 tuple implementation. NVIDIA's CUDA NVCC compiler // pretends to be GCC by defining __GNUC__ and friends, but cannot // compile GCC's tuple implementation. MSVC 2008 (9.0) provides TR1 // tuple in a 323 MB Feature Pack download, which we cannot assume the // user has. QNX's QCC compiler is a modified GCC but it doesn't // support TR1 tuple. libc++ only provides std::tuple, in C++11 mode, // and it can be used with some compilers that define __GNUC__. # if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000) \ && !GTEST_OS_QNX && !defined(_LIBCPP_VERSION)) || _MSC_VER >= 1600 # define GTEST_ENV_HAS_TR1_TUPLE_ 1 # endif // C++11 specifies that <tuple> provides std::tuple. Use that if gtest is used // in C++11 mode and libstdc++ isn't very old (binaries targeting OS X 10.6 // can build with clang but need to use gcc4.2's libstdc++). # if GTEST_LANG_CXX11 && (!defined(__GLIBCXX__) || __GLIBCXX__ > 20110325) # define GTEST_ENV_HAS_STD_TUPLE_ 1 # endif # if GTEST_ENV_HAS_TR1_TUPLE_ || GTEST_ENV_HAS_STD_TUPLE_ # define GTEST_USE_OWN_TR1_TUPLE 0 # else # define GTEST_USE_OWN_TR1_TUPLE 1 # endif #endif // GTEST_USE_OWN_TR1_TUPLE // To avoid conditional compilation everywhere, we make it // gtest-port.h's responsibility to #include the header implementing // tuple. #if GTEST_HAS_STD_TUPLE_ # include <tuple> // IWYU pragma: export # define GTEST_TUPLE_NAMESPACE_ ::std #endif // GTEST_HAS_STD_TUPLE_ // We include tr1::tuple even if std::tuple is available to define printers for // them. #if GTEST_HAS_TR1_TUPLE # ifndef GTEST_TUPLE_NAMESPACE_ # define GTEST_TUPLE_NAMESPACE_ ::std::tr1 # endif // GTEST_TUPLE_NAMESPACE_ # if GTEST_USE_OWN_TR1_TUPLE // This file was GENERATED by command: // pump.py gtest-tuple.h.pump // DO NOT EDIT BY HAND!!! // Copyright 2009 Google Inc. // All Rights Reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Author: [email protected] (Zhanyong Wan) // Implements a subset of TR1 tuple needed by Google Test and Google Mock. #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_ #include <utility> // For ::std::pair. // The compiler used in Symbian has a bug that prevents us from declaring the // tuple template as a friend (it complains that tuple is redefined). This // hack bypasses the bug by declaring the members that should otherwise be // private as public. // Sun Studio versions < 12 also have the above bug. #if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590) # define GTEST_DECLARE_TUPLE_AS_FRIEND_ public: #else # define GTEST_DECLARE_TUPLE_AS_FRIEND_ \ template <GTEST_10_TYPENAMES_(U)> friend class tuple; \ private: #endif // Visual Studio 2010, 2012, and 2013 define symbols in std::tr1 that conflict // with our own definitions. Therefore using our own tuple does not work on // those compilers. #if defined(_MSC_VER) && _MSC_VER >= 1600 /* 1600 is Visual Studio 2010 */ # error "gtest's tuple doesn't compile on Visual Studio 2010 or later. \ GTEST_USE_OWN_TR1_TUPLE must be set to 0 on those compilers." #endif // GTEST_n_TUPLE_(T) is the type of an n-tuple. #define GTEST_0_TUPLE_(T) tuple<> #define GTEST_1_TUPLE_(T) tuple<T##0, void, void, void, void, void, void, \ void, void, void> #define GTEST_2_TUPLE_(T) tuple<T##0, T##1, void, void, void, void, void, \ void, void, void> #define GTEST_3_TUPLE_(T) tuple<T##0, T##1, T##2, void, void, void, void, \ void, void, void> #define GTEST_4_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, void, void, void, \ void, void, void> #define GTEST_5_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, void, void, \ void, void, void> #define GTEST_6_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, void, \ void, void, void> #define GTEST_7_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \ void, void, void> #define GTEST_8_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \ T##7, void, void> #define GTEST_9_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \ T##7, T##8, void> #define GTEST_10_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \ T##7, T##8, T##9> // GTEST_n_TYPENAMES_(T) declares a list of n typenames. #define GTEST_0_TYPENAMES_(T) #define GTEST_1_TYPENAMES_(T) typename T##0 #define GTEST_2_TYPENAMES_(T) typename T##0, typename T##1 #define GTEST_3_TYPENAMES_(T) typename T##0, typename T##1, typename T##2 #define GTEST_4_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ typename T##3 #define GTEST_5_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ typename T##3, typename T##4 #define GTEST_6_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ typename T##3, typename T##4, typename T##5 #define GTEST_7_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ typename T##3, typename T##4, typename T##5, typename T##6 #define GTEST_8_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ typename T##3, typename T##4, typename T##5, typename T##6, typename T##7 #define GTEST_9_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ typename T##3, typename T##4, typename T##5, typename T##6, \ typename T##7, typename T##8 #define GTEST_10_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ typename T##3, typename T##4, typename T##5, typename T##6, \ typename T##7, typename T##8, typename T##9 // In theory, defining stuff in the ::std namespace is undefined // behavior. We can do this as we are playing the role of a standard // library vendor. namespace std { namespace tr1 { template <typename T0 = void, typename T1 = void, typename T2 = void, typename T3 = void, typename T4 = void, typename T5 = void, typename T6 = void, typename T7 = void, typename T8 = void, typename T9 = void> class tuple; // Anything in namespace gtest_internal is Google Test's INTERNAL // IMPLEMENTATION DETAIL and MUST NOT BE USED DIRECTLY in user code. namespace gtest_internal { // ByRef<T>::type is T if T is a reference; otherwise it's const T&. template <typename T> struct ByRef { typedef const T& type; }; // NOLINT template <typename T> struct ByRef<T&> { typedef T& type; }; // NOLINT // A handy wrapper for ByRef. #define GTEST_BY_REF_(T) typename ::std::tr1::gtest_internal::ByRef<T>::type // AddRef<T>::type is T if T is a reference; otherwise it's T&. This // is the same as tr1::add_reference<T>::type. template <typename T> struct AddRef { typedef T& type; }; // NOLINT template <typename T> struct AddRef<T&> { typedef T& type; }; // NOLINT // A handy wrapper for AddRef. #define GTEST_ADD_REF_(T) typename ::std::tr1::gtest_internal::AddRef<T>::type // A helper for implementing get<k>(). template <int k> class Get; // A helper for implementing tuple_element<k, T>. kIndexValid is true // iff k < the number of fields in tuple type T. template <bool kIndexValid, int kIndex, class Tuple> struct TupleElement; template <GTEST_10_TYPENAMES_(T)> struct TupleElement<true, 0, GTEST_10_TUPLE_(T) > { typedef T0 type; }; template <GTEST_10_TYPENAMES_(T)> struct TupleElement<true, 1, GTEST_10_TUPLE_(T) > { typedef T1 type; }; template <GTEST_10_TYPENAMES_(T)> struct TupleElement<true, 2, GTEST_10_TUPLE_(T) > { typedef T2 type; }; template <GTEST_10_TYPENAMES_(T)> struct TupleElement<true, 3, GTEST_10_TUPLE_(T) > { typedef T3 type; }; template <GTEST_10_TYPENAMES_(T)> struct TupleElement<true, 4, GTEST_10_TUPLE_(T) > { typedef T4 type; }; template <GTEST_10_TYPENAMES_(T)> struct TupleElement<true, 5, GTEST_10_TUPLE_(T) > { typedef T5 type; }; template <GTEST_10_TYPENAMES_(T)> struct TupleElement<true, 6, GTEST_10_TUPLE_(T) > { typedef T6 type; }; template <GTEST_10_TYPENAMES_(T)> struct TupleElement<true, 7, GTEST_10_TUPLE_(T) > { typedef T7 type; }; template <GTEST_10_TYPENAMES_(T)> struct TupleElement<true, 8, GTEST_10_TUPLE_(T) > { typedef T8 type; }; template <GTEST_10_TYPENAMES_(T)> struct TupleElement<true, 9, GTEST_10_TUPLE_(T) > { typedef T9 type; }; } // namespace gtest_internal template <> class tuple<> { public: tuple() {} tuple(const tuple& /* t */) {} tuple& operator=(const tuple& /* t */) { return *this; } }; template <GTEST_1_TYPENAMES_(T)> class GTEST_1_TUPLE_(T) { public: template <int k> friend class gtest_internal::Get; tuple() : f0_() {} explicit tuple(GTEST_BY_REF_(T0) f0) : f0_(f0) {} tuple(const tuple& t) : f0_(t.f0_) {} template <GTEST_1_TYPENAMES_(U)> tuple(const GTEST_1_TUPLE_(U)& t) : f0_(t.f0_) {} tuple& operator=(const tuple& t) { return CopyFrom(t); } template <GTEST_1_TYPENAMES_(U)> tuple& operator=(const GTEST_1_TUPLE_(U)& t) { return CopyFrom(t); } GTEST_DECLARE_TUPLE_AS_FRIEND_ template <GTEST_1_TYPENAMES_(U)> tuple& CopyFrom(const GTEST_1_TUPLE_(U)& t) { f0_ = t.f0_; return *this; } T0 f0_; }; template <GTEST_2_TYPENAMES_(T)> class GTEST_2_TUPLE_(T) { public: template <int k> friend class gtest_internal::Get; tuple() : f0_(), f1_() {} explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1) : f0_(f0), f1_(f1) {} tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_) {} template <GTEST_2_TYPENAMES_(U)> tuple(const GTEST_2_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_) {} template <typename U0, typename U1> tuple(const ::std::pair<U0, U1>& p) : f0_(p.first), f1_(p.second) {} tuple& operator=(const tuple& t) { return CopyFrom(t); } template <GTEST_2_TYPENAMES_(U)> tuple& operator=(const GTEST_2_TUPLE_(U)& t) { return CopyFrom(t); } template <typename U0, typename U1> tuple& operator=(const ::std::pair<U0, U1>& p) { f0_ = p.first; f1_ = p.second; return *this; } GTEST_DECLARE_TUPLE_AS_FRIEND_ template <GTEST_2_TYPENAMES_(U)> tuple& CopyFrom(const GTEST_2_TUPLE_(U)& t) { f0_ = t.f0_; f1_ = t.f1_; return *this; } T0 f0_; T1 f1_; }; template <GTEST_3_TYPENAMES_(T)> class GTEST_3_TUPLE_(T) { public: template <int k> friend class gtest_internal::Get; tuple() : f0_(), f1_(), f2_() {} explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, GTEST_BY_REF_(T2) f2) : f0_(f0), f1_(f1), f2_(f2) {} tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {} template <GTEST_3_TYPENAMES_(U)> tuple(const GTEST_3_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {} tuple& operator=(const tuple& t) { return CopyFrom(t); } template <GTEST_3_TYPENAMES_(U)> tuple& operator=(const GTEST_3_TUPLE_(U)& t) { return CopyFrom(t); } GTEST_DECLARE_TUPLE_AS_FRIEND_ template <GTEST_3_TYPENAMES_(U)> tuple& CopyFrom(const GTEST_3_TUPLE_(U)& t) { f0_ = t.f0_; f1_ = t.f1_; f2_ = t.f2_; return *this; } T0 f0_; T1 f1_; T2 f2_; }; template <GTEST_4_TYPENAMES_(T)> class GTEST_4_TUPLE_(T) { public: template <int k> friend class gtest_internal::Get; tuple() : f0_(), f1_(), f2_(), f3_() {} explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3) : f0_(f0), f1_(f1), f2_(f2), f3_(f3) {} tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_) {} template <GTEST_4_TYPENAMES_(U)> tuple(const GTEST_4_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_) {} tuple& operator=(const tuple& t) { return CopyFrom(t); } template <GTEST_4_TYPENAMES_(U)> tuple& operator=(const GTEST_4_TUPLE_(U)& t) { return CopyFrom(t); } GTEST_DECLARE_TUPLE_AS_FRIEND_ template <GTEST_4_TYPENAMES_(U)> tuple& CopyFrom(const GTEST_4_TUPLE_(U)& t) { f0_ = t.f0_; f1_ = t.f1_; f2_ = t.f2_; f3_ = t.f3_; return *this; } T0 f0_; T1 f1_; T2 f2_; T3 f3_; }; template <GTEST_5_TYPENAMES_(T)> class GTEST_5_TUPLE_(T) { public: template <int k> friend class gtest_internal::Get; tuple() : f0_(), f1_(), f2_(), f3_(), f4_() {} explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4) {} tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_) {} template <GTEST_5_TYPENAMES_(U)> tuple(const GTEST_5_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_) {} tuple& operator=(const tuple& t) { return CopyFrom(t); } template <GTEST_5_TYPENAMES_(U)> tuple& operator=(const GTEST_5_TUPLE_(U)& t) { return CopyFrom(t); } GTEST_DECLARE_TUPLE_AS_FRIEND_ template <GTEST_5_TYPENAMES_(U)> tuple& CopyFrom(const GTEST_5_TUPLE_(U)& t) { f0_ = t.f0_; f1_ = t.f1_; f2_ = t.f2_; f3_ = t.f3_; f4_ = t.f4_; return *this; } T0 f0_; T1 f1_; T2 f2_; T3 f3_; T4 f4_; }; template <GTEST_6_TYPENAMES_(T)> class GTEST_6_TUPLE_(T) { public: template <int k> friend class gtest_internal::Get; tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_() {} explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4, GTEST_BY_REF_(T5) f5) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4), f5_(f5) {} tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_), f5_(t.f5_) {} template <GTEST_6_TYPENAMES_(U)> tuple(const GTEST_6_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_), f5_(t.f5_) {} tuple& operator=(const tuple& t) { return CopyFrom(t); } template <GTEST_6_TYPENAMES_(U)> tuple& operator=(const GTEST_6_TUPLE_(U)& t) { return CopyFrom(t); } GTEST_DECLARE_TUPLE_AS_FRIEND_ template <GTEST_6_TYPENAMES_(U)> tuple& CopyFrom(const GTEST_6_TUPLE_(U)& t) { f0_ = t.f0_; f1_ = t.f1_; f2_ = t.f2_; f3_ = t.f3_; f4_ = t.f4_; f5_ = t.f5_; return *this; } T0 f0_; T1 f1_; T2 f2_; T3 f3_; T4 f4_; T5 f5_; }; template <GTEST_7_TYPENAMES_(T)> class GTEST_7_TUPLE_(T) { public: template <int k> friend class gtest_internal::Get; tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_() {} explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4, GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4), f5_(f5), f6_(f6) {} tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {} template <GTEST_7_TYPENAMES_(U)> tuple(const GTEST_7_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {} tuple& operator=(const tuple& t) { return CopyFrom(t); } template <GTEST_7_TYPENAMES_(U)> tuple& operator=(const GTEST_7_TUPLE_(U)& t) { return CopyFrom(t); } GTEST_DECLARE_TUPLE_AS_FRIEND_ template <GTEST_7_TYPENAMES_(U)> tuple& CopyFrom(const GTEST_7_TUPLE_(U)& t) { f0_ = t.f0_; f1_ = t.f1_; f2_ = t.f2_; f3_ = t.f3_; f4_ = t.f4_; f5_ = t.f5_; f6_ = t.f6_; return *this; } T0 f0_; T1 f1_; T2 f2_; T3 f3_; T4 f4_; T5 f5_; T6 f6_; }; template <GTEST_8_TYPENAMES_(T)> class GTEST_8_TUPLE_(T) { public: template <int k> friend class gtest_internal::Get; tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_() {} explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4, GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4), f5_(f5), f6_(f6), f7_(f7) {} tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {} template <GTEST_8_TYPENAMES_(U)> tuple(const GTEST_8_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {} tuple& operator=(const tuple& t) { return CopyFrom(t); } template <GTEST_8_TYPENAMES_(U)> tuple& operator=(const GTEST_8_TUPLE_(U)& t) { return CopyFrom(t); } GTEST_DECLARE_TUPLE_AS_FRIEND_ template <GTEST_8_TYPENAMES_(U)> tuple& CopyFrom(const GTEST_8_TUPLE_(U)& t) { f0_ = t.f0_; f1_ = t.f1_; f2_ = t.f2_; f3_ = t.f3_; f4_ = t.f4_; f5_ = t.f5_; f6_ = t.f6_; f7_ = t.f7_; return *this; } T0 f0_; T1 f1_; T2 f2_; T3 f3_; T4 f4_; T5 f5_; T6 f6_; T7 f7_; }; template <GTEST_9_TYPENAMES_(T)> class GTEST_9_TUPLE_(T) { public: template <int k> friend class gtest_internal::Get; tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_() {} explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4, GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7, GTEST_BY_REF_(T8) f8) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4), f5_(f5), f6_(f6), f7_(f7), f8_(f8) {} tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {} template <GTEST_9_TYPENAMES_(U)> tuple(const GTEST_9_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {} tuple& operator=(const tuple& t) { return CopyFrom(t); } template <GTEST_9_TYPENAMES_(U)> tuple& operator=(const GTEST_9_TUPLE_(U)& t) { return CopyFrom(t); } GTEST_DECLARE_TUPLE_AS_FRIEND_ template <GTEST_9_TYPENAMES_(U)> tuple& CopyFrom(const GTEST_9_TUPLE_(U)& t) { f0_ = t.f0_; f1_ = t.f1_; f2_ = t.f2_; f3_ = t.f3_; f4_ = t.f4_; f5_ = t.f5_; f6_ = t.f6_; f7_ = t.f7_; f8_ = t.f8_; return *this; } T0 f0_; T1 f1_; T2 f2_; T3 f3_; T4 f4_; T5 f5_; T6 f6_; T7 f7_; T8 f8_; }; template <GTEST_10_TYPENAMES_(T)> class tuple { public: template <int k> friend class gtest_internal::Get; tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_(), f9_() {} explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4, GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7, GTEST_BY_REF_(T8) f8, GTEST_BY_REF_(T9) f9) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4), f5_(f5), f6_(f6), f7_(f7), f8_(f8), f9_(f9) {} tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_), f9_(t.f9_) {} template <GTEST_10_TYPENAMES_(U)> tuple(const GTEST_10_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_), f9_(t.f9_) {} tuple& operator=(const tuple& t) { return CopyFrom(t); } template <GTEST_10_TYPENAMES_(U)> tuple& operator=(const GTEST_10_TUPLE_(U)& t) { return CopyFrom(t); } GTEST_DECLARE_TUPLE_AS_FRIEND_ template <GTEST_10_TYPENAMES_(U)> tuple& CopyFrom(const GTEST_10_TUPLE_(U)& t) { f0_ = t.f0_; f1_ = t.f1_; f2_ = t.f2_; f3_ = t.f3_; f4_ = t.f4_; f5_ = t.f5_; f6_ = t.f6_; f7_ = t.f7_; f8_ = t.f8_; f9_ = t.f9_; return *this; } T0 f0_; T1 f1_; T2 f2_; T3 f3_; T4 f4_; T5 f5_; T6 f6_; T7 f7_; T8 f8_; T9 f9_; }; // 6.1.3.2 Tuple creation functions. // Known limitations: we don't support passing an // std::tr1::reference_wrapper<T> to make_tuple(). And we don't // implement tie(). inline tuple<> make_tuple() { return tuple<>(); } template <GTEST_1_TYPENAMES_(T)> inline GTEST_1_TUPLE_(T) make_tuple(const T0& f0) { return GTEST_1_TUPLE_(T)(f0); } template <GTEST_2_TYPENAMES_(T)> inline GTEST_2_TUPLE_(T) make_tuple(const T0& f0, const T1& f1) { return GTEST_2_TUPLE_(T)(f0, f1); } template <GTEST_3_TYPENAMES_(T)> inline GTEST_3_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2) { return GTEST_3_TUPLE_(T)(f0, f1, f2); } template <GTEST_4_TYPENAMES_(T)> inline GTEST_4_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, const T3& f3) { return GTEST_4_TUPLE_(T)(f0, f1, f2, f3); } template <GTEST_5_TYPENAMES_(T)> inline GTEST_5_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, const T3& f3, const T4& f4) { return GTEST_5_TUPLE_(T)(f0, f1, f2, f3, f4); } template <GTEST_6_TYPENAMES_(T)> inline GTEST_6_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, const T3& f3, const T4& f4, const T5& f5) { return GTEST_6_TUPLE_(T)(f0, f1, f2, f3, f4, f5); } template <GTEST_7_TYPENAMES_(T)> inline GTEST_7_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, const T3& f3, const T4& f4, const T5& f5, const T6& f6) { return GTEST_7_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6); } template <GTEST_8_TYPENAMES_(T)> inline GTEST_8_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7) { return GTEST_8_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7); } template <GTEST_9_TYPENAMES_(T)> inline GTEST_9_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7, const T8& f8) { return GTEST_9_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8); } template <GTEST_10_TYPENAMES_(T)> inline GTEST_10_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7, const T8& f8, const T9& f9) { return GTEST_10_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9); } // 6.1.3.3 Tuple helper classes. template <typename Tuple> struct tuple_size; template <GTEST_0_TYPENAMES_(T)> struct tuple_size<GTEST_0_TUPLE_(T) > { static const int value = 0; }; template <GTEST_1_TYPENAMES_(T)> struct tuple_size<GTEST_1_TUPLE_(T) > { static const int value = 1; }; template <GTEST_2_TYPENAMES_(T)> struct tuple_size<GTEST_2_TUPLE_(T) > { static const int value = 2; }; template <GTEST_3_TYPENAMES_(T)> struct tuple_size<GTEST_3_TUPLE_(T) > { static const int value = 3; }; template <GTEST_4_TYPENAMES_(T)> struct tuple_size<GTEST_4_TUPLE_(T) > { static const int value = 4; }; template <GTEST_5_TYPENAMES_(T)> struct tuple_size<GTEST_5_TUPLE_(T) > { static const int value = 5; }; template <GTEST_6_TYPENAMES_(T)> struct tuple_size<GTEST_6_TUPLE_(T) > { static const int value = 6; }; template <GTEST_7_TYPENAMES_(T)> struct tuple_size<GTEST_7_TUPLE_(T) > { static const int value = 7; }; template <GTEST_8_TYPENAMES_(T)> struct tuple_size<GTEST_8_TUPLE_(T) > { static const int value = 8; }; template <GTEST_9_TYPENAMES_(T)> struct tuple_size<GTEST_9_TUPLE_(T) > { static const int value = 9; }; template <GTEST_10_TYPENAMES_(T)> struct tuple_size<GTEST_10_TUPLE_(T) > { static const int value = 10; }; template <int k, class Tuple> struct tuple_element { typedef typename gtest_internal::TupleElement< k < (tuple_size<Tuple>::value), k, Tuple>::type type; }; #define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element<k, Tuple >::type // 6.1.3.4 Element access. namespace gtest_internal { template <> class Get<0> { public: template <class Tuple> static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple)) Field(Tuple& t) { return t.f0_; } // NOLINT template <class Tuple> static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple)) ConstField(const Tuple& t) { return t.f0_; } }; template <> class Get<1> { public: template <class Tuple> static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple)) Field(Tuple& t) { return t.f1_; } // NOLINT template <class Tuple> static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple)) ConstField(const Tuple& t) { return t.f1_; } }; template <> class Get<2> { public: template <class Tuple> static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple)) Field(Tuple& t) { return t.f2_; } // NOLINT template <class Tuple> static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple)) ConstField(const Tuple& t) { return t.f2_; } }; template <> class Get<3> { public: template <class Tuple> static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple)) Field(Tuple& t) { return t.f3_; } // NOLINT template <class Tuple> static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple)) ConstField(const Tuple& t) { return t.f3_; } }; template <> class Get<4> { public: template <class Tuple> static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple)) Field(Tuple& t) { return t.f4_; } // NOLINT template <class Tuple> static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple)) ConstField(const Tuple& t) { return t.f4_; } }; template <> class Get<5> { public: template <class Tuple> static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple)) Field(Tuple& t) { return t.f5_; } // NOLINT template <class Tuple> static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple)) ConstField(const Tuple& t) { return t.f5_; } }; template <> class Get<6> { public: template <class Tuple> static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple)) Field(Tuple& t) { return t.f6_; } // NOLINT template <class Tuple> static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple)) ConstField(const Tuple& t) { return t.f6_; } }; template <> class Get<7> { public: template <class Tuple> static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple)) Field(Tuple& t) { return t.f7_; } // NOLINT template <class Tuple> static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple)) ConstField(const Tuple& t) { return t.f7_; } }; template <> class Get<8> { public: template <class Tuple> static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple)) Field(Tuple& t) { return t.f8_; } // NOLINT template <class Tuple> static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple)) ConstField(const Tuple& t) { return t.f8_; } }; template <> class Get<9> { public: template <class Tuple> static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple)) Field(Tuple& t) { return t.f9_; } // NOLINT template <class Tuple> static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple)) ConstField(const Tuple& t) { return t.f9_; } }; } // namespace gtest_internal template <int k, GTEST_10_TYPENAMES_(T)> GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_10_TUPLE_(T))) get(GTEST_10_TUPLE_(T)& t) { return gtest_internal::Get<k>::Field(t); } template <int k, GTEST_10_TYPENAMES_(T)> GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_10_TUPLE_(T))) get(const GTEST_10_TUPLE_(T)& t) { return gtest_internal::Get<k>::ConstField(t); } // 6.1.3.5 Relational operators // We only implement == and !=, as we don't have a need for the rest yet. namespace gtest_internal { // SameSizeTuplePrefixComparator<k, k>::Eq(t1, t2) returns true if the // first k fields of t1 equals the first k fields of t2. // SameSizeTuplePrefixComparator(k1, k2) would be a compiler error if // k1 != k2. template <int kSize1, int kSize2> struct SameSizeTuplePrefixComparator; template <> struct SameSizeTuplePrefixComparator<0, 0> { template <class Tuple1, class Tuple2> static bool Eq(const Tuple1& /* t1 */, const Tuple2& /* t2 */) { return true; } }; template <int k> struct SameSizeTuplePrefixComparator<k, k> { template <class Tuple1, class Tuple2> static bool Eq(const Tuple1& t1, const Tuple2& t2) { return SameSizeTuplePrefixComparator<k - 1, k - 1>::Eq(t1, t2) && ::std::tr1::get<k - 1>(t1) == ::std::tr1::get<k - 1>(t2); } }; } // namespace gtest_internal template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)> inline bool operator==(const GTEST_10_TUPLE_(T)& t, const GTEST_10_TUPLE_(U)& u) { return gtest_internal::SameSizeTuplePrefixComparator< tuple_size<GTEST_10_TUPLE_(T) >::value, tuple_size<GTEST_10_TUPLE_(U) >::value>::Eq(t, u); } template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)> inline bool operator!=(const GTEST_10_TUPLE_(T)& t, const GTEST_10_TUPLE_(U)& u) { return !(t == u); } // 6.1.4 Pairs. // Unimplemented. } // namespace tr1 } // namespace std #undef GTEST_0_TUPLE_ #undef GTEST_1_TUPLE_ #undef GTEST_2_TUPLE_ #undef GTEST_3_TUPLE_ #undef GTEST_4_TUPLE_ #undef GTEST_5_TUPLE_ #undef GTEST_6_TUPLE_ #undef GTEST_7_TUPLE_ #undef GTEST_8_TUPLE_ #undef GTEST_9_TUPLE_ #undef GTEST_10_TUPLE_ #undef GTEST_0_TYPENAMES_ #undef GTEST_1_TYPENAMES_ #undef GTEST_2_TYPENAMES_ #undef GTEST_3_TYPENAMES_ #undef GTEST_4_TYPENAMES_ #undef GTEST_5_TYPENAMES_ #undef GTEST_6_TYPENAMES_ #undef GTEST_7_TYPENAMES_ #undef GTEST_8_TYPENAMES_ #undef GTEST_9_TYPENAMES_ #undef GTEST_10_TYPENAMES_ #undef GTEST_DECLARE_TUPLE_AS_FRIEND_ #undef GTEST_BY_REF_ #undef GTEST_ADD_REF_ #undef GTEST_TUPLE_ELEMENT_ #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_ # elif GTEST_ENV_HAS_STD_TUPLE_ # include <tuple> // C++11 puts its tuple into the ::std namespace rather than // ::std::tr1. gtest expects tuple to live in ::std::tr1, so put it there. // This causes undefined behavior, but supported compilers react in // the way we intend. namespace std { namespace tr1 { using ::std::get; using ::std::make_tuple; using ::std::tuple; using ::std::tuple_element; using ::std::tuple_size; } } # elif GTEST_OS_SYMBIAN // On Symbian, BOOST_HAS_TR1_TUPLE causes Boost's TR1 tuple library to // use STLport's tuple implementation, which unfortunately doesn't // work as the copy of STLport distributed with Symbian is incomplete. // By making sure BOOST_HAS_TR1_TUPLE is undefined, we force Boost to // use its own tuple implementation. # ifdef BOOST_HAS_TR1_TUPLE # undef BOOST_HAS_TR1_TUPLE # endif // BOOST_HAS_TR1_TUPLE // This prevents <boost/tr1/detail/config.hpp>, which defines // BOOST_HAS_TR1_TUPLE, from being #included by Boost's <tuple>. # define BOOST_TR1_DETAIL_CONFIG_HPP_INCLUDED # include <tuple> // IWYU pragma: export // NOLINT # elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000) // GCC 4.0+ implements tr1/tuple in the <tr1/tuple> header. This does // not conform to the TR1 spec, which requires the header to be <tuple>. # if !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302 // Until version 4.3.2, gcc has a bug that causes <tr1/functional>, // which is #included by <tr1/tuple>, to not compile when RTTI is // disabled. _TR1_FUNCTIONAL is the header guard for // <tr1/functional>. Hence the following #define is a hack to prevent // <tr1/functional> from being included. # define _TR1_FUNCTIONAL 1 # include <tr1/tuple> # undef _TR1_FUNCTIONAL // Allows the user to #include // <tr1/functional> if he chooses to. # else # include <tr1/tuple> // NOLINT # endif // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302 # else // If the compiler is not GCC 4.0+, we assume the user is using a // spec-conforming TR1 implementation. # include <tuple> // IWYU pragma: export // NOLINT # endif // GTEST_USE_OWN_TR1_TUPLE #endif // GTEST_HAS_TR1_TUPLE // Determines whether clone(2) is supported. // Usually it will only be available on Linux, excluding // Linux on the Itanium architecture. // Also see http://linux.die.net/man/2/clone. #ifndef GTEST_HAS_CLONE // The user didn't tell us, so we need to figure it out. # if GTEST_OS_LINUX && !defined(__ia64__) # if GTEST_OS_LINUX_ANDROID // On Android, clone() is only available on ARM starting with Gingerbread. # if defined(__arm__) && __ANDROID_API__ >= 9 # define GTEST_HAS_CLONE 1 # else # define GTEST_HAS_CLONE 0 # endif # else # define GTEST_HAS_CLONE 1 # endif # else # define GTEST_HAS_CLONE 0 # endif // GTEST_OS_LINUX && !defined(__ia64__) #endif // GTEST_HAS_CLONE // Determines whether to support stream redirection. This is used to test // output correctness and to implement death tests. #ifndef GTEST_HAS_STREAM_REDIRECTION // By default, we assume that stream redirection is supported on all // platforms except known mobile ones. # if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN || \ GTEST_OS_WINDOWS_PHONE || GTEST_OS_WINDOWS_RT # define GTEST_HAS_STREAM_REDIRECTION 0 # else # define GTEST_HAS_STREAM_REDIRECTION 1 # endif // !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_SYMBIAN #endif // GTEST_HAS_STREAM_REDIRECTION // Determines whether to support death tests. // Google Test does not support death tests for VC 7.1 and earlier as // abort() in a VC 7.1 application compiled as GUI in debug config // pops up a dialog window that cannot be suppressed programmatically. #if (GTEST_OS_LINUX || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \ (GTEST_OS_MAC && !GTEST_OS_IOS) || \ (GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || \ GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX || GTEST_OS_HPUX || \ GTEST_OS_OPENBSD || GTEST_OS_QNX || GTEST_OS_FREEBSD) # define GTEST_HAS_DEATH_TEST 1 #endif // We don't support MSVC 7.1 with exceptions disabled now. Therefore // all the compilers we care about are adequate for supporting // value-parameterized tests. #define GTEST_HAS_PARAM_TEST 1 // Determines whether to support type-driven tests. // Typed tests need <typeinfo> and variadic macros, which GCC, VC++ 8.0, // Sun Pro CC, IBM Visual Age, and HP aCC support. #if defined(__GNUC__) || (_MSC_VER >= 1400) || defined(__SUNPRO_CC) || \ defined(__IBMCPP__) || defined(__HP_aCC) # define GTEST_HAS_TYPED_TEST 1 # define GTEST_HAS_TYPED_TEST_P 1 #endif // Determines whether to support Combine(). This only makes sense when // value-parameterized tests are enabled. The implementation doesn't // work on Sun Studio since it doesn't understand templated conversion // operators. #if GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE && !defined(__SUNPRO_CC) # define GTEST_HAS_COMBINE 1 #endif // Determines whether the system compiler uses UTF-16 for encoding wide strings. #define GTEST_WIDE_STRING_USES_UTF16_ \ (GTEST_OS_WINDOWS || GTEST_OS_CYGWIN || GTEST_OS_SYMBIAN || GTEST_OS_AIX) // Determines whether test results can be streamed to a socket. #if GTEST_OS_LINUX # define GTEST_CAN_STREAM_RESULTS_ 1 #endif // Defines some utility macros. // The GNU compiler emits a warning if nested "if" statements are followed by // an "else" statement and braces are not used to explicitly disambiguate the // "else" binding. This leads to problems with code like: // // if (gate) // ASSERT_*(condition) << "Some message"; // // The "switch (0) case 0:" idiom is used to suppress this. #ifdef __INTEL_COMPILER # define GTEST_AMBIGUOUS_ELSE_BLOCKER_ #else # define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0: default: // NOLINT #endif // Use this annotation at the end of a struct/class definition to // prevent the compiler from optimizing away instances that are never // used. This is useful when all interesting logic happens inside the // c'tor and / or d'tor. Example: // // struct Foo { // Foo() { ... } // } GTEST_ATTRIBUTE_UNUSED_; // // Also use it after a variable or parameter declaration to tell the // compiler the variable/parameter does not have to be used. #if defined(__GNUC__) && !defined(COMPILER_ICC) # define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused)) #elif defined(__clang__) # if __has_attribute(unused) # define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused)) # endif #endif #ifndef GTEST_ATTRIBUTE_UNUSED_ # define GTEST_ATTRIBUTE_UNUSED_ #endif // A macro to disallow operator= // This should be used in the private: declarations for a class. #define GTEST_DISALLOW_ASSIGN_(type)\ void operator=(type const &) // A macro to disallow copy constructor and operator= // This should be used in the private: declarations for a class. #define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)\ type(type const &);\ GTEST_DISALLOW_ASSIGN_(type) // Tell the compiler to warn about unused return values for functions declared // with this macro. The macro should be used on function declarations // following the argument list: // // Sprocket* AllocateSprocket() GTEST_MUST_USE_RESULT_; #if defined(__GNUC__) && (GTEST_GCC_VER_ >= 30400) && !defined(COMPILER_ICC) # define GTEST_MUST_USE_RESULT_ __attribute__ ((warn_unused_result)) #else # define GTEST_MUST_USE_RESULT_ #endif // __GNUC__ && (GTEST_GCC_VER_ >= 30400) && !COMPILER_ICC // MS C++ compiler emits warning when a conditional expression is compile time // constant. In some contexts this warning is false positive and needs to be // suppressed. Use the following two macros in such cases: // // GTEST_INTENTIONAL_CONST_COND_PUSH_() // while (true) { // GTEST_INTENTIONAL_CONST_COND_POP_() // } # define GTEST_INTENTIONAL_CONST_COND_PUSH_() \ GTEST_DISABLE_MSC_WARNINGS_PUSH_(4127) # define GTEST_INTENTIONAL_CONST_COND_POP_() \ GTEST_DISABLE_MSC_WARNINGS_POP_() // Determine whether the compiler supports Microsoft's Structured Exception // Handling. This is supported by several Windows compilers but generally // does not exist on any other system. #ifndef GTEST_HAS_SEH // The user didn't tell us, so we need to figure it out. # if defined(_MSC_VER) || defined(__BORLANDC__) // These two compilers are known to support SEH. # define GTEST_HAS_SEH 1 # else // Assume no SEH. # define GTEST_HAS_SEH 0 # endif #define GTEST_IS_THREADSAFE \ (GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ \ || (GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT) \ || GTEST_HAS_PTHREAD) #endif // GTEST_HAS_SEH #ifdef _MSC_VER # if GTEST_LINKED_AS_SHARED_LIBRARY # define GTEST_API_ __declspec(dllimport) # elif GTEST_CREATE_SHARED_LIBRARY # define GTEST_API_ __declspec(dllexport) # endif #elif __GNUC__ >= 4 || defined(__clang__) # define GTEST_API_ __attribute__((visibility ("default"))) #endif // _MSC_VER #ifndef GTEST_API_ # define GTEST_API_ #endif #ifdef __GNUC__ // Ask the compiler to never inline a given function. # define GTEST_NO_INLINE_ __attribute__((noinline)) #else # define GTEST_NO_INLINE_ #endif // _LIBCPP_VERSION is defined by the libc++ library from the LLVM project. #if defined(__GLIBCXX__) || defined(_LIBCPP_VERSION) # define GTEST_HAS_CXXABI_H_ 1 #else # define GTEST_HAS_CXXABI_H_ 0 #endif // A function level attribute to disable checking for use of uninitialized // memory when built with MemorySanitizer. #if defined(__clang__) # if __has_feature(memory_sanitizer) # define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ \ __attribute__((no_sanitize_memory)) # else # define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ # endif // __has_feature(memory_sanitizer) #else # define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ #endif // __clang__ // A function level attribute to disable AddressSanitizer instrumentation. #if defined(__clang__) # if __has_feature(address_sanitizer) # define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ \ __attribute__((no_sanitize_address)) # else # define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ # endif // __has_feature(address_sanitizer) #else # define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ #endif // __clang__ // A function level attribute to disable ThreadSanitizer instrumentation. #if defined(__clang__) # if __has_feature(thread_sanitizer) # define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ \ __attribute__((no_sanitize_thread)) # else # define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ # endif // __has_feature(thread_sanitizer) #else # define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ #endif // __clang__ namespace testing { class Message; #if defined(GTEST_TUPLE_NAMESPACE_) // Import tuple and friends into the ::testing namespace. // It is part of our interface, having them in ::testing allows us to change // their types as needed. using GTEST_TUPLE_NAMESPACE_::get; using GTEST_TUPLE_NAMESPACE_::make_tuple; using GTEST_TUPLE_NAMESPACE_::tuple; using GTEST_TUPLE_NAMESPACE_::tuple_size; using GTEST_TUPLE_NAMESPACE_::tuple_element; #endif // defined(GTEST_TUPLE_NAMESPACE_) namespace internal { // A secret type that Google Test users don't know about. It has no // definition on purpose. Therefore it's impossible to create a // Secret object, which is what we want. class Secret; // The GTEST_COMPILE_ASSERT_ macro can be used to verify that a compile time // expression is true. For example, you could use it to verify the // size of a static array: // // GTEST_COMPILE_ASSERT_(GTEST_ARRAY_SIZE_(names) == NUM_NAMES, // names_incorrect_size); // // or to make sure a struct is smaller than a certain size: // // GTEST_COMPILE_ASSERT_(sizeof(foo) < 128, foo_too_large); // // The second argument to the macro is the name of the variable. If // the expression is false, most compilers will issue a warning/error // containing the name of the variable. #if GTEST_LANG_CXX11 # define GTEST_COMPILE_ASSERT_(expr, msg) static_assert(expr, #msg) #else // !GTEST_LANG_CXX11 template <bool> struct CompileAssert { }; # define GTEST_COMPILE_ASSERT_(expr, msg) \ typedef ::testing::internal::CompileAssert<(static_cast<bool>(expr))> \ msg[static_cast<bool>(expr) ? 1 : -1] GTEST_ATTRIBUTE_UNUSED_ #endif // !GTEST_LANG_CXX11 // Implementation details of GTEST_COMPILE_ASSERT_: // // (In C++11, we simply use static_assert instead of the following) // // - GTEST_COMPILE_ASSERT_ works by defining an array type that has -1 // elements (and thus is invalid) when the expression is false. // // - The simpler definition // // #define GTEST_COMPILE_ASSERT_(expr, msg) typedef char msg[(expr) ? 1 : -1] // // does not work, as gcc supports variable-length arrays whose sizes // are determined at run-time (this is gcc's extension and not part // of the C++ standard). As a result, gcc fails to reject the // following code with the simple definition: // // int foo; // GTEST_COMPILE_ASSERT_(foo, msg); // not supposed to compile as foo is // // not a compile-time constant. // // - By using the type CompileAssert<(bool(expr))>, we ensures that // expr is a compile-time constant. (Template arguments must be // determined at compile-time.) // // - The outter parentheses in CompileAssert<(bool(expr))> are necessary // to work around a bug in gcc 3.4.4 and 4.0.1. If we had written // // CompileAssert<bool(expr)> // // instead, these compilers will refuse to compile // // GTEST_COMPILE_ASSERT_(5 > 0, some_message); // // (They seem to think the ">" in "5 > 0" marks the end of the // template argument list.) // // - The array size is (bool(expr) ? 1 : -1), instead of simply // // ((expr) ? 1 : -1). // // This is to avoid running into a bug in MS VC 7.1, which // causes ((0.0) ? 1 : -1) to incorrectly evaluate to 1. // StaticAssertTypeEqHelper is used by StaticAssertTypeEq defined in gtest.h. // // This template is declared, but intentionally undefined. template <typename T1, typename T2> struct StaticAssertTypeEqHelper; template <typename T> struct StaticAssertTypeEqHelper<T, T> { enum { value = true }; }; // Evaluates to the number of elements in 'array'. #define GTEST_ARRAY_SIZE_(array) (sizeof(array) / sizeof(array[0])) #if GTEST_HAS_GLOBAL_STRING typedef ::string string; #else typedef ::std::string string; #endif // GTEST_HAS_GLOBAL_STRING #if GTEST_HAS_GLOBAL_WSTRING typedef ::wstring wstring; #elif GTEST_HAS_STD_WSTRING typedef ::std::wstring wstring; #endif // GTEST_HAS_GLOBAL_WSTRING // A helper for suppressing warnings on constant condition. It just // returns 'condition'. GTEST_API_ bool IsTrue(bool condition); // Defines scoped_ptr. // This implementation of scoped_ptr is PARTIAL - it only contains // enough stuff to satisfy Google Test's need. template <typename T> class scoped_ptr { public: typedef T element_type; explicit scoped_ptr(T* p = NULL) : ptr_(p) {} ~scoped_ptr() { reset(); } T& operator*() const { return *ptr_; } T* operator->() const { return ptr_; } T* get() const { return ptr_; } T* release() { T* const ptr = ptr_; ptr_ = NULL; return ptr; } void reset(T* p = NULL) { if (p != ptr_) { if (IsTrue(sizeof(T) > 0)) { // Makes sure T is a complete type. delete ptr_; } ptr_ = p; } } friend void swap(scoped_ptr& a, scoped_ptr& b) { using std::swap; swap(a.ptr_, b.ptr_); } private: T* ptr_; GTEST_DISALLOW_COPY_AND_ASSIGN_(scoped_ptr); }; // Defines RE. // A simple C++ wrapper for <regex.h>. It uses the POSIX Extended // Regular Expression syntax. class GTEST_API_ RE { public: // A copy constructor is required by the Standard to initialize object // references from r-values. RE(const RE& other) { Init(other.pattern()); } // Constructs an RE from a string. RE(const ::std::string& regex) { Init(regex.c_str()); } // NOLINT #if GTEST_HAS_GLOBAL_STRING RE(const ::string& regex) { Init(regex.c_str()); } // NOLINT #endif // GTEST_HAS_GLOBAL_STRING RE(const char* regex) { Init(regex); } // NOLINT ~RE(); // Returns the string representation of the regex. const char* pattern() const { return pattern_; } // FullMatch(str, re) returns true iff regular expression re matches // the entire str. // PartialMatch(str, re) returns true iff regular expression re // matches a substring of str (including str itself). // // TODO([email protected]): make FullMatch() and PartialMatch() work // when str contains NUL characters. static bool FullMatch(const ::std::string& str, const RE& re) { return FullMatch(str.c_str(), re); } static bool PartialMatch(const ::std::string& str, const RE& re) { return PartialMatch(str.c_str(), re); } #if GTEST_HAS_GLOBAL_STRING static bool FullMatch(const ::string& str, const RE& re) { return FullMatch(str.c_str(), re); } static bool PartialMatch(const ::string& str, const RE& re) { return PartialMatch(str.c_str(), re); } #endif // GTEST_HAS_GLOBAL_STRING static bool FullMatch(const char* str, const RE& re); static bool PartialMatch(const char* str, const RE& re); private: void Init(const char* regex); // We use a const char* instead of an std::string, as Google Test used to be // used where std::string is not available. TODO([email protected]): change to // std::string. const char* pattern_; bool is_valid_; #if GTEST_USES_POSIX_RE regex_t full_regex_; // For FullMatch(). regex_t partial_regex_; // For PartialMatch(). #else // GTEST_USES_SIMPLE_RE const char* full_pattern_; // For FullMatch(); #endif GTEST_DISALLOW_ASSIGN_(RE); }; // Formats a source file path and a line number as they would appear // in an error message from the compiler used to compile this code. GTEST_API_ ::std::string FormatFileLocation(const char* file, int line); // Formats a file location for compiler-independent XML output. // Although this function is not platform dependent, we put it next to // FormatFileLocation in order to contrast the two functions. GTEST_API_ ::std::string FormatCompilerIndependentFileLocation(const char* file, int line); // Defines logging utilities: // GTEST_LOG_(severity) - logs messages at the specified severity level. The // message itself is streamed into the macro. // LogToStderr() - directs all log messages to stderr. // FlushInfoLog() - flushes informational log messages. enum GTestLogSeverity { GTEST_INFO, GTEST_WARNING, GTEST_ERROR, GTEST_FATAL }; // Formats log entry severity, provides a stream object for streaming the // log message, and terminates the message with a newline when going out of // scope. class GTEST_API_ GTestLog { public: GTestLog(GTestLogSeverity severity, const char* file, int line); // Flushes the buffers and, if severity is GTEST_FATAL, aborts the program. ~GTestLog(); ::std::ostream& GetStream() { return ::std::cerr; } private: const GTestLogSeverity severity_; GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestLog); }; #if !defined(GTEST_LOG_) # define GTEST_LOG_(severity) \ ::testing::internal::GTestLog(::testing::internal::GTEST_##severity, \ __FILE__, __LINE__).GetStream() inline void LogToStderr() {} inline void FlushInfoLog() { fflush(NULL); } #endif // !defined(GTEST_LOG_) #if !defined(GTEST_CHECK_) // INTERNAL IMPLEMENTATION - DO NOT USE. // // GTEST_CHECK_ is an all-mode assert. It aborts the program if the condition // is not satisfied. // Synopsys: // GTEST_CHECK_(boolean_condition); // or // GTEST_CHECK_(boolean_condition) << "Additional message"; // // This checks the condition and if the condition is not satisfied // it prints message about the condition violation, including the // condition itself, plus additional message streamed into it, if any, // and then it aborts the program. It aborts the program irrespective of // whether it is built in the debug mode or not. # define GTEST_CHECK_(condition) \ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ if (::testing::internal::IsTrue(condition)) \ ; \ else \ GTEST_LOG_(FATAL) << "Condition " #condition " failed. " #endif // !defined(GTEST_CHECK_) // An all-mode assert to verify that the given POSIX-style function // call returns 0 (indicating success). Known limitation: this // doesn't expand to a balanced 'if' statement, so enclose the macro // in {} if you need to use it as the only statement in an 'if' // branch. #define GTEST_CHECK_POSIX_SUCCESS_(posix_call) \ if (const int gtest_error = (posix_call)) \ GTEST_LOG_(FATAL) << #posix_call << "failed with error " \ << gtest_error #if GTEST_HAS_STD_MOVE_ using std::move; #else // GTEST_HAS_STD_MOVE_ template <typename T> const T& move(const T& t) { return t; } #endif // GTEST_HAS_STD_MOVE_ // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // Use ImplicitCast_ as a safe version of static_cast for upcasting in // the type hierarchy (e.g. casting a Foo* to a SuperclassOfFoo* or a // const Foo*). When you use ImplicitCast_, the compiler checks that // the cast is safe. Such explicit ImplicitCast_s are necessary in // surprisingly many situations where C++ demands an exact type match // instead of an argument type convertable to a target type. // // The syntax for using ImplicitCast_ is the same as for static_cast: // // ImplicitCast_<ToType>(expr) // // ImplicitCast_ would have been part of the C++ standard library, // but the proposal was submitted too late. It will probably make // its way into the language in the future. // // This relatively ugly name is intentional. It prevents clashes with // similar functions users may have (e.g., implicit_cast). The internal // namespace alone is not enough because the function can be found by ADL. template<typename To> inline To ImplicitCast_(To x) { return x; } // When you upcast (that is, cast a pointer from type Foo to type // SuperclassOfFoo), it's fine to use ImplicitCast_<>, since upcasts // always succeed. When you downcast (that is, cast a pointer from // type Foo to type SubclassOfFoo), static_cast<> isn't safe, because // how do you know the pointer is really of type SubclassOfFoo? It // could be a bare Foo, or of type DifferentSubclassOfFoo. Thus, // when you downcast, you should use this macro. In debug mode, we // use dynamic_cast<> to double-check the downcast is legal (we die // if it's not). In normal mode, we do the efficient static_cast<> // instead. Thus, it's important to test in debug mode to make sure // the cast is legal! // This is the only place in the code we should use dynamic_cast<>. // In particular, you SHOULDN'T be using dynamic_cast<> in order to // do RTTI (eg code like this: // if (dynamic_cast<Subclass1>(foo)) HandleASubclass1Object(foo); // if (dynamic_cast<Subclass2>(foo)) HandleASubclass2Object(foo); // You should design the code some other way not to need this. // // This relatively ugly name is intentional. It prevents clashes with // similar functions users may have (e.g., down_cast). The internal // namespace alone is not enough because the function can be found by ADL. template<typename To, typename From> // use like this: DownCast_<T*>(foo); inline To DownCast_(From* f) { // so we only accept pointers // Ensures that To is a sub-type of From *. This test is here only // for compile-time type checking, and has no overhead in an // optimized build at run-time, as it will be optimized away // completely. GTEST_INTENTIONAL_CONST_COND_PUSH_() if (false) { GTEST_INTENTIONAL_CONST_COND_POP_() const To to = NULL; ::testing::internal::ImplicitCast_<From*>(to); } #if GTEST_HAS_RTTI // RTTI: debug mode only! GTEST_CHECK_(f == NULL || dynamic_cast<To>(f) != NULL); #endif return static_cast<To>(f); } // Downcasts the pointer of type Base to Derived. // Derived must be a subclass of Base. The parameter MUST // point to a class of type Derived, not any subclass of it. // When RTTI is available, the function performs a runtime // check to enforce this. template <class Derived, class Base> Derived* CheckedDowncastToActualType(Base* base) { #if GTEST_HAS_RTTI GTEST_CHECK_(typeid(*base) == typeid(Derived)); #endif #if GTEST_HAS_DOWNCAST_ return ::down_cast<Derived*>(base); #elif GTEST_HAS_RTTI return dynamic_cast<Derived*>(base); // NOLINT #else return static_cast<Derived*>(base); // Poor man's downcast. #endif } #if GTEST_HAS_STREAM_REDIRECTION // Defines the stderr capturer: // CaptureStdout - starts capturing stdout. // GetCapturedStdout - stops capturing stdout and returns the captured string. // CaptureStderr - starts capturing stderr. // GetCapturedStderr - stops capturing stderr and returns the captured string. // GTEST_API_ void CaptureStdout(); GTEST_API_ std::string GetCapturedStdout(); GTEST_API_ void CaptureStderr(); GTEST_API_ std::string GetCapturedStderr(); #endif // GTEST_HAS_STREAM_REDIRECTION // Returns a path to temporary directory. GTEST_API_ std::string TempDir(); // Returns the size (in bytes) of a file. GTEST_API_ size_t GetFileSize(FILE* file); // Reads the entire content of a file as a string. GTEST_API_ std::string ReadEntireFile(FILE* file); // All command line arguments. GTEST_API_ const ::std::vector<testing::internal::string>& GetArgvs(); #if GTEST_HAS_DEATH_TEST const ::std::vector<testing::internal::string>& GetInjectableArgvs(); void SetInjectableArgvs(const ::std::vector<testing::internal::string>* new_argvs); #endif // GTEST_HAS_DEATH_TEST // Defines synchronization primitives. #if GTEST_IS_THREADSAFE # if GTEST_HAS_PTHREAD // Sleeps for (roughly) n milliseconds. This function is only for testing // Google Test's own constructs. Don't use it in user tests, either // directly or indirectly. inline void SleepMilliseconds(int n) { const timespec time = { 0, // 0 seconds. n * 1000L * 1000L, // And n ms. }; nanosleep(&time, NULL); } # endif // GTEST_HAS_PTHREAD # if GTEST_HAS_NOTIFICATION_ // Notification has already been imported into the namespace. // Nothing to do here. # elif GTEST_HAS_PTHREAD // Allows a controller thread to pause execution of newly created // threads until notified. Instances of this class must be created // and destroyed in the controller thread. // // This class is only for testing Google Test's own constructs. Do not // use it in user tests, either directly or indirectly. class Notification { public: Notification() : notified_(false) { GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, NULL)); } ~Notification() { pthread_mutex_destroy(&mutex_); } // Notifies all threads created with this notification to start. Must // be called from the controller thread. void Notify() { pthread_mutex_lock(&mutex_); notified_ = true; pthread_mutex_unlock(&mutex_); } // Blocks until the controller thread notifies. Must be called from a test // thread. void WaitForNotification() { for (;;) { pthread_mutex_lock(&mutex_); const bool notified = notified_; pthread_mutex_unlock(&mutex_); if (notified) break; SleepMilliseconds(10); } } private: pthread_mutex_t mutex_; bool notified_; GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification); }; # elif GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT GTEST_API_ void SleepMilliseconds(int n); // Provides leak-safe Windows kernel handle ownership. // Used in death tests and in threading support. class GTEST_API_ AutoHandle { public: // Assume that Win32 HANDLE type is equivalent to void*. Doing so allows us to // avoid including <windows.h> in this header file. Including <windows.h> is // undesirable because it defines a lot of symbols and macros that tend to // conflict with client code. This assumption is verified by // WindowsTypesTest.HANDLEIsVoidStar. typedef void* Handle; AutoHandle(); explicit AutoHandle(Handle handle); ~AutoHandle(); Handle Get() const; void Reset(); void Reset(Handle handle); private: // Returns true iff the handle is a valid handle object that can be closed. bool IsCloseable() const; Handle handle_; GTEST_DISALLOW_COPY_AND_ASSIGN_(AutoHandle); }; // Allows a controller thread to pause execution of newly created // threads until notified. Instances of this class must be created // and destroyed in the controller thread. // // This class is only for testing Google Test's own constructs. Do not // use it in user tests, either directly or indirectly. class GTEST_API_ Notification { public: Notification(); void Notify(); void WaitForNotification(); private: AutoHandle event_; GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification); }; # endif // GTEST_HAS_NOTIFICATION_ // On MinGW, we can have both GTEST_OS_WINDOWS and GTEST_HAS_PTHREAD // defined, but we don't want to use MinGW's pthreads implementation, which // has conformance problems with some versions of the POSIX standard. # if GTEST_HAS_PTHREAD && !GTEST_OS_WINDOWS_MINGW // As a C-function, ThreadFuncWithCLinkage cannot be templated itself. // Consequently, it cannot select a correct instantiation of ThreadWithParam // in order to call its Run(). Introducing ThreadWithParamBase as a // non-templated base class for ThreadWithParam allows us to bypass this // problem. class ThreadWithParamBase { public: virtual ~ThreadWithParamBase() {} virtual void Run() = 0; }; // pthread_create() accepts a pointer to a function type with the C linkage. // According to the Standard (7.5/1), function types with different linkages // are different even if they are otherwise identical. Some compilers (for // example, SunStudio) treat them as different types. Since class methods // cannot be defined with C-linkage we need to define a free C-function to // pass into pthread_create(). extern "C" inline void* ThreadFuncWithCLinkage(void* thread) { static_cast<ThreadWithParamBase*>(thread)->Run(); return NULL; } // Helper class for testing Google Test's multi-threading constructs. // To use it, write: // // void ThreadFunc(int param) { /* Do things with param */ } // Notification thread_can_start; // ... // // The thread_can_start parameter is optional; you can supply NULL. // ThreadWithParam<int> thread(&ThreadFunc, 5, &thread_can_start); // thread_can_start.Notify(); // // These classes are only for testing Google Test's own constructs. Do // not use them in user tests, either directly or indirectly. template <typename T> class ThreadWithParam : public ThreadWithParamBase { public: typedef void UserThreadFunc(T); ThreadWithParam(UserThreadFunc* func, T param, Notification* thread_can_start) : func_(func), param_(param), thread_can_start_(thread_can_start), finished_(false) { ThreadWithParamBase* const base = this; // The thread can be created only after all fields except thread_ // have been initialized. GTEST_CHECK_POSIX_SUCCESS_( pthread_create(&thread_, 0, &ThreadFuncWithCLinkage, base)); } ~ThreadWithParam() { Join(); } void Join() { if (!finished_) { GTEST_CHECK_POSIX_SUCCESS_(pthread_join(thread_, 0)); finished_ = true; } } virtual void Run() { if (thread_can_start_ != NULL) thread_can_start_->WaitForNotification(); func_(param_); } private: UserThreadFunc* const func_; // User-supplied thread function. const T param_; // User-supplied parameter to the thread function. // When non-NULL, used to block execution until the controller thread // notifies. Notification* const thread_can_start_; bool finished_; // true iff we know that the thread function has finished. pthread_t thread_; // The native thread object. GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam); }; # endif // !GTEST_OS_WINDOWS && GTEST_HAS_PTHREAD || // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ # if GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ // Mutex and ThreadLocal have already been imported into the namespace. // Nothing to do here. # elif GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT // Mutex implements mutex on Windows platforms. It is used in conjunction // with class MutexLock: // // Mutex mutex; // ... // MutexLock lock(&mutex); // Acquires the mutex and releases it at the // // end of the current scope. // // A static Mutex *must* be defined or declared using one of the following // macros: // GTEST_DEFINE_STATIC_MUTEX_(g_some_mutex); // GTEST_DECLARE_STATIC_MUTEX_(g_some_mutex); // // (A non-static Mutex is defined/declared in the usual way). class GTEST_API_ Mutex { public: enum MutexType { kStatic = 0, kDynamic = 1 }; // We rely on kStaticMutex being 0 as it is to what the linker initializes // type_ in static mutexes. critical_section_ will be initialized lazily // in ThreadSafeLazyInit(). enum StaticConstructorSelector { kStaticMutex = 0 }; // This constructor intentionally does nothing. It relies on type_ being // statically initialized to 0 (effectively setting it to kStatic) and on // ThreadSafeLazyInit() to lazily initialize the rest of the members. explicit Mutex(StaticConstructorSelector /*dummy*/) {} Mutex(); ~Mutex(); void Lock(); void Unlock(); // Does nothing if the current thread holds the mutex. Otherwise, crashes // with high probability. void AssertHeld(); private: // Initializes owner_thread_id_ and critical_section_ in static mutexes. void ThreadSafeLazyInit(); // Per http://blogs.msdn.com/b/oldnewthing/archive/2004/02/23/78395.aspx, // we assume that 0 is an invalid value for thread IDs. unsigned int owner_thread_id_; // For static mutexes, we rely on these members being initialized to zeros // by the linker. MutexType type_; long critical_section_init_phase_; // NOLINT _RTL_CRITICAL_SECTION* critical_section_; GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex); }; # define GTEST_DECLARE_STATIC_MUTEX_(mutex) \ extern ::testing::internal::Mutex mutex # define GTEST_DEFINE_STATIC_MUTEX_(mutex) \ ::testing::internal::Mutex mutex(::testing::internal::Mutex::kStaticMutex) // We cannot name this class MutexLock because the ctor declaration would // conflict with a macro named MutexLock, which is defined on some // platforms. That macro is used as a defensive measure to prevent against // inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than // "MutexLock l(&mu)". Hence the typedef trick below. class GTestMutexLock { public: explicit GTestMutexLock(Mutex* mutex) : mutex_(mutex) { mutex_->Lock(); } ~GTestMutexLock() { mutex_->Unlock(); } private: Mutex* const mutex_; GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestMutexLock); }; typedef GTestMutexLock MutexLock; // Base class for ValueHolder<T>. Allows a caller to hold and delete a value // without knowing its type. class ThreadLocalValueHolderBase { public: virtual ~ThreadLocalValueHolderBase() {} }; // Provides a way for a thread to send notifications to a ThreadLocal // regardless of its parameter type. class ThreadLocalBase { public: // Creates a new ValueHolder<T> object holding a default value passed to // this ThreadLocal<T>'s constructor and returns it. It is the caller's // responsibility not to call this when the ThreadLocal<T> instance already // has a value on the current thread. virtual ThreadLocalValueHolderBase* NewValueForCurrentThread() const = 0; protected: ThreadLocalBase() {} virtual ~ThreadLocalBase() {} private: GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocalBase); }; // Maps a thread to a set of ThreadLocals that have values instantiated on that // thread and notifies them when the thread exits. A ThreadLocal instance is // expected to persist until all threads it has values on have terminated. class GTEST_API_ ThreadLocalRegistry { public: // Registers thread_local_instance as having value on the current thread. // Returns a value that can be used to identify the thread from other threads. static ThreadLocalValueHolderBase* GetValueOnCurrentThread( const ThreadLocalBase* thread_local_instance); // Invoked when a ThreadLocal instance is destroyed. static void OnThreadLocalDestroyed( const ThreadLocalBase* thread_local_instance); }; class GTEST_API_ ThreadWithParamBase { public: void Join(); protected: class Runnable { public: virtual ~Runnable() {} virtual void Run() = 0; }; ThreadWithParamBase(Runnable *runnable, Notification* thread_can_start); virtual ~ThreadWithParamBase(); private: AutoHandle thread_; }; // Helper class for testing Google Test's multi-threading constructs. template <typename T> class ThreadWithParam : public ThreadWithParamBase { public: typedef void UserThreadFunc(T); ThreadWithParam(UserThreadFunc* func, T param, Notification* thread_can_start) : ThreadWithParamBase(new RunnableImpl(func, param), thread_can_start) { } virtual ~ThreadWithParam() {} private: class RunnableImpl : public Runnable { public: RunnableImpl(UserThreadFunc* func, T param) : func_(func), param_(param) { } virtual ~RunnableImpl() {} virtual void Run() { func_(param_); } private: UserThreadFunc* const func_; const T param_; GTEST_DISALLOW_COPY_AND_ASSIGN_(RunnableImpl); }; GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam); }; // Implements thread-local storage on Windows systems. // // // Thread 1 // ThreadLocal<int> tl(100); // 100 is the default value for each thread. // // // Thread 2 // tl.set(150); // Changes the value for thread 2 only. // EXPECT_EQ(150, tl.get()); // // // Thread 1 // EXPECT_EQ(100, tl.get()); // In thread 1, tl has the original value. // tl.set(200); // EXPECT_EQ(200, tl.get()); // // The template type argument T must have a public copy constructor. // In addition, the default ThreadLocal constructor requires T to have // a public default constructor. // // The users of a TheadLocal instance have to make sure that all but one // threads (including the main one) using that instance have exited before // destroying it. Otherwise, the per-thread objects managed for them by the // ThreadLocal instance are not guaranteed to be destroyed on all platforms. // // Google Test only uses global ThreadLocal objects. That means they // will die after main() has returned. Therefore, no per-thread // object managed by Google Test will be leaked as long as all threads // using Google Test have exited when main() returns. template <typename T> class ThreadLocal : public ThreadLocalBase { public: ThreadLocal() : default_factory_(new DefaultValueHolderFactory()) {} explicit ThreadLocal(const T& value) : default_factory_(new InstanceValueHolderFactory(value)) {} ~ThreadLocal() { ThreadLocalRegistry::OnThreadLocalDestroyed(this); } T* pointer() { return GetOrCreateValue(); } const T* pointer() const { return GetOrCreateValue(); } const T& get() const { return *pointer(); } void set(const T& value) { *pointer() = value; } private: // Holds a value of T. Can be deleted via its base class without the caller // knowing the type of T. class ValueHolder : public ThreadLocalValueHolderBase { public: ValueHolder() : value_() {} explicit ValueHolder(const T& value) : value_(value) {} T* pointer() { return &value_; } private: T value_; GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolder); }; T* GetOrCreateValue() const { return static_cast<ValueHolder*>( ThreadLocalRegistry::GetValueOnCurrentThread(this))->pointer(); } virtual ThreadLocalValueHolderBase* NewValueForCurrentThread() const { return default_factory_->MakeNewHolder(); } class ValueHolderFactory { public: ValueHolderFactory() {} virtual ~ValueHolderFactory() {} virtual ValueHolder* MakeNewHolder() const = 0; private: GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolderFactory); }; class DefaultValueHolderFactory : public ValueHolderFactory { public: DefaultValueHolderFactory() {} virtual ValueHolder* MakeNewHolder() const { return new ValueHolder(); } private: GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultValueHolderFactory); }; class InstanceValueHolderFactory : public ValueHolderFactory { public: explicit InstanceValueHolderFactory(const T& value) : value_(value) {} virtual ValueHolder* MakeNewHolder() const { return new ValueHolder(value_); } private: const T value_; // The value for each thread. GTEST_DISALLOW_COPY_AND_ASSIGN_(InstanceValueHolderFactory); }; scoped_ptr<ValueHolderFactory> default_factory_; GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal); }; # elif GTEST_HAS_PTHREAD // MutexBase and Mutex implement mutex on pthreads-based platforms. class MutexBase { public: // Acquires this mutex. void Lock() { GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_lock(&mutex_)); owner_ = pthread_self(); has_owner_ = true; } // Releases this mutex. void Unlock() { // Since the lock is being released the owner_ field should no longer be // considered valid. We don't protect writing to has_owner_ here, as it's // the caller's responsibility to ensure that the current thread holds the // mutex when this is called. has_owner_ = false; GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_unlock(&mutex_)); } // Does nothing if the current thread holds the mutex. Otherwise, crashes // with high probability. void AssertHeld() const { GTEST_CHECK_(has_owner_ && pthread_equal(owner_, pthread_self())) << "The current thread is not holding the mutex @" << this; } // A static mutex may be used before main() is entered. It may even // be used before the dynamic initialization stage. Therefore we // must be able to initialize a static mutex object at link time. // This means MutexBase has to be a POD and its member variables // have to be public. public: pthread_mutex_t mutex_; // The underlying pthread mutex. // has_owner_ indicates whether the owner_ field below contains a valid thread // ID and is therefore safe to inspect (e.g., to use in pthread_equal()). All // accesses to the owner_ field should be protected by a check of this field. // An alternative might be to memset() owner_ to all zeros, but there's no // guarantee that a zero'd pthread_t is necessarily invalid or even different // from pthread_self(). bool has_owner_; pthread_t owner_; // The thread holding the mutex. }; // Forward-declares a static mutex. # define GTEST_DECLARE_STATIC_MUTEX_(mutex) \ extern ::testing::internal::MutexBase mutex // Defines and statically (i.e. at link time) initializes a static mutex. # define GTEST_DEFINE_STATIC_MUTEX_(mutex) \ ::testing::internal::MutexBase mutex = { PTHREAD_MUTEX_INITIALIZER, false, pthread_t() } // The Mutex class can only be used for mutexes created at runtime. It // shares its API with MutexBase otherwise. class Mutex : public MutexBase { public: Mutex() { GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, NULL)); has_owner_ = false; } ~Mutex() { GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_destroy(&mutex_)); } private: GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex); }; // We cannot name this class MutexLock because the ctor declaration would // conflict with a macro named MutexLock, which is defined on some // platforms. That macro is used as a defensive measure to prevent against // inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than // "MutexLock l(&mu)". Hence the typedef trick below. class GTestMutexLock { public: explicit GTestMutexLock(MutexBase* mutex) : mutex_(mutex) { mutex_->Lock(); } ~GTestMutexLock() { mutex_->Unlock(); } private: MutexBase* const mutex_; GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestMutexLock); }; typedef GTestMutexLock MutexLock; // Helpers for ThreadLocal. // pthread_key_create() requires DeleteThreadLocalValue() to have // C-linkage. Therefore it cannot be templatized to access // ThreadLocal<T>. Hence the need for class // ThreadLocalValueHolderBase. class ThreadLocalValueHolderBase { public: virtual ~ThreadLocalValueHolderBase() {} }; // Called by pthread to delete thread-local data stored by // pthread_setspecific(). extern "C" inline void DeleteThreadLocalValue(void* value_holder) { delete static_cast<ThreadLocalValueHolderBase*>(value_holder); } // Implements thread-local storage on pthreads-based systems. template <typename T> class ThreadLocal { public: ThreadLocal() : key_(CreateKey()), default_factory_(new DefaultValueHolderFactory()) {} explicit ThreadLocal(const T& value) : key_(CreateKey()), default_factory_(new InstanceValueHolderFactory(value)) {} ~ThreadLocal() { // Destroys the managed object for the current thread, if any. DeleteThreadLocalValue(pthread_getspecific(key_)); // Releases resources associated with the key. This will *not* // delete managed objects for other threads. GTEST_CHECK_POSIX_SUCCESS_(pthread_key_delete(key_)); } T* pointer() { return GetOrCreateValue(); } const T* pointer() const { return GetOrCreateValue(); } const T& get() const { return *pointer(); } void set(const T& value) { *pointer() = value; } private: // Holds a value of type T. class ValueHolder : public ThreadLocalValueHolderBase { public: ValueHolder() : value_() {} explicit ValueHolder(const T& value) : value_(value) {} T* pointer() { return &value_; } private: T value_; GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolder); }; static pthread_key_t CreateKey() { pthread_key_t key; // When a thread exits, DeleteThreadLocalValue() will be called on // the object managed for that thread. GTEST_CHECK_POSIX_SUCCESS_( pthread_key_create(&key, &DeleteThreadLocalValue)); return key; } T* GetOrCreateValue() const { ThreadLocalValueHolderBase* const holder = static_cast<ThreadLocalValueHolderBase*>(pthread_getspecific(key_)); if (holder != NULL) { return CheckedDowncastToActualType<ValueHolder>(holder)->pointer(); } ValueHolder* const new_holder = default_factory_->MakeNewHolder(); ThreadLocalValueHolderBase* const holder_base = new_holder; GTEST_CHECK_POSIX_SUCCESS_(pthread_setspecific(key_, holder_base)); return new_holder->pointer(); } class ValueHolderFactory { public: ValueHolderFactory() {} virtual ~ValueHolderFactory() {} virtual ValueHolder* MakeNewHolder() const = 0; private: GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolderFactory); }; class DefaultValueHolderFactory : public ValueHolderFactory { public: DefaultValueHolderFactory() {} virtual ValueHolder* MakeNewHolder() const { return new ValueHolder(); } private: GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultValueHolderFactory); }; class InstanceValueHolderFactory : public ValueHolderFactory { public: explicit InstanceValueHolderFactory(const T& value) : value_(value) {} virtual ValueHolder* MakeNewHolder() const { return new ValueHolder(value_); } private: const T value_; // The value for each thread. GTEST_DISALLOW_COPY_AND_ASSIGN_(InstanceValueHolderFactory); }; // A key pthreads uses for looking up per-thread values. const pthread_key_t key_; scoped_ptr<ValueHolderFactory> default_factory_; GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal); }; # endif // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ #else // GTEST_IS_THREADSAFE // A dummy implementation of synchronization primitives (mutex, lock, // and thread-local variable). Necessary for compiling Google Test where // mutex is not supported - using Google Test in multiple threads is not // supported on such platforms. class Mutex { public: Mutex() {} void Lock() {} void Unlock() {} void AssertHeld() const {} }; # define GTEST_DECLARE_STATIC_MUTEX_(mutex) \ extern ::testing::internal::Mutex mutex # define GTEST_DEFINE_STATIC_MUTEX_(mutex) ::testing::internal::Mutex mutex // We cannot name this class MutexLock because the ctor declaration would // conflict with a macro named MutexLock, which is defined on some // platforms. That macro is used as a defensive measure to prevent against // inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than // "MutexLock l(&mu)". Hence the typedef trick below. class GTestMutexLock { public: explicit GTestMutexLock(Mutex*) {} // NOLINT }; typedef GTestMutexLock MutexLock; template <typename T> class ThreadLocal { public: ThreadLocal() : value_() {} explicit ThreadLocal(const T& value) : value_(value) {} T* pointer() { return &value_; } const T* pointer() const { return &value_; } const T& get() const { return value_; } void set(const T& value) { value_ = value; } private: T value_; }; #endif // GTEST_IS_THREADSAFE // Returns the number of threads running in the process, or 0 to indicate that // we cannot detect it. GTEST_API_ size_t GetThreadCount(); // Passing non-POD classes through ellipsis (...) crashes the ARM // compiler and generates a warning in Sun Studio. The Nokia Symbian // and the IBM XL C/C++ compiler try to instantiate a copy constructor // for objects passed through ellipsis (...), failing for uncopyable // objects. We define this to ensure that only POD is passed through // ellipsis on these systems. #if defined(__SYMBIAN32__) || defined(__IBMCPP__) || defined(__SUNPRO_CC) // We lose support for NULL detection where the compiler doesn't like // passing non-POD classes through ellipsis (...). # define GTEST_ELLIPSIS_NEEDS_POD_ 1 #else # define GTEST_CAN_COMPARE_NULL 1 #endif // The Nokia Symbian and IBM XL C/C++ compilers cannot decide between // const T& and const T* in a function template. These compilers // _can_ decide between class template specializations for T and T*, // so a tr1::type_traits-like is_pointer works. #if defined(__SYMBIAN32__) || defined(__IBMCPP__) # define GTEST_NEEDS_IS_POINTER_ 1 #endif template <bool bool_value> struct bool_constant { typedef bool_constant<bool_value> type; static const bool value = bool_value; }; template <bool bool_value> const bool bool_constant<bool_value>::value; typedef bool_constant<false> false_type; typedef bool_constant<true> true_type; template <typename T> struct is_pointer : public false_type {}; template <typename T> struct is_pointer<T*> : public true_type {}; template <typename Iterator> struct IteratorTraits { typedef typename Iterator::value_type value_type; }; template <typename T> struct IteratorTraits<T*> { typedef T value_type; }; template <typename T> struct IteratorTraits<const T*> { typedef T value_type; }; #if GTEST_OS_WINDOWS # define GTEST_PATH_SEP_ "\\" # define GTEST_HAS_ALT_PATH_SEP_ 1 // The biggest signed integer type the compiler supports. typedef __int64 BiggestInt; #else # define GTEST_PATH_SEP_ "/" # define GTEST_HAS_ALT_PATH_SEP_ 0 typedef long long BiggestInt; // NOLINT #endif // GTEST_OS_WINDOWS // Utilities for char. // isspace(int ch) and friends accept an unsigned char or EOF. char // may be signed, depending on the compiler (or compiler flags). // Therefore we need to cast a char to unsigned char before calling // isspace(), etc. inline bool IsAlpha(char ch) { return isalpha(static_cast<unsigned char>(ch)) != 0; } inline bool IsAlNum(char ch) { return isalnum(static_cast<unsigned char>(ch)) != 0; } inline bool IsDigit(char ch) { return isdigit(static_cast<unsigned char>(ch)) != 0; } inline bool IsLower(char ch) { return islower(static_cast<unsigned char>(ch)) != 0; } inline bool IsSpace(char ch) { return isspace(static_cast<unsigned char>(ch)) != 0; } inline bool IsUpper(char ch) { return isupper(static_cast<unsigned char>(ch)) != 0; } inline bool IsXDigit(char ch) { return isxdigit(static_cast<unsigned char>(ch)) != 0; } inline bool IsXDigit(wchar_t ch) { const unsigned char low_byte = static_cast<unsigned char>(ch); return ch == low_byte && isxdigit(low_byte) != 0; } inline char ToLower(char ch) { return static_cast<char>(tolower(static_cast<unsigned char>(ch))); } inline char ToUpper(char ch) { return static_cast<char>(toupper(static_cast<unsigned char>(ch))); } inline std::string StripTrailingSpaces(std::string str) { std::string::iterator it = str.end(); while (it != str.begin() && IsSpace(*--it)) it = str.erase(it); return str; } // The testing::internal::posix namespace holds wrappers for common // POSIX functions. These wrappers hide the differences between // Windows/MSVC and POSIX systems. Since some compilers define these // standard functions as macros, the wrapper cannot have the same name // as the wrapped function. namespace posix { // Functions with a different name on Windows. #if GTEST_OS_WINDOWS typedef struct _stat StatStruct; # ifdef __BORLANDC__ inline int IsATTY(int fd) { return isatty(fd); } inline int StrCaseCmp(const char* s1, const char* s2) { return stricmp(s1, s2); } inline char* StrDup(const char* src) { return strdup(src); } # else // !__BORLANDC__ # if GTEST_OS_WINDOWS_MOBILE inline int IsATTY(int /* fd */) { return 0; } # else inline int IsATTY(int fd) { return _isatty(fd); } # endif // GTEST_OS_WINDOWS_MOBILE inline int StrCaseCmp(const char* s1, const char* s2) { return _stricmp(s1, s2); } inline char* StrDup(const char* src) { return _strdup(src); } # endif // __BORLANDC__ # if GTEST_OS_WINDOWS_MOBILE inline int FileNo(FILE* file) { return reinterpret_cast<int>(_fileno(file)); } // Stat(), RmDir(), and IsDir() are not needed on Windows CE at this // time and thus not defined there. # else inline int FileNo(FILE* file) { return _fileno(file); } inline int Stat(const char* path, StatStruct* buf) { return _stat(path, buf); } inline int RmDir(const char* dir) { return _rmdir(dir); } inline bool IsDir(const StatStruct& st) { return (_S_IFDIR & st.st_mode) != 0; } # endif // GTEST_OS_WINDOWS_MOBILE #else typedef struct stat StatStruct; inline int FileNo(FILE* file) { return fileno(file); } inline int IsATTY(int fd) { return isatty(fd); } inline int Stat(const char* path, StatStruct* buf) { return stat(path, buf); } inline int StrCaseCmp(const char* s1, const char* s2) { return strcasecmp(s1, s2); } inline char* StrDup(const char* src) { return strdup(src); } inline int RmDir(const char* dir) { return rmdir(dir); } inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); } #endif // GTEST_OS_WINDOWS // Functions deprecated by MSVC 8.0. GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996 /* deprecated function */) inline const char* StrNCpy(char* dest, const char* src, size_t n) { return strncpy(dest, src, n); } // ChDir(), FReopen(), FDOpen(), Read(), Write(), Close(), and // StrError() aren't needed on Windows CE at this time and thus not // defined there. #if !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT inline int ChDir(const char* dir) { return chdir(dir); } #endif inline FILE* FOpen(const char* path, const char* mode) { return fopen(path, mode); } #if !GTEST_OS_WINDOWS_MOBILE inline FILE *FReopen(const char* path, const char* mode, FILE* stream) { return freopen(path, mode, stream); } inline FILE* FDOpen(int fd, const char* mode) { return fdopen(fd, mode); } #endif inline int FClose(FILE* fp) { return fclose(fp); } #if !GTEST_OS_WINDOWS_MOBILE inline int Read(int fd, void* buf, unsigned int count) { return static_cast<int>(read(fd, buf, count)); } inline int Write(int fd, const void* buf, unsigned int count) { return static_cast<int>(write(fd, buf, count)); } inline int Close(int fd) { return close(fd); } inline const char* StrError(int errnum) { return strerror(errnum); } #endif inline const char* GetEnv(const char* name) { #if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE | GTEST_OS_WINDOWS_RT // We are on Windows CE, which has no environment variables. static_cast<void>(name); // To prevent 'unused argument' warning. return NULL; #elif defined(__BORLANDC__) || defined(__SunOS_5_8) || defined(__SunOS_5_9) // Environment variables which we programmatically clear will be set to the // empty string rather than unset (NULL). Handle that case. const char* const env = getenv(name); return (env != NULL && env[0] != '\0') ? env : NULL; #else return getenv(name); #endif } GTEST_DISABLE_MSC_WARNINGS_POP_() #if GTEST_OS_WINDOWS_MOBILE // Windows CE has no C library. The abort() function is used in // several places in Google Test. This implementation provides a reasonable // imitation of standard behaviour. void Abort(); #else inline void Abort() { abort(); } #endif // GTEST_OS_WINDOWS_MOBILE } // namespace posix // MSVC "deprecates" snprintf and issues warnings wherever it is used. In // order to avoid these warnings, we need to use _snprintf or _snprintf_s on // MSVC-based platforms. We map the GTEST_SNPRINTF_ macro to the appropriate // function in order to achieve that. We use macro definition here because // snprintf is a variadic function. #if _MSC_VER >= 1400 && !GTEST_OS_WINDOWS_MOBILE // MSVC 2005 and above support variadic macros. # define GTEST_SNPRINTF_(buffer, size, format, ...) \ _snprintf_s(buffer, size, size, format, __VA_ARGS__) #elif defined(_MSC_VER) // Windows CE does not define _snprintf_s and MSVC prior to 2005 doesn't // complain about _snprintf. # define GTEST_SNPRINTF_ _snprintf #else # define GTEST_SNPRINTF_ snprintf #endif // The maximum number a BiggestInt can represent. This definition // works no matter BiggestInt is represented in one's complement or // two's complement. // // We cannot rely on numeric_limits in STL, as __int64 and long long // are not part of standard C++ and numeric_limits doesn't need to be // defined for them. const BiggestInt kMaxBiggestInt = ~(static_cast<BiggestInt>(1) << (8*sizeof(BiggestInt) - 1)); // This template class serves as a compile-time function from size to // type. It maps a size in bytes to a primitive type with that // size. e.g. // // TypeWithSize<4>::UInt // // is typedef-ed to be unsigned int (unsigned integer made up of 4 // bytes). // // Such functionality should belong to STL, but I cannot find it // there. // // Google Test uses this class in the implementation of floating-point // comparison. // // For now it only handles UInt (unsigned int) as that's all Google Test // needs. Other types can be easily added in the future if need // arises. template <size_t size> class TypeWithSize { public: // This prevents the user from using TypeWithSize<N> with incorrect // values of N. typedef void UInt; }; // The specialization for size 4. template <> class TypeWithSize<4> { public: // unsigned int has size 4 in both gcc and MSVC. // // As base/basictypes.h doesn't compile on Windows, we cannot use // uint32, uint64, and etc here. typedef int Int; typedef unsigned int UInt; }; // The specialization for size 8. template <> class TypeWithSize<8> { public: #if GTEST_OS_WINDOWS typedef __int64 Int; typedef unsigned __int64 UInt; #else typedef long long Int; // NOLINT typedef unsigned long long UInt; // NOLINT #endif // GTEST_OS_WINDOWS }; // Integer types of known sizes. typedef TypeWithSize<4>::Int Int32; typedef TypeWithSize<4>::UInt UInt32; typedef TypeWithSize<8>::Int Int64; typedef TypeWithSize<8>::UInt UInt64; typedef TypeWithSize<8>::Int TimeInMillis; // Represents time in milliseconds. // Utilities for command line flags and environment variables. // Macro for referencing flags. #if !defined(GTEST_FLAG) # define GTEST_FLAG(name) FLAGS_gtest_##name #endif // !defined(GTEST_FLAG) #if !defined(GTEST_USE_OWN_FLAGFILE_FLAG_) # define GTEST_USE_OWN_FLAGFILE_FLAG_ 1 #endif // !defined(GTEST_USE_OWN_FLAGFILE_FLAG_) #if !defined(GTEST_DECLARE_bool_) # define GTEST_FLAG_SAVER_ ::testing::internal::GTestFlagSaver // Macros for declaring flags. # define GTEST_DECLARE_bool_(name) GTEST_API_ extern bool GTEST_FLAG(name) # define GTEST_DECLARE_int32_(name) \ GTEST_API_ extern ::testing::internal::Int32 GTEST_FLAG(name) #define GTEST_DECLARE_string_(name) \ GTEST_API_ extern ::std::string GTEST_FLAG(name) // Macros for defining flags. #define GTEST_DEFINE_bool_(name, default_val, doc) \ GTEST_API_ bool GTEST_FLAG(name) = (default_val) #define GTEST_DEFINE_int32_(name, default_val, doc) \ GTEST_API_ ::testing::internal::Int32 GTEST_FLAG(name) = (default_val) #define GTEST_DEFINE_string_(name, default_val, doc) \ GTEST_API_ ::std::string GTEST_FLAG(name) = (default_val) #endif // !defined(GTEST_DECLARE_bool_) // Thread annotations #if !defined(GTEST_EXCLUSIVE_LOCK_REQUIRED_) # define GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks) # define GTEST_LOCK_EXCLUDED_(locks) #endif // !defined(GTEST_EXCLUSIVE_LOCK_REQUIRED_) // Parses 'str' for a 32-bit signed integer. If successful, writes the result // to *value and returns true; otherwise leaves *value unchanged and returns // false. // TODO(chandlerc): Find a better way to refactor flag and environment parsing // out of both gtest-port.cc and gtest.cc to avoid exporting this utility // function. bool ParseInt32(const Message& src_text, const char* str, Int32* value); // Parses a bool/Int32/string from the environment variable // corresponding to the given Google Test flag. bool BoolFromGTestEnv(const char* flag, bool default_val); GTEST_API_ Int32 Int32FromGTestEnv(const char* flag, Int32 default_val); std::string StringFromGTestEnv(const char* flag, const char* default_val); } // namespace internal } // namespace testing #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_ #if GTEST_OS_LINUX # include <stdlib.h> # include <sys/types.h> # include <sys/wait.h> # include <unistd.h> #endif // GTEST_OS_LINUX #if GTEST_HAS_EXCEPTIONS # include <stdexcept> #endif #include <ctype.h> #include <float.h> #include <string.h> #include <iomanip> #include <limits> #include <map> #include <set> #include <string> #include <vector> // Copyright 2005, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Author: [email protected] (Zhanyong Wan) // // The Google C++ Testing Framework (Google Test) // // This header file defines the Message class. // // IMPORTANT NOTE: Due to limitation of the C++ language, we have to // leave some internal implementation details in this header file. // They are clearly marked by comments like this: // // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. // // Such code is NOT meant to be used by a user directly, and is subject // to CHANGE WITHOUT NOTICE. Therefore DO NOT DEPEND ON IT in a user // program! #ifndef GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_ #define GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_ #include <limits> // Ensures that there is at least one operator<< in the global namespace. // See Message& operator<<(...) below for why. void operator<<(const testing::internal::Secret&, int); namespace testing { // The Message class works like an ostream repeater. // // Typical usage: // // 1. You stream a bunch of values to a Message object. // It will remember the text in a stringstream. // 2. Then you stream the Message object to an ostream. // This causes the text in the Message to be streamed // to the ostream. // // For example; // // testing::Message foo; // foo << 1 << " != " << 2; // std::cout << foo; // // will print "1 != 2". // // Message is not intended to be inherited from. In particular, its // destructor is not virtual. // // Note that stringstream behaves differently in gcc and in MSVC. You // can stream a NULL char pointer to it in the former, but not in the // latter (it causes an access violation if you do). The Message // class hides this difference by treating a NULL char pointer as // "(null)". class GTEST_API_ Message { private: // The type of basic IO manipulators (endl, ends, and flush) for // narrow streams. typedef std::ostream& (*BasicNarrowIoManip)(std::ostream&); public: // Constructs an empty Message. Message(); // Copy constructor. Message(const Message& msg) : ss_(new ::std::stringstream) { // NOLINT *ss_ << msg.GetString(); } // Constructs a Message from a C-string. explicit Message(const char* str) : ss_(new ::std::stringstream) { *ss_ << str; } #if GTEST_OS_SYMBIAN // Streams a value (either a pointer or not) to this object. template <typename T> inline Message& operator <<(const T& value) { StreamHelper(typename internal::is_pointer<T>::type(), value); return *this; } #else // Streams a non-pointer value to this object. template <typename T> inline Message& operator <<(const T& val) { // Some libraries overload << for STL containers. These // overloads are defined in the global namespace instead of ::std. // // C++'s symbol lookup rule (i.e. Koenig lookup) says that these // overloads are visible in either the std namespace or the global // namespace, but not other namespaces, including the testing // namespace which Google Test's Message class is in. // // To allow STL containers (and other types that has a << operator // defined in the global namespace) to be used in Google Test // assertions, testing::Message must access the custom << operator // from the global namespace. With this using declaration, // overloads of << defined in the global namespace and those // visible via Koenig lookup are both exposed in this function. using ::operator <<; *ss_ << val; return *this; } // Streams a pointer value to this object. // // This function is an overload of the previous one. When you // stream a pointer to a Message, this definition will be used as it // is more specialized. (The C++ Standard, section // [temp.func.order].) If you stream a non-pointer, then the // previous definition will be used. // // The reason for this overload is that streaming a NULL pointer to // ostream is undefined behavior. Depending on the compiler, you // may get "0", "(nil)", "(null)", or an access violation. To // ensure consistent result across compilers, we always treat NULL // as "(null)". template <typename T> inline Message& operator <<(T* const& pointer) { // NOLINT if (pointer == NULL) { *ss_ << "(null)"; } else { *ss_ << pointer; } return *this; } #endif // GTEST_OS_SYMBIAN // Since the basic IO manipulators are overloaded for both narrow // and wide streams, we have to provide this specialized definition // of operator <<, even though its body is the same as the // templatized version above. Without this definition, streaming // endl or other basic IO manipulators to Message will confuse the // compiler. Message& operator <<(BasicNarrowIoManip val) { *ss_ << val; return *this; } // Instead of 1/0, we want to see true/false for bool values. Message& operator <<(bool b) { return *this << (b ? "true" : "false"); } // These two overloads allow streaming a wide C string to a Message // using the UTF-8 encoding. Message& operator <<(const wchar_t* wide_c_str); Message& operator <<(wchar_t* wide_c_str); #if GTEST_HAS_STD_WSTRING // Converts the given wide string to a narrow string using the UTF-8 // encoding, and streams the result to this Message object. Message& operator <<(const ::std::wstring& wstr); #endif // GTEST_HAS_STD_WSTRING #if GTEST_HAS_GLOBAL_WSTRING // Converts the given wide string to a narrow string using the UTF-8 // encoding, and streams the result to this Message object. Message& operator <<(const ::wstring& wstr); #endif // GTEST_HAS_GLOBAL_WSTRING // Gets the text streamed to this object so far as an std::string. // Each '\0' character in the buffer is replaced with "\\0". // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. std::string GetString() const; private: #if GTEST_OS_SYMBIAN // These are needed as the Nokia Symbian Compiler cannot decide between // const T& and const T* in a function template. The Nokia compiler _can_ // decide between class template specializations for T and T*, so a // tr1::type_traits-like is_pointer works, and we can overload on that. template <typename T> inline void StreamHelper(internal::true_type /*is_pointer*/, T* pointer) { if (pointer == NULL) { *ss_ << "(null)"; } else { *ss_ << pointer; } } template <typename T> inline void StreamHelper(internal::false_type /*is_pointer*/, const T& value) { // See the comments in Message& operator <<(const T&) above for why // we need this using statement. using ::operator <<; *ss_ << value; } #endif // GTEST_OS_SYMBIAN // We'll hold the text streamed to this object here. const internal::scoped_ptr< ::std::stringstream> ss_; // We declare (but don't implement) this to prevent the compiler // from implementing the assignment operator. void operator=(const Message&); }; // Streams a Message to an ostream. inline std::ostream& operator <<(std::ostream& os, const Message& sb) { return os << sb.GetString(); } namespace internal { // Converts a streamable value to an std::string. A NULL pointer is // converted to "(null)". When the input value is a ::string, // ::std::string, ::wstring, or ::std::wstring object, each NUL // character in it is replaced with "\\0". template <typename T> std::string StreamableToString(const T& streamable) { return (Message() << streamable).GetString(); } } // namespace internal } // namespace testing #endif // GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_ // Copyright 2005, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Authors: [email protected] (Zhanyong Wan), [email protected] (Sean Mcafee) // // The Google C++ Testing Framework (Google Test) // // This header file declares the String class and functions used internally by // Google Test. They are subject to change without notice. They should not used // by code external to Google Test. // // This header file is #included by <gtest/internal/gtest-internal.h>. // It should not be #included by other files. #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_ #ifdef __BORLANDC__ // string.h is not guaranteed to provide strcpy on C++ Builder. # include <mem.h> #endif #include <string.h> #include <string> namespace testing { namespace internal { // String - an abstract class holding static string utilities. class GTEST_API_ String { public: // Static utility methods // Clones a 0-terminated C string, allocating memory using new. The // caller is responsible for deleting the return value using // delete[]. Returns the cloned string, or NULL if the input is // NULL. // // This is different from strdup() in string.h, which allocates // memory using malloc(). static const char* CloneCString(const char* c_str); #if GTEST_OS_WINDOWS_MOBILE // Windows CE does not have the 'ANSI' versions of Win32 APIs. To be // able to pass strings to Win32 APIs on CE we need to convert them // to 'Unicode', UTF-16. // Creates a UTF-16 wide string from the given ANSI string, allocating // memory using new. The caller is responsible for deleting the return // value using delete[]. Returns the wide string, or NULL if the // input is NULL. // // The wide string is created using the ANSI codepage (CP_ACP) to // match the behaviour of the ANSI versions of Win32 calls and the // C runtime. static LPCWSTR AnsiToUtf16(const char* c_str); // Creates an ANSI string from the given wide string, allocating // memory using new. The caller is responsible for deleting the return // value using delete[]. Returns the ANSI string, or NULL if the // input is NULL. // // The returned string is created using the ANSI codepage (CP_ACP) to // match the behaviour of the ANSI versions of Win32 calls and the // C runtime. static const char* Utf16ToAnsi(LPCWSTR utf16_str); #endif // Compares two C strings. Returns true iff they have the same content. // // Unlike strcmp(), this function can handle NULL argument(s). A // NULL C string is considered different to any non-NULL C string, // including the empty string. static bool CStringEquals(const char* lhs, const char* rhs); // Converts a wide C string to a String using the UTF-8 encoding. // NULL will be converted to "(null)". If an error occurred during // the conversion, "(failed to convert from wide string)" is // returned. static std::string ShowWideCString(const wchar_t* wide_c_str); // Compares two wide C strings. Returns true iff they have the same // content. // // Unlike wcscmp(), this function can handle NULL argument(s). A // NULL C string is considered different to any non-NULL C string, // including the empty string. static bool WideCStringEquals(const wchar_t* lhs, const wchar_t* rhs); // Compares two C strings, ignoring case. Returns true iff they // have the same content. // // Unlike strcasecmp(), this function can handle NULL argument(s). // A NULL C string is considered different to any non-NULL C string, // including the empty string. static bool CaseInsensitiveCStringEquals(const char* lhs, const char* rhs); // Compares two wide C strings, ignoring case. Returns true iff they // have the same content. // // Unlike wcscasecmp(), this function can handle NULL argument(s). // A NULL C string is considered different to any non-NULL wide C string, // including the empty string. // NB: The implementations on different platforms slightly differ. // On windows, this method uses _wcsicmp which compares according to LC_CTYPE // environment variable. On GNU platform this method uses wcscasecmp // which compares according to LC_CTYPE category of the current locale. // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the // current locale. static bool CaseInsensitiveWideCStringEquals(const wchar_t* lhs, const wchar_t* rhs); // Returns true iff the given string ends with the given suffix, ignoring // case. Any string is considered to end with an empty suffix. static bool EndsWithCaseInsensitive( const std::string& str, const std::string& suffix); // Formats an int value as "%02d". static std::string FormatIntWidth2(int value); // "%02d" for width == 2 // Formats an int value as "%X". static std::string FormatHexInt(int value); // Formats a byte as "%02X". static std::string FormatByte(unsigned char value); private: String(); // Not meant to be instantiated. }; // class String // Gets the content of the stringstream's buffer as an std::string. Each '\0' // character in the buffer is replaced with "\\0". GTEST_API_ std::string StringStreamToString(::std::stringstream* stream); } // namespace internal } // namespace testing #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_ // Copyright 2008, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Author: [email protected] (Keith Ray) // // Google Test filepath utilities // // This header file declares classes and functions used internally by // Google Test. They are subject to change without notice. // // This file is #included in <gtest/internal/gtest-internal.h>. // Do not include this header file separately! #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_ namespace testing { namespace internal { // FilePath - a class for file and directory pathname manipulation which // handles platform-specific conventions (like the pathname separator). // Used for helper functions for naming files in a directory for xml output. // Except for Set methods, all methods are const or static, which provides an // "immutable value object" -- useful for peace of mind. // A FilePath with a value ending in a path separator ("like/this/") represents // a directory, otherwise it is assumed to represent a file. In either case, // it may or may not represent an actual file or directory in the file system. // Names are NOT checked for syntax correctness -- no checking for illegal // characters, malformed paths, etc. class GTEST_API_ FilePath { public: FilePath() : pathname_("") { } FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) { } explicit FilePath(const std::string& pathname) : pathname_(pathname) { Normalize(); } FilePath& operator=(const FilePath& rhs) { Set(rhs); return *this; } void Set(const FilePath& rhs) { pathname_ = rhs.pathname_; } const std::string& string() const { return pathname_; } const char* c_str() const { return pathname_.c_str(); } // Returns the current working directory, or "" if unsuccessful. static FilePath GetCurrentDir(); // Given directory = "dir", base_name = "test", number = 0, // extension = "xml", returns "dir/test.xml". If number is greater // than zero (e.g., 12), returns "dir/test_12.xml". // On Windows platform, uses \ as the separator rather than /. static FilePath MakeFileName(const FilePath& directory, const FilePath& base_name, int number, const char* extension); // Given directory = "dir", relative_path = "test.xml", // returns "dir/test.xml". // On Windows, uses \ as the separator rather than /. static FilePath ConcatPaths(const FilePath& directory, const FilePath& relative_path); // Returns a pathname for a file that does not currently exist. The pathname // will be directory/base_name.extension or // directory/base_name_<number>.extension if directory/base_name.extension // already exists. The number will be incremented until a pathname is found // that does not already exist. // Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'. // There could be a race condition if two or more processes are calling this // function at the same time -- they could both pick the same filename. static FilePath GenerateUniqueFileName(const FilePath& directory, const FilePath& base_name, const char* extension); // Returns true iff the path is "". bool IsEmpty() const { return pathname_.empty(); } // If input name has a trailing separator character, removes it and returns // the name, otherwise return the name string unmodified. // On Windows platform, uses \ as the separator, other platforms use /. FilePath RemoveTrailingPathSeparator() const; // Returns a copy of the FilePath with the directory part removed. // Example: FilePath("path/to/file").RemoveDirectoryName() returns // FilePath("file"). If there is no directory part ("just_a_file"), it returns // the FilePath unmodified. If there is no file part ("just_a_dir/") it // returns an empty FilePath (""). // On Windows platform, '\' is the path separator, otherwise it is '/'. FilePath RemoveDirectoryName() const; // RemoveFileName returns the directory path with the filename removed. // Example: FilePath("path/to/file").RemoveFileName() returns "path/to/". // If the FilePath is "a_file" or "/a_file", RemoveFileName returns // FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does // not have a file, like "just/a/dir/", it returns the FilePath unmodified. // On Windows platform, '\' is the path separator, otherwise it is '/'. FilePath RemoveFileName() const; // Returns a copy of the FilePath with the case-insensitive extension removed. // Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns // FilePath("dir/file"). If a case-insensitive extension is not // found, returns a copy of the original FilePath. FilePath RemoveExtension(const char* extension) const; // Creates directories so that path exists. Returns true if successful or if // the directories already exist; returns false if unable to create // directories for any reason. Will also return false if the FilePath does // not represent a directory (that is, it doesn't end with a path separator). bool CreateDirectoriesRecursively() const; // Create the directory so that path exists. Returns true if successful or // if the directory already exists; returns false if unable to create the // directory for any reason, including if the parent directory does not // exist. Not named "CreateDirectory" because that's a macro on Windows. bool CreateFolder() const; // Returns true if FilePath describes something in the file-system, // either a file, directory, or whatever, and that something exists. bool FileOrDirectoryExists() const; // Returns true if pathname describes a directory in the file-system // that exists. bool DirectoryExists() const; // Returns true if FilePath ends with a path separator, which indicates that // it is intended to represent a directory. Returns false otherwise. // This does NOT check that a directory (or file) actually exists. bool IsDirectory() const; // Returns true if pathname describes a root directory. (Windows has one // root directory per disk drive.) bool IsRootDirectory() const; // Returns true if pathname describes an absolute path. bool IsAbsolutePath() const; private: // Replaces multiple consecutive separators with a single separator. // For example, "bar///foo" becomes "bar/foo". Does not eliminate other // redundancies that might be in a pathname involving "." or "..". // // A pathname with multiple consecutive separators may occur either through // user error or as a result of some scripts or APIs that generate a pathname // with a trailing separator. On other platforms the same API or script // may NOT generate a pathname with a trailing "/". Then elsewhere that // pathname may have another "/" and pathname components added to it, // without checking for the separator already being there. // The script language and operating system may allow paths like "foo//bar" // but some of the functions in FilePath will not handle that correctly. In // particular, RemoveTrailingPathSeparator() only removes one separator, and // it is called in CreateDirectoriesRecursively() assuming that it will change // a pathname from directory syntax (trailing separator) to filename syntax. // // On Windows this method also replaces the alternate path separator '/' with // the primary path separator '\\', so that for example "bar\\/\\foo" becomes // "bar\\foo". void Normalize(); // Returns a pointer to the last occurence of a valid path separator in // the FilePath. On Windows, for example, both '/' and '\' are valid path // separators. Returns NULL if no path separator was found. const char* FindLastPathSeparator() const; std::string pathname_; }; // class FilePath } // namespace internal } // namespace testing #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_ // This file was GENERATED by command: // pump.py gtest-type-util.h.pump // DO NOT EDIT BY HAND!!! // Copyright 2008 Google Inc. // All Rights Reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Author: [email protected] (Zhanyong Wan) // Type utilities needed for implementing typed and type-parameterized // tests. This file is generated by a SCRIPT. DO NOT EDIT BY HAND! // // Currently we support at most 50 types in a list, and at most 50 // type-parameterized tests in one type-parameterized test case. // Please contact [email protected] if you need // more. #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ // #ifdef __GNUC__ is too general here. It is possible to use gcc without using // libstdc++ (which is where cxxabi.h comes from). # if GTEST_HAS_CXXABI_H_ # include <cxxabi.h> # elif defined(__HP_aCC) # include <acxx_demangle.h> # endif // GTEST_HASH_CXXABI_H_ namespace testing { namespace internal { // GetTypeName<T>() returns a human-readable name of type T. // NB: This function is also used in Google Mock, so don't move it inside of // the typed-test-only section below. template <typename T> std::string GetTypeName() { # if GTEST_HAS_RTTI const char* const name = typeid(T).name(); # if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC) int status = 0; // gcc's implementation of typeid(T).name() mangles the type name, // so we have to demangle it. # if GTEST_HAS_CXXABI_H_ using abi::__cxa_demangle; # endif // GTEST_HAS_CXXABI_H_ char* const readable_name = __cxa_demangle(name, 0, 0, &status); const std::string name_str(status == 0 ? readable_name : name); free(readable_name); return name_str; # else return name; # endif // GTEST_HAS_CXXABI_H_ || __HP_aCC # else return "<type>"; # endif // GTEST_HAS_RTTI } #if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P // AssertyTypeEq<T1, T2>::type is defined iff T1 and T2 are the same // type. This can be used as a compile-time assertion to ensure that // two types are equal. template <typename T1, typename T2> struct AssertTypeEq; template <typename T> struct AssertTypeEq<T, T> { typedef bool type; }; // A unique type used as the default value for the arguments of class // template Types. This allows us to simulate variadic templates // (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't // support directly. struct None {}; // The following family of struct and struct templates are used to // represent type lists. In particular, TypesN<T1, T2, ..., TN> // represents a type list with N types (T1, T2, ..., and TN) in it. // Except for Types0, every struct in the family has two member types: // Head for the first type in the list, and Tail for the rest of the // list. // The empty type list. struct Types0 {}; // Type lists of length 1, 2, 3, and so on. template <typename T1> struct Types1 { typedef T1 Head; typedef Types0 Tail; }; template <typename T1, typename T2> struct Types2 { typedef T1 Head; typedef Types1<T2> Tail; }; template <typename T1, typename T2, typename T3> struct Types3 { typedef T1 Head; typedef Types2<T2, T3> Tail; }; template <typename T1, typename T2, typename T3, typename T4> struct Types4 { typedef T1 Head; typedef Types3<T2, T3, T4> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5> struct Types5 { typedef T1 Head; typedef Types4<T2, T3, T4, T5> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> struct Types6 { typedef T1 Head; typedef Types5<T2, T3, T4, T5, T6> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> struct Types7 { typedef T1 Head; typedef Types6<T2, T3, T4, T5, T6, T7> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> struct Types8 { typedef T1 Head; typedef Types7<T2, T3, T4, T5, T6, T7, T8> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9> struct Types9 { typedef T1 Head; typedef Types8<T2, T3, T4, T5, T6, T7, T8, T9> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10> struct Types10 { typedef T1 Head; typedef Types9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11> struct Types11 { typedef T1 Head; typedef Types10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12> struct Types12 { typedef T1 Head; typedef Types11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13> struct Types13 { typedef T1 Head; typedef Types12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14> struct Types14 { typedef T1 Head; typedef Types13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15> struct Types15 { typedef T1 Head; typedef Types14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16> struct Types16 { typedef T1 Head; typedef Types15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17> struct Types17 { typedef T1 Head; typedef Types16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18> struct Types18 { typedef T1 Head; typedef Types17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19> struct Types19 { typedef T1 Head; typedef Types18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20> struct Types20 { typedef T1 Head; typedef Types19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21> struct Types21 { typedef T1 Head; typedef Types20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22> struct Types22 { typedef T1 Head; typedef Types21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23> struct Types23 { typedef T1 Head; typedef Types22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24> struct Types24 { typedef T1 Head; typedef Types23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25> struct Types25 { typedef T1 Head; typedef Types24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26> struct Types26 { typedef T1 Head; typedef Types25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27> struct Types27 { typedef T1 Head; typedef Types26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28> struct Types28 { typedef T1 Head; typedef Types27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29> struct Types29 { typedef T1 Head; typedef Types28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30> struct Types30 { typedef T1 Head; typedef Types29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31> struct Types31 { typedef T1 Head; typedef Types30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32> struct Types32 { typedef T1 Head; typedef Types31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33> struct Types33 { typedef T1 Head; typedef Types32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34> struct Types34 { typedef T1 Head; typedef Types33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35> struct Types35 { typedef T1 Head; typedef Types34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36> struct Types36 { typedef T1 Head; typedef Types35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37> struct Types37 { typedef T1 Head; typedef Types36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38> struct Types38 { typedef T1 Head; typedef Types37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39> struct Types39 { typedef T1 Head; typedef Types38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40> struct Types40 { typedef T1 Head; typedef Types39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41> struct Types41 { typedef T1 Head; typedef Types40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42> struct Types42 { typedef T1 Head; typedef Types41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42, typename T43> struct Types43 { typedef T1 Head; typedef Types42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42, typename T43, typename T44> struct Types44 { typedef T1 Head; typedef Types43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42, typename T43, typename T44, typename T45> struct Types45 { typedef T1 Head; typedef Types44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42, typename T43, typename T44, typename T45, typename T46> struct Types46 { typedef T1 Head; typedef Types45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42, typename T43, typename T44, typename T45, typename T46, typename T47> struct Types47 { typedef T1 Head; typedef Types46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42, typename T43, typename T44, typename T45, typename T46, typename T47, typename T48> struct Types48 { typedef T1 Head; typedef Types47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47, T48> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42, typename T43, typename T44, typename T45, typename T46, typename T47, typename T48, typename T49> struct Types49 { typedef T1 Head; typedef Types48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47, T48, T49> Tail; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42, typename T43, typename T44, typename T45, typename T46, typename T47, typename T48, typename T49, typename T50> struct Types50 { typedef T1 Head; typedef Types49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47, T48, T49, T50> Tail; }; } // namespace internal // We don't want to require the users to write TypesN<...> directly, // as that would require them to count the length. Types<...> is much // easier to write, but generates horrible messages when there is a // compiler error, as gcc insists on printing out each template // argument, even if it has the default value (this means Types<int> // will appear as Types<int, None, None, ..., None> in the compiler // errors). // // Our solution is to combine the best part of the two approaches: a // user would write Types<T1, ..., TN>, and Google Test will translate // that to TypesN<T1, ..., TN> internally to make error messages // readable. The translation is done by the 'type' member of the // Types template. template <typename T1 = internal::None, typename T2 = internal::None, typename T3 = internal::None, typename T4 = internal::None, typename T5 = internal::None, typename T6 = internal::None, typename T7 = internal::None, typename T8 = internal::None, typename T9 = internal::None, typename T10 = internal::None, typename T11 = internal::None, typename T12 = internal::None, typename T13 = internal::None, typename T14 = internal::None, typename T15 = internal::None, typename T16 = internal::None, typename T17 = internal::None, typename T18 = internal::None, typename T19 = internal::None, typename T20 = internal::None, typename T21 = internal::None, typename T22 = internal::None, typename T23 = internal::None, typename T24 = internal::None, typename T25 = internal::None, typename T26 = internal::None, typename T27 = internal::None, typename T28 = internal::None, typename T29 = internal::None, typename T30 = internal::None, typename T31 = internal::None, typename T32 = internal::None, typename T33 = internal::None, typename T34 = internal::None, typename T35 = internal::None, typename T36 = internal::None, typename T37 = internal::None, typename T38 = internal::None, typename T39 = internal::None, typename T40 = internal::None, typename T41 = internal::None, typename T42 = internal::None, typename T43 = internal::None, typename T44 = internal::None, typename T45 = internal::None, typename T46 = internal::None, typename T47 = internal::None, typename T48 = internal::None, typename T49 = internal::None, typename T50 = internal::None> struct Types { typedef internal::Types50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47, T48, T49, T50> type; }; template <> struct Types<internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types0 type; }; template <typename T1> struct Types<T1, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types1<T1> type; }; template <typename T1, typename T2> struct Types<T1, T2, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types2<T1, T2> type; }; template <typename T1, typename T2, typename T3> struct Types<T1, T2, T3, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types3<T1, T2, T3> type; }; template <typename T1, typename T2, typename T3, typename T4> struct Types<T1, T2, T3, T4, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types4<T1, T2, T3, T4> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5> struct Types<T1, T2, T3, T4, T5, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types5<T1, T2, T3, T4, T5> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> struct Types<T1, T2, T3, T4, T5, T6, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types6<T1, T2, T3, T4, T5, T6> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> struct Types<T1, T2, T3, T4, T5, T6, T7, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types7<T1, T2, T3, T4, T5, T6, T7> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types8<T1, T2, T3, T4, T5, T6, T7, T8> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42, typename T43> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42, typename T43, typename T44> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, internal::None, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42, typename T43, typename T44, typename T45> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, internal::None, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42, typename T43, typename T44, typename T45, typename T46> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, internal::None, internal::None, internal::None, internal::None> { typedef internal::Types46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42, typename T43, typename T44, typename T45, typename T46, typename T47> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47, internal::None, internal::None, internal::None> { typedef internal::Types47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42, typename T43, typename T44, typename T45, typename T46, typename T47, typename T48> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47, T48, internal::None, internal::None> { typedef internal::Types48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47, T48> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42, typename T43, typename T44, typename T45, typename T46, typename T47, typename T48, typename T49> struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47, T48, T49, internal::None> { typedef internal::Types49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47, T48, T49> type; }; namespace internal { # define GTEST_TEMPLATE_ template <typename T> class // The template "selector" struct TemplateSel<Tmpl> is used to // represent Tmpl, which must be a class template with one type // parameter, as a type. TemplateSel<Tmpl>::Bind<T>::type is defined // as the type Tmpl<T>. This allows us to actually instantiate the // template "selected" by TemplateSel<Tmpl>. // // This trick is necessary for simulating typedef for class templates, // which C++ doesn't support directly. template <GTEST_TEMPLATE_ Tmpl> struct TemplateSel { template <typename T> struct Bind { typedef Tmpl<T> type; }; }; # define GTEST_BIND_(TmplSel, T) \ TmplSel::template Bind<T>::type // A unique struct template used as the default value for the // arguments of class template Templates. This allows us to simulate // variadic templates (e.g. Templates<int>, Templates<int, double>, // and etc), which C++ doesn't support directly. template <typename T> struct NoneT {}; // The following family of struct and struct templates are used to // represent template lists. In particular, TemplatesN<T1, T2, ..., // TN> represents a list of N templates (T1, T2, ..., and TN). Except // for Templates0, every struct in the family has two member types: // Head for the selector of the first template in the list, and Tail // for the rest of the list. // The empty template list. struct Templates0 {}; // Template lists of length 1, 2, 3, and so on. template <GTEST_TEMPLATE_ T1> struct Templates1 { typedef TemplateSel<T1> Head; typedef Templates0 Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2> struct Templates2 { typedef TemplateSel<T1> Head; typedef Templates1<T2> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3> struct Templates3 { typedef TemplateSel<T1> Head; typedef Templates2<T2, T3> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4> struct Templates4 { typedef TemplateSel<T1> Head; typedef Templates3<T2, T3, T4> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5> struct Templates5 { typedef TemplateSel<T1> Head; typedef Templates4<T2, T3, T4, T5> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6> struct Templates6 { typedef TemplateSel<T1> Head; typedef Templates5<T2, T3, T4, T5, T6> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7> struct Templates7 { typedef TemplateSel<T1> Head; typedef Templates6<T2, T3, T4, T5, T6, T7> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8> struct Templates8 { typedef TemplateSel<T1> Head; typedef Templates7<T2, T3, T4, T5, T6, T7, T8> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9> struct Templates9 { typedef TemplateSel<T1> Head; typedef Templates8<T2, T3, T4, T5, T6, T7, T8, T9> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10> struct Templates10 { typedef TemplateSel<T1> Head; typedef Templates9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11> struct Templates11 { typedef TemplateSel<T1> Head; typedef Templates10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12> struct Templates12 { typedef TemplateSel<T1> Head; typedef Templates11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13> struct Templates13 { typedef TemplateSel<T1> Head; typedef Templates12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14> struct Templates14 { typedef TemplateSel<T1> Head; typedef Templates13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15> struct Templates15 { typedef TemplateSel<T1> Head; typedef Templates14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16> struct Templates16 { typedef TemplateSel<T1> Head; typedef Templates15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17> struct Templates17 { typedef TemplateSel<T1> Head; typedef Templates16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18> struct Templates18 { typedef TemplateSel<T1> Head; typedef Templates17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19> struct Templates19 { typedef TemplateSel<T1> Head; typedef Templates18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20> struct Templates20 { typedef TemplateSel<T1> Head; typedef Templates19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21> struct Templates21 { typedef TemplateSel<T1> Head; typedef Templates20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22> struct Templates22 { typedef TemplateSel<T1> Head; typedef Templates21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23> struct Templates23 { typedef TemplateSel<T1> Head; typedef Templates22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24> struct Templates24 { typedef TemplateSel<T1> Head; typedef Templates23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25> struct Templates25 { typedef TemplateSel<T1> Head; typedef Templates24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26> struct Templates26 { typedef TemplateSel<T1> Head; typedef Templates25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27> struct Templates27 { typedef TemplateSel<T1> Head; typedef Templates26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28> struct Templates28 { typedef TemplateSel<T1> Head; typedef Templates27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29> struct Templates29 { typedef TemplateSel<T1> Head; typedef Templates28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30> struct Templates30 { typedef TemplateSel<T1> Head; typedef Templates29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31> struct Templates31 { typedef TemplateSel<T1> Head; typedef Templates30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32> struct Templates32 { typedef TemplateSel<T1> Head; typedef Templates31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33> struct Templates33 { typedef TemplateSel<T1> Head; typedef Templates32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34> struct Templates34 { typedef TemplateSel<T1> Head; typedef Templates33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35> struct Templates35 { typedef TemplateSel<T1> Head; typedef Templates34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36> struct Templates36 { typedef TemplateSel<T1> Head; typedef Templates35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, GTEST_TEMPLATE_ T37> struct Templates37 { typedef TemplateSel<T1> Head; typedef Templates36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38> struct Templates38 { typedef TemplateSel<T1> Head; typedef Templates37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39> struct Templates39 { typedef TemplateSel<T1> Head; typedef Templates38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, GTEST_TEMPLATE_ T40> struct Templates40 { typedef TemplateSel<T1> Head; typedef Templates39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41> struct Templates41 { typedef TemplateSel<T1> Head; typedef Templates40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42> struct Templates42 { typedef TemplateSel<T1> Head; typedef Templates41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, GTEST_TEMPLATE_ T43> struct Templates43 { typedef TemplateSel<T1> Head; typedef Templates42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44> struct Templates44 { typedef TemplateSel<T1> Head; typedef Templates43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45> struct Templates45 { typedef TemplateSel<T1> Head; typedef Templates44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45, GTEST_TEMPLATE_ T46> struct Templates46 { typedef TemplateSel<T1> Head; typedef Templates45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45, GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47> struct Templates47 { typedef TemplateSel<T1> Head; typedef Templates46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45, GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48> struct Templates48 { typedef TemplateSel<T1> Head; typedef Templates47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47, T48> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45, GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48, GTEST_TEMPLATE_ T49> struct Templates49 { typedef TemplateSel<T1> Head; typedef Templates48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47, T48, T49> Tail; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45, GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48, GTEST_TEMPLATE_ T49, GTEST_TEMPLATE_ T50> struct Templates50 { typedef TemplateSel<T1> Head; typedef Templates49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47, T48, T49, T50> Tail; }; // We don't want to require the users to write TemplatesN<...> directly, // as that would require them to count the length. Templates<...> is much // easier to write, but generates horrible messages when there is a // compiler error, as gcc insists on printing out each template // argument, even if it has the default value (this means Templates<list> // will appear as Templates<list, NoneT, NoneT, ..., NoneT> in the compiler // errors). // // Our solution is to combine the best part of the two approaches: a // user would write Templates<T1, ..., TN>, and Google Test will translate // that to TemplatesN<T1, ..., TN> internally to make error messages // readable. The translation is done by the 'type' member of the // Templates template. template <GTEST_TEMPLATE_ T1 = NoneT, GTEST_TEMPLATE_ T2 = NoneT, GTEST_TEMPLATE_ T3 = NoneT, GTEST_TEMPLATE_ T4 = NoneT, GTEST_TEMPLATE_ T5 = NoneT, GTEST_TEMPLATE_ T6 = NoneT, GTEST_TEMPLATE_ T7 = NoneT, GTEST_TEMPLATE_ T8 = NoneT, GTEST_TEMPLATE_ T9 = NoneT, GTEST_TEMPLATE_ T10 = NoneT, GTEST_TEMPLATE_ T11 = NoneT, GTEST_TEMPLATE_ T12 = NoneT, GTEST_TEMPLATE_ T13 = NoneT, GTEST_TEMPLATE_ T14 = NoneT, GTEST_TEMPLATE_ T15 = NoneT, GTEST_TEMPLATE_ T16 = NoneT, GTEST_TEMPLATE_ T17 = NoneT, GTEST_TEMPLATE_ T18 = NoneT, GTEST_TEMPLATE_ T19 = NoneT, GTEST_TEMPLATE_ T20 = NoneT, GTEST_TEMPLATE_ T21 = NoneT, GTEST_TEMPLATE_ T22 = NoneT, GTEST_TEMPLATE_ T23 = NoneT, GTEST_TEMPLATE_ T24 = NoneT, GTEST_TEMPLATE_ T25 = NoneT, GTEST_TEMPLATE_ T26 = NoneT, GTEST_TEMPLATE_ T27 = NoneT, GTEST_TEMPLATE_ T28 = NoneT, GTEST_TEMPLATE_ T29 = NoneT, GTEST_TEMPLATE_ T30 = NoneT, GTEST_TEMPLATE_ T31 = NoneT, GTEST_TEMPLATE_ T32 = NoneT, GTEST_TEMPLATE_ T33 = NoneT, GTEST_TEMPLATE_ T34 = NoneT, GTEST_TEMPLATE_ T35 = NoneT, GTEST_TEMPLATE_ T36 = NoneT, GTEST_TEMPLATE_ T37 = NoneT, GTEST_TEMPLATE_ T38 = NoneT, GTEST_TEMPLATE_ T39 = NoneT, GTEST_TEMPLATE_ T40 = NoneT, GTEST_TEMPLATE_ T41 = NoneT, GTEST_TEMPLATE_ T42 = NoneT, GTEST_TEMPLATE_ T43 = NoneT, GTEST_TEMPLATE_ T44 = NoneT, GTEST_TEMPLATE_ T45 = NoneT, GTEST_TEMPLATE_ T46 = NoneT, GTEST_TEMPLATE_ T47 = NoneT, GTEST_TEMPLATE_ T48 = NoneT, GTEST_TEMPLATE_ T49 = NoneT, GTEST_TEMPLATE_ T50 = NoneT> struct Templates { typedef Templates50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47, T48, T49, T50> type; }; template <> struct Templates<NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates0 type; }; template <GTEST_TEMPLATE_ T1> struct Templates<T1, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates1<T1> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2> struct Templates<T1, T2, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates2<T1, T2> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3> struct Templates<T1, T2, T3, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates3<T1, T2, T3> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4> struct Templates<T1, T2, T3, T4, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates4<T1, T2, T3, T4> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5> struct Templates<T1, T2, T3, T4, T5, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates5<T1, T2, T3, T4, T5> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6> struct Templates<T1, T2, T3, T4, T5, T6, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates6<T1, T2, T3, T4, T5, T6> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7> struct Templates<T1, T2, T3, T4, T5, T6, T7, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates7<T1, T2, T3, T4, T5, T6, T7> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates8<T1, T2, T3, T4, T5, T6, T7, T8> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, GTEST_TEMPLATE_ T37> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, GTEST_TEMPLATE_ T40> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, GTEST_TEMPLATE_ T43> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, NoneT, NoneT, NoneT, NoneT, NoneT> { typedef Templates45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45, GTEST_TEMPLATE_ T46> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, NoneT, NoneT, NoneT, NoneT> { typedef Templates46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45, GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47, NoneT, NoneT, NoneT> { typedef Templates47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45, GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47, T48, NoneT, NoneT> { typedef Templates48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47, T48> type; }; template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45, GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48, GTEST_TEMPLATE_ T49> struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47, T48, T49, NoneT> { typedef Templates49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47, T48, T49> type; }; // The TypeList template makes it possible to use either a single type // or a Types<...> list in TYPED_TEST_CASE() and // INSTANTIATE_TYPED_TEST_CASE_P(). template <typename T> struct TypeList { typedef Types1<T> type; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42, typename T43, typename T44, typename T45, typename T46, typename T47, typename T48, typename T49, typename T50> struct TypeList<Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47, T48, T49, T50> > { typedef typename Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47, T48, T49, T50>::type type; }; #endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P } // namespace internal } // namespace testing #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ // Due to C++ preprocessor weirdness, we need double indirection to // concatenate two tokens when one of them is __LINE__. Writing // // foo ## __LINE__ // // will result in the token foo__LINE__, instead of foo followed by // the current line number. For more details, see // http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.6 #define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar) #define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo ## bar class ProtocolMessage; namespace proto2 { class Message; } namespace testing { // Forward declarations. class AssertionResult; // Result of an assertion. class Message; // Represents a failure message. class Test; // Represents a test. class TestInfo; // Information about a test. class TestPartResult; // Result of a test part. class UnitTest; // A collection of test cases. template <typename T> ::std::string PrintToString(const T& value); namespace internal { struct TraceInfo; // Information about a trace point. class ScopedTrace; // Implements scoped trace. class TestInfoImpl; // Opaque implementation of TestInfo class UnitTestImpl; // Opaque implementation of UnitTest // The text used in failure messages to indicate the start of the // stack trace. GTEST_API_ extern const char kStackTraceMarker[]; // Two overloaded helpers for checking at compile time whether an // expression is a null pointer literal (i.e. NULL or any 0-valued // compile-time integral constant). Their return values have // different sizes, so we can use sizeof() to test which version is // picked by the compiler. These helpers have no implementations, as // we only need their signatures. // // Given IsNullLiteralHelper(x), the compiler will pick the first // version if x can be implicitly converted to Secret*, and pick the // second version otherwise. Since Secret is a secret and incomplete // type, the only expression a user can write that has type Secret* is // a null pointer literal. Therefore, we know that x is a null // pointer literal if and only if the first version is picked by the // compiler. char IsNullLiteralHelper(Secret* p); char (&IsNullLiteralHelper(...))[2]; // NOLINT // A compile-time bool constant that is true if and only if x is a // null pointer literal (i.e. NULL or any 0-valued compile-time // integral constant). #ifdef GTEST_ELLIPSIS_NEEDS_POD_ // We lose support for NULL detection where the compiler doesn't like // passing non-POD classes through ellipsis (...). # define GTEST_IS_NULL_LITERAL_(x) false #else # define GTEST_IS_NULL_LITERAL_(x) \ (sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1) #endif // GTEST_ELLIPSIS_NEEDS_POD_ // Appends the user-supplied message to the Google-Test-generated message. GTEST_API_ std::string AppendUserMessage( const std::string& gtest_msg, const Message& user_msg); #if GTEST_HAS_EXCEPTIONS // This exception is thrown by (and only by) a failed Google Test // assertion when GTEST_FLAG(throw_on_failure) is true (if exceptions // are enabled). We derive it from std::runtime_error, which is for // errors presumably detectable only at run time. Since // std::runtime_error inherits from std::exception, many testing // frameworks know how to extract and print the message inside it. class GTEST_API_ GoogleTestFailureException : public ::std::runtime_error { public: explicit GoogleTestFailureException(const TestPartResult& failure); }; #endif // GTEST_HAS_EXCEPTIONS // A helper class for creating scoped traces in user programs. class GTEST_API_ ScopedTrace { public: // The c'tor pushes the given source file location and message onto // a trace stack maintained by Google Test. ScopedTrace(const char* file, int line, const Message& message); // The d'tor pops the info pushed by the c'tor. // // Note that the d'tor is not virtual in order to be efficient. // Don't inherit from ScopedTrace! ~ScopedTrace(); private: GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedTrace); } GTEST_ATTRIBUTE_UNUSED_; // A ScopedTrace object does its job in its // c'tor and d'tor. Therefore it doesn't // need to be used otherwise. namespace edit_distance { // Returns the optimal edits to go from 'left' to 'right'. // All edits cost the same, with replace having lower priority than // add/remove. // Simple implementation of the Wagner–Fischer algorithm. // See http://en.wikipedia.org/wiki/Wagner-Fischer_algorithm enum EditType { kMatch, kAdd, kRemove, kReplace }; GTEST_API_ std::vector<EditType> CalculateOptimalEdits( const std::vector<size_t>& left, const std::vector<size_t>& right); // Same as above, but the input is represented as strings. GTEST_API_ std::vector<EditType> CalculateOptimalEdits( const std::vector<std::string>& left, const std::vector<std::string>& right); // Create a diff of the input strings in Unified diff format. GTEST_API_ std::string CreateUnifiedDiff(const std::vector<std::string>& left, const std::vector<std::string>& right, size_t context = 2); } // namespace edit_distance // Calculate the diff between 'left' and 'right' and return it in unified diff // format. // If not null, stores in 'total_line_count' the total number of lines found // in left + right. GTEST_API_ std::string DiffStrings(const std::string& left, const std::string& right, size_t* total_line_count); // Constructs and returns the message for an equality assertion // (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure. // // The first four parameters are the expressions used in the assertion // and their values, as strings. For example, for ASSERT_EQ(foo, bar) // where foo is 5 and bar is 6, we have: // // expected_expression: "foo" // actual_expression: "bar" // expected_value: "5" // actual_value: "6" // // The ignoring_case parameter is true iff the assertion is a // *_STRCASEEQ*. When it's true, the string " (ignoring case)" will // be inserted into the message. GTEST_API_ AssertionResult EqFailure(const char* expected_expression, const char* actual_expression, const std::string& expected_value, const std::string& actual_value, bool ignoring_case); // Constructs a failure message for Boolean assertions such as EXPECT_TRUE. GTEST_API_ std::string GetBoolAssertionFailureMessage( const AssertionResult& assertion_result, const char* expression_text, const char* actual_predicate_value, const char* expected_predicate_value); // This template class represents an IEEE floating-point number // (either single-precision or double-precision, depending on the // template parameters). // // The purpose of this class is to do more sophisticated number // comparison. (Due to round-off error, etc, it's very unlikely that // two floating-points will be equal exactly. Hence a naive // comparison by the == operation often doesn't work.) // // Format of IEEE floating-point: // // The most-significant bit being the leftmost, an IEEE // floating-point looks like // // sign_bit exponent_bits fraction_bits // // Here, sign_bit is a single bit that designates the sign of the // number. // // For float, there are 8 exponent bits and 23 fraction bits. // // For double, there are 11 exponent bits and 52 fraction bits. // // More details can be found at // http://en.wikipedia.org/wiki/IEEE_floating-point_standard. // // Template parameter: // // RawType: the raw floating-point type (either float or double) template <typename RawType> class FloatingPoint { public: // Defines the unsigned integer type that has the same size as the // floating point number. typedef typename TypeWithSize<sizeof(RawType)>::UInt Bits; // Constants. // # of bits in a number. static const size_t kBitCount = 8*sizeof(RawType); // # of fraction bits in a number. static const size_t kFractionBitCount = std::numeric_limits<RawType>::digits - 1; // # of exponent bits in a number. static const size_t kExponentBitCount = kBitCount - 1 - kFractionBitCount; // The mask for the sign bit. static const Bits kSignBitMask = static_cast<Bits>(1) << (kBitCount - 1); // The mask for the fraction bits. static const Bits kFractionBitMask = ~static_cast<Bits>(0) >> (kExponentBitCount + 1); // The mask for the exponent bits. static const Bits kExponentBitMask = ~(kSignBitMask | kFractionBitMask); // How many ULP's (Units in the Last Place) we want to tolerate when // comparing two numbers. The larger the value, the more error we // allow. A 0 value means that two numbers must be exactly the same // to be considered equal. // // The maximum error of a single floating-point operation is 0.5 // units in the last place. On Intel CPU's, all floating-point // calculations are done with 80-bit precision, while double has 64 // bits. Therefore, 4 should be enough for ordinary use. // // See the following article for more details on ULP: // http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/ static const size_t kMaxUlps = 4; // Constructs a FloatingPoint from a raw floating-point number. // // On an Intel CPU, passing a non-normalized NAN (Not a Number) // around may change its bits, although the new value is guaranteed // to be also a NAN. Therefore, don't expect this constructor to // preserve the bits in x when x is a NAN. explicit FloatingPoint(const RawType& x) { u_.value_ = x; } // Static methods // Reinterprets a bit pattern as a floating-point number. // // This function is needed to test the AlmostEquals() method. static RawType ReinterpretBits(const Bits bits) { FloatingPoint fp(0); fp.u_.bits_ = bits; return fp.u_.value_; } // Returns the floating-point number that represent positive infinity. static RawType Infinity() { return ReinterpretBits(kExponentBitMask); } // Returns the maximum representable finite floating-point number. static RawType Max(); // Non-static methods // Returns the bits that represents this number. const Bits &bits() const { return u_.bits_; } // Returns the exponent bits of this number. Bits exponent_bits() const { return kExponentBitMask & u_.bits_; } // Returns the fraction bits of this number. Bits fraction_bits() const { return kFractionBitMask & u_.bits_; } // Returns the sign bit of this number. Bits sign_bit() const { return kSignBitMask & u_.bits_; } // Returns true iff this is NAN (not a number). bool is_nan() const { // It's a NAN if the exponent bits are all ones and the fraction // bits are not entirely zeros. return (exponent_bits() == kExponentBitMask) && (fraction_bits() != 0); } // Returns true iff this number is at most kMaxUlps ULP's away from // rhs. In particular, this function: // // - returns false if either number is (or both are) NAN. // - treats really large numbers as almost equal to infinity. // - thinks +0.0 and -0.0 are 0 DLP's apart. bool AlmostEquals(const FloatingPoint& rhs) const { // The IEEE standard says that any comparison operation involving // a NAN must return false. if (is_nan() || rhs.is_nan()) return false; return DistanceBetweenSignAndMagnitudeNumbers(u_.bits_, rhs.u_.bits_) <= kMaxUlps; } private: // The data type used to store the actual floating-point number. union FloatingPointUnion { RawType value_; // The raw floating-point number. Bits bits_; // The bits that represent the number. }; // Converts an integer from the sign-and-magnitude representation to // the biased representation. More precisely, let N be 2 to the // power of (kBitCount - 1), an integer x is represented by the // unsigned number x + N. // // For instance, // // -N + 1 (the most negative number representable using // sign-and-magnitude) is represented by 1; // 0 is represented by N; and // N - 1 (the biggest number representable using // sign-and-magnitude) is represented by 2N - 1. // // Read http://en.wikipedia.org/wiki/Signed_number_representations // for more details on signed number representations. static Bits SignAndMagnitudeToBiased(const Bits &sam) { if (kSignBitMask & sam) { // sam represents a negative number. return ~sam + 1; } else { // sam represents a positive number. return kSignBitMask | sam; } } // Given two numbers in the sign-and-magnitude representation, // returns the distance between them as an unsigned number. static Bits DistanceBetweenSignAndMagnitudeNumbers(const Bits &sam1, const Bits &sam2) { const Bits biased1 = SignAndMagnitudeToBiased(sam1); const Bits biased2 = SignAndMagnitudeToBiased(sam2); return (biased1 >= biased2) ? (biased1 - biased2) : (biased2 - biased1); } FloatingPointUnion u_; }; // We cannot use std::numeric_limits<T>::max() as it clashes with the max() // macro defined by <windows.h>. template <> inline float FloatingPoint<float>::Max() { return FLT_MAX; } template <> inline double FloatingPoint<double>::Max() { return DBL_MAX; } // Typedefs the instances of the FloatingPoint template class that we // care to use. typedef FloatingPoint<float> Float; typedef FloatingPoint<double> Double; // In order to catch the mistake of putting tests that use different // test fixture classes in the same test case, we need to assign // unique IDs to fixture classes and compare them. The TypeId type is // used to hold such IDs. The user should treat TypeId as an opaque // type: the only operation allowed on TypeId values is to compare // them for equality using the == operator. typedef const void* TypeId; template <typename T> class TypeIdHelper { public: // dummy_ must not have a const type. Otherwise an overly eager // compiler (e.g. MSVC 7.1 & 8.0) may try to merge // TypeIdHelper<T>::dummy_ for different Ts as an "optimization". static bool dummy_; }; template <typename T> bool TypeIdHelper<T>::dummy_ = false; // GetTypeId<T>() returns the ID of type T. Different values will be // returned for different types. Calling the function twice with the // same type argument is guaranteed to return the same ID. template <typename T> TypeId GetTypeId() { // The compiler is required to allocate a different // TypeIdHelper<T>::dummy_ variable for each T used to instantiate // the template. Therefore, the address of dummy_ is guaranteed to // be unique. return &(TypeIdHelper<T>::dummy_); } // Returns the type ID of ::testing::Test. Always call this instead // of GetTypeId< ::testing::Test>() to get the type ID of // ::testing::Test, as the latter may give the wrong result due to a // suspected linker bug when compiling Google Test as a Mac OS X // framework. GTEST_API_ TypeId GetTestTypeId(); // Defines the abstract factory interface that creates instances // of a Test object. class TestFactoryBase { public: virtual ~TestFactoryBase() {} // Creates a test instance to run. The instance is both created and destroyed // within TestInfoImpl::Run() virtual Test* CreateTest() = 0; protected: TestFactoryBase() {} private: GTEST_DISALLOW_COPY_AND_ASSIGN_(TestFactoryBase); }; // This class provides implementation of TeastFactoryBase interface. // It is used in TEST and TEST_F macros. template <class TestClass> class TestFactoryImpl : public TestFactoryBase { public: virtual Test* CreateTest() { return new TestClass; } }; #if GTEST_OS_WINDOWS // Predicate-formatters for implementing the HRESULT checking macros // {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED} // We pass a long instead of HRESULT to avoid causing an // include dependency for the HRESULT type. GTEST_API_ AssertionResult IsHRESULTSuccess(const char* expr, long hr); // NOLINT GTEST_API_ AssertionResult IsHRESULTFailure(const char* expr, long hr); // NOLINT #endif // GTEST_OS_WINDOWS // Types of SetUpTestCase() and TearDownTestCase() functions. typedef void (*SetUpTestCaseFunc)(); typedef void (*TearDownTestCaseFunc)(); struct CodeLocation { CodeLocation(const string& a_file, int a_line) : file(a_file), line(a_line) {} string file; int line; }; // Creates a new TestInfo object and registers it with Google Test; // returns the created object. // // Arguments: // // test_case_name: name of the test case // name: name of the test // type_param the name of the test's type parameter, or NULL if // this is not a typed or a type-parameterized test. // value_param text representation of the test's value parameter, // or NULL if this is not a type-parameterized test. // code_location: code location where the test is defined // fixture_class_id: ID of the test fixture class // set_up_tc: pointer to the function that sets up the test case // tear_down_tc: pointer to the function that tears down the test case // factory: pointer to the factory that creates a test object. // The newly created TestInfo instance will assume // ownership of the factory object. GTEST_API_ TestInfo* MakeAndRegisterTestInfo( const char* test_case_name, const char* name, const char* type_param, const char* value_param, CodeLocation code_location, TypeId fixture_class_id, SetUpTestCaseFunc set_up_tc, TearDownTestCaseFunc tear_down_tc, TestFactoryBase* factory); // If *pstr starts with the given prefix, modifies *pstr to be right // past the prefix and returns true; otherwise leaves *pstr unchanged // and returns false. None of pstr, *pstr, and prefix can be NULL. GTEST_API_ bool SkipPrefix(const char* prefix, const char** pstr); #if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P // State of the definition of a type-parameterized test case. class GTEST_API_ TypedTestCasePState { public: TypedTestCasePState() : registered_(false) {} // Adds the given test name to defined_test_names_ and return true // if the test case hasn't been registered; otherwise aborts the // program. bool AddTestName(const char* file, int line, const char* case_name, const char* test_name) { if (registered_) { fprintf(stderr, "%s Test %s must be defined before " "REGISTER_TYPED_TEST_CASE_P(%s, ...).\n", FormatFileLocation(file, line).c_str(), test_name, case_name); fflush(stderr); posix::Abort(); } registered_tests_.insert( ::std::make_pair(test_name, CodeLocation(file, line))); return true; } bool TestExists(const std::string& test_name) const { return registered_tests_.count(test_name) > 0; } const CodeLocation& GetCodeLocation(const std::string& test_name) const { RegisteredTestsMap::const_iterator it = registered_tests_.find(test_name); GTEST_CHECK_(it != registered_tests_.end()); return it->second; } // Verifies that registered_tests match the test names in // defined_test_names_; returns registered_tests if successful, or // aborts the program otherwise. const char* VerifyRegisteredTestNames( const char* file, int line, const char* registered_tests); private: typedef ::std::map<std::string, CodeLocation> RegisteredTestsMap; bool registered_; RegisteredTestsMap registered_tests_; }; // Skips to the first non-space char after the first comma in 'str'; // returns NULL if no comma is found in 'str'. inline const char* SkipComma(const char* str) { const char* comma = strchr(str, ','); if (comma == NULL) { return NULL; } while (IsSpace(*(++comma))) {} return comma; } // Returns the prefix of 'str' before the first comma in it; returns // the entire string if it contains no comma. inline std::string GetPrefixUntilComma(const char* str) { const char* comma = strchr(str, ','); return comma == NULL ? str : std::string(str, comma); } // Splits a given string on a given delimiter, populating a given // vector with the fields. void SplitString(const ::std::string& str, char delimiter, ::std::vector< ::std::string>* dest); // TypeParameterizedTest<Fixture, TestSel, Types>::Register() // registers a list of type-parameterized tests with Google Test. The // return value is insignificant - we just need to return something // such that we can call this function in a namespace scope. // // Implementation note: The GTEST_TEMPLATE_ macro declares a template // template parameter. It's defined in gtest-type-util.h. template <GTEST_TEMPLATE_ Fixture, class TestSel, typename Types> class TypeParameterizedTest { public: // 'index' is the index of the test in the type list 'Types' // specified in INSTANTIATE_TYPED_TEST_CASE_P(Prefix, TestCase, // Types). Valid values for 'index' are [0, N - 1] where N is the // length of Types. static bool Register(const char* prefix, CodeLocation code_location, const char* case_name, const char* test_names, int index) { typedef typename Types::Head Type; typedef Fixture<Type> FixtureClass; typedef typename GTEST_BIND_(TestSel, Type) TestClass; // First, registers the first type-parameterized test in the type // list. MakeAndRegisterTestInfo( (std::string(prefix) + (prefix[0] == '\0' ? "" : "/") + case_name + "/" + StreamableToString(index)).c_str(), StripTrailingSpaces(GetPrefixUntilComma(test_names)).c_str(), GetTypeName<Type>().c_str(), NULL, // No value parameter. code_location, GetTypeId<FixtureClass>(), TestClass::SetUpTestCase, TestClass::TearDownTestCase, new TestFactoryImpl<TestClass>); // Next, recurses (at compile time) with the tail of the type list. return TypeParameterizedTest<Fixture, TestSel, typename Types::Tail> ::Register(prefix, code_location, case_name, test_names, index + 1); } }; // The base case for the compile time recursion. template <GTEST_TEMPLATE_ Fixture, class TestSel> class TypeParameterizedTest<Fixture, TestSel, Types0> { public: static bool Register(const char* /*prefix*/, CodeLocation, const char* /*case_name*/, const char* /*test_names*/, int /*index*/) { return true; } }; // TypeParameterizedTestCase<Fixture, Tests, Types>::Register() // registers *all combinations* of 'Tests' and 'Types' with Google // Test. The return value is insignificant - we just need to return // something such that we can call this function in a namespace scope. template <GTEST_TEMPLATE_ Fixture, typename Tests, typename Types> class TypeParameterizedTestCase { public: static bool Register(const char* prefix, CodeLocation code_location, const TypedTestCasePState* state, const char* case_name, const char* test_names) { std::string test_name = StripTrailingSpaces( GetPrefixUntilComma(test_names)); if (!state->TestExists(test_name)) { fprintf(stderr, "Failed to get code location for test %s.%s at %s.", case_name, test_name.c_str(), FormatFileLocation(code_location.file.c_str(), code_location.line).c_str()); fflush(stderr); posix::Abort(); } const CodeLocation& test_location = state->GetCodeLocation(test_name); typedef typename Tests::Head Head; // First, register the first test in 'Test' for each type in 'Types'. TypeParameterizedTest<Fixture, Head, Types>::Register( prefix, test_location, case_name, test_names, 0); // Next, recurses (at compile time) with the tail of the test list. return TypeParameterizedTestCase<Fixture, typename Tests::Tail, Types> ::Register(prefix, code_location, state, case_name, SkipComma(test_names)); } }; // The base case for the compile time recursion. template <GTEST_TEMPLATE_ Fixture, typename Types> class TypeParameterizedTestCase<Fixture, Templates0, Types> { public: static bool Register(const char* /*prefix*/, CodeLocation, const TypedTestCasePState* /*state*/, const char* /*case_name*/, const char* /*test_names*/) { return true; } }; #endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P // Returns the current OS stack trace as an std::string. // // The maximum number of stack frames to be included is specified by // the gtest_stack_trace_depth flag. The skip_count parameter // specifies the number of top frames to be skipped, which doesn't // count against the number of frames to be included. // // For example, if Foo() calls Bar(), which in turn calls // GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in // the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't. GTEST_API_ std::string GetCurrentOsStackTraceExceptTop( UnitTest* unit_test, int skip_count); // Helpers for suppressing warnings on unreachable code or constant // condition. // Always returns true. GTEST_API_ bool AlwaysTrue(); // Always returns false. inline bool AlwaysFalse() { return !AlwaysTrue(); } // Helper for suppressing false warning from Clang on a const char* // variable declared in a conditional expression always being NULL in // the else branch. struct GTEST_API_ ConstCharPtr { ConstCharPtr(const char* str) : value(str) {} operator bool() const { return true; } const char* value; }; // A simple Linear Congruential Generator for generating random // numbers with a uniform distribution. Unlike rand() and srand(), it // doesn't use global state (and therefore can't interfere with user // code). Unlike rand_r(), it's portable. An LCG isn't very random, // but it's good enough for our purposes. class GTEST_API_ Random { public: static const UInt32 kMaxRange = 1u << 31; explicit Random(UInt32 seed) : state_(seed) {} void Reseed(UInt32 seed) { state_ = seed; } // Generates a random number from [0, range). Crashes if 'range' is // 0 or greater than kMaxRange. UInt32 Generate(UInt32 range); private: UInt32 state_; GTEST_DISALLOW_COPY_AND_ASSIGN_(Random); }; // Defining a variable of type CompileAssertTypesEqual<T1, T2> will cause a // compiler error iff T1 and T2 are different types. template <typename T1, typename T2> struct CompileAssertTypesEqual; template <typename T> struct CompileAssertTypesEqual<T, T> { }; // Removes the reference from a type if it is a reference type, // otherwise leaves it unchanged. This is the same as // tr1::remove_reference, which is not widely available yet. template <typename T> struct RemoveReference { typedef T type; }; // NOLINT template <typename T> struct RemoveReference<T&> { typedef T type; }; // NOLINT // A handy wrapper around RemoveReference that works when the argument // T depends on template parameters. #define GTEST_REMOVE_REFERENCE_(T) \ typename ::testing::internal::RemoveReference<T>::type // Removes const from a type if it is a const type, otherwise leaves // it unchanged. This is the same as tr1::remove_const, which is not // widely available yet. template <typename T> struct RemoveConst { typedef T type; }; // NOLINT template <typename T> struct RemoveConst<const T> { typedef T type; }; // NOLINT // MSVC 8.0, Sun C++, and IBM XL C++ have a bug which causes the above // definition to fail to remove the const in 'const int[3]' and 'const // char[3][4]'. The following specialization works around the bug. template <typename T, size_t N> struct RemoveConst<const T[N]> { typedef typename RemoveConst<T>::type type[N]; }; #if defined(_MSC_VER) && _MSC_VER < 1400 // This is the only specialization that allows VC++ 7.1 to remove const in // 'const int[3] and 'const int[3][4]'. However, it causes trouble with GCC // and thus needs to be conditionally compiled. template <typename T, size_t N> struct RemoveConst<T[N]> { typedef typename RemoveConst<T>::type type[N]; }; #endif // A handy wrapper around RemoveConst that works when the argument // T depends on template parameters. #define GTEST_REMOVE_CONST_(T) \ typename ::testing::internal::RemoveConst<T>::type // Turns const U&, U&, const U, and U all into U. #define GTEST_REMOVE_REFERENCE_AND_CONST_(T) \ GTEST_REMOVE_CONST_(GTEST_REMOVE_REFERENCE_(T)) // Adds reference to a type if it is not a reference type, // otherwise leaves it unchanged. This is the same as // tr1::add_reference, which is not widely available yet. template <typename T> struct AddReference { typedef T& type; }; // NOLINT template <typename T> struct AddReference<T&> { typedef T& type; }; // NOLINT // A handy wrapper around AddReference that works when the argument T // depends on template parameters. #define GTEST_ADD_REFERENCE_(T) \ typename ::testing::internal::AddReference<T>::type // Adds a reference to const on top of T as necessary. For example, // it transforms // // char ==> const char& // const char ==> const char& // char& ==> const char& // const char& ==> const char& // // The argument T must depend on some template parameters. #define GTEST_REFERENCE_TO_CONST_(T) \ GTEST_ADD_REFERENCE_(const GTEST_REMOVE_REFERENCE_(T)) // ImplicitlyConvertible<From, To>::value is a compile-time bool // constant that's true iff type From can be implicitly converted to // type To. template <typename From, typename To> class ImplicitlyConvertible { private: // We need the following helper functions only for their types. // They have no implementations. // MakeFrom() is an expression whose type is From. We cannot simply // use From(), as the type From may not have a public default // constructor. static typename AddReference<From>::type MakeFrom(); // These two functions are overloaded. Given an expression // Helper(x), the compiler will pick the first version if x can be // implicitly converted to type To; otherwise it will pick the // second version. // // The first version returns a value of size 1, and the second // version returns a value of size 2. Therefore, by checking the // size of Helper(x), which can be done at compile time, we can tell // which version of Helper() is used, and hence whether x can be // implicitly converted to type To. static char Helper(To); static char (&Helper(...))[2]; // NOLINT // We have to put the 'public' section after the 'private' section, // or MSVC refuses to compile the code. public: #if defined(__BORLANDC__) // C++Builder cannot use member overload resolution during template // instantiation. The simplest workaround is to use its C++0x type traits // functions (C++Builder 2009 and above only). static const bool value = __is_convertible(From, To); #else // MSVC warns about implicitly converting from double to int for // possible loss of data, so we need to temporarily disable the // warning. GTEST_DISABLE_MSC_WARNINGS_PUSH_(4244) static const bool value = sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1; GTEST_DISABLE_MSC_WARNINGS_POP_() #endif // __BORLANDC__ }; template <typename From, typename To> const bool ImplicitlyConvertible<From, To>::value; // IsAProtocolMessage<T>::value is a compile-time bool constant that's // true iff T is type ProtocolMessage, proto2::Message, or a subclass // of those. template <typename T> struct IsAProtocolMessage : public bool_constant< ImplicitlyConvertible<const T*, const ::ProtocolMessage*>::value || ImplicitlyConvertible<const T*, const ::proto2::Message*>::value> { }; // When the compiler sees expression IsContainerTest<C>(0), if C is an // STL-style container class, the first overload of IsContainerTest // will be viable (since both C::iterator* and C::const_iterator* are // valid types and NULL can be implicitly converted to them). It will // be picked over the second overload as 'int' is a perfect match for // the type of argument 0. If C::iterator or C::const_iterator is not // a valid type, the first overload is not viable, and the second // overload will be picked. Therefore, we can determine whether C is // a container class by checking the type of IsContainerTest<C>(0). // The value of the expression is insignificant. // // Note that we look for both C::iterator and C::const_iterator. The // reason is that C++ injects the name of a class as a member of the // class itself (e.g. you can refer to class iterator as either // 'iterator' or 'iterator::iterator'). If we look for C::iterator // only, for example, we would mistakenly think that a class named // iterator is an STL container. // // Also note that the simpler approach of overloading // IsContainerTest(typename C::const_iterator*) and // IsContainerTest(...) doesn't work with Visual Age C++ and Sun C++. typedef int IsContainer; template <class C> IsContainer IsContainerTest(int /* dummy */, typename C::iterator* /* it */ = NULL, typename C::const_iterator* /* const_it */ = NULL) { return 0; } typedef char IsNotContainer; template <class C> IsNotContainer IsContainerTest(long /* dummy */) { return '\0'; } // EnableIf<condition>::type is void when 'Cond' is true, and // undefined when 'Cond' is false. To use SFINAE to make a function // overload only apply when a particular expression is true, add // "typename EnableIf<expression>::type* = 0" as the last parameter. template<bool> struct EnableIf; template<> struct EnableIf<true> { typedef void type; }; // NOLINT // Utilities for native arrays. // ArrayEq() compares two k-dimensional native arrays using the // elements' operator==, where k can be any integer >= 0. When k is // 0, ArrayEq() degenerates into comparing a single pair of values. template <typename T, typename U> bool ArrayEq(const T* lhs, size_t size, const U* rhs); // This generic version is used when k is 0. template <typename T, typename U> inline bool ArrayEq(const T& lhs, const U& rhs) { return lhs == rhs; } // This overload is used when k >= 1. template <typename T, typename U, size_t N> inline bool ArrayEq(const T(&lhs)[N], const U(&rhs)[N]) { return internal::ArrayEq(lhs, N, rhs); } // This helper reduces code bloat. If we instead put its logic inside // the previous ArrayEq() function, arrays with different sizes would // lead to different copies of the template code. template <typename T, typename U> bool ArrayEq(const T* lhs, size_t size, const U* rhs) { for (size_t i = 0; i != size; i++) { if (!internal::ArrayEq(lhs[i], rhs[i])) return false; } return true; } // Finds the first element in the iterator range [begin, end) that // equals elem. Element may be a native array type itself. template <typename Iter, typename Element> Iter ArrayAwareFind(Iter begin, Iter end, const Element& elem) { for (Iter it = begin; it != end; ++it) { if (internal::ArrayEq(*it, elem)) return it; } return end; } // CopyArray() copies a k-dimensional native array using the elements' // operator=, where k can be any integer >= 0. When k is 0, // CopyArray() degenerates into copying a single value. template <typename T, typename U> void CopyArray(const T* from, size_t size, U* to); // This generic version is used when k is 0. template <typename T, typename U> inline void CopyArray(const T& from, U* to) { *to = from; } // This overload is used when k >= 1. template <typename T, typename U, size_t N> inline void CopyArray(const T(&from)[N], U(*to)[N]) { internal::CopyArray(from, N, *to); } // This helper reduces code bloat. If we instead put its logic inside // the previous CopyArray() function, arrays with different sizes // would lead to different copies of the template code. template <typename T, typename U> void CopyArray(const T* from, size_t size, U* to) { for (size_t i = 0; i != size; i++) { internal::CopyArray(from[i], to + i); } } // The relation between an NativeArray object (see below) and the // native array it represents. // We use 2 different structs to allow non-copyable types to be used, as long // as RelationToSourceReference() is passed. struct RelationToSourceReference {}; struct RelationToSourceCopy {}; // Adapts a native array to a read-only STL-style container. Instead // of the complete STL container concept, this adaptor only implements // members useful for Google Mock's container matchers. New members // should be added as needed. To simplify the implementation, we only // support Element being a raw type (i.e. having no top-level const or // reference modifier). It's the client's responsibility to satisfy // this requirement. Element can be an array type itself (hence // multi-dimensional arrays are supported). template <typename Element> class NativeArray { public: // STL-style container typedefs. typedef Element value_type; typedef Element* iterator; typedef const Element* const_iterator; // Constructs from a native array. References the source. NativeArray(const Element* array, size_t count, RelationToSourceReference) { InitRef(array, count); } // Constructs from a native array. Copies the source. NativeArray(const Element* array, size_t count, RelationToSourceCopy) { InitCopy(array, count); } // Copy constructor. NativeArray(const NativeArray& rhs) { (this->*rhs.clone_)(rhs.array_, rhs.size_); } ~NativeArray() { if (clone_ != &NativeArray::InitRef) delete[] array_; } // STL-style container methods. size_t size() const { return size_; } const_iterator begin() const { return array_; } const_iterator end() const { return array_ + size_; } bool operator==(const NativeArray& rhs) const { return size() == rhs.size() && ArrayEq(begin(), size(), rhs.begin()); } private: enum { kCheckTypeIsNotConstOrAReference = StaticAssertTypeEqHelper< Element, GTEST_REMOVE_REFERENCE_AND_CONST_(Element)>::value, }; // Initializes this object with a copy of the input. void InitCopy(const Element* array, size_t a_size) { Element* const copy = new Element[a_size]; CopyArray(array, a_size, copy); array_ = copy; size_ = a_size; clone_ = &NativeArray::InitCopy; } // Initializes this object with a reference of the input. void InitRef(const Element* array, size_t a_size) { array_ = array; size_ = a_size; clone_ = &NativeArray::InitRef; } const Element* array_; size_t size_; void (NativeArray::*clone_)(const Element*, size_t); GTEST_DISALLOW_ASSIGN_(NativeArray); }; } // namespace internal } // namespace testing #define GTEST_MESSAGE_AT_(file, line, message, result_type) \ ::testing::internal::AssertHelper(result_type, file, line, message) \ = ::testing::Message() #define GTEST_MESSAGE_(message, result_type) \ GTEST_MESSAGE_AT_(__FILE__, __LINE__, message, result_type) #define GTEST_FATAL_FAILURE_(message) \ return GTEST_MESSAGE_(message, ::testing::TestPartResult::kFatalFailure) #define GTEST_NONFATAL_FAILURE_(message) \ GTEST_MESSAGE_(message, ::testing::TestPartResult::kNonFatalFailure) #define GTEST_SUCCESS_(message) \ GTEST_MESSAGE_(message, ::testing::TestPartResult::kSuccess) // Suppresses MSVC warnings 4072 (unreachable code) for the code following // statement if it returns or throws (or doesn't return or throw in some // situations). #define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) \ if (::testing::internal::AlwaysTrue()) { statement; } #define GTEST_TEST_THROW_(statement, expected_exception, fail) \ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ if (::testing::internal::ConstCharPtr gtest_msg = "") { \ bool gtest_caught_expected = false; \ try { \ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ } \ catch (expected_exception const&) { \ gtest_caught_expected = true; \ } \ catch (...) { \ gtest_msg.value = \ "Expected: " #statement " throws an exception of type " \ #expected_exception ".\n Actual: it throws a different type."; \ goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \ } \ if (!gtest_caught_expected) { \ gtest_msg.value = \ "Expected: " #statement " throws an exception of type " \ #expected_exception ".\n Actual: it throws nothing."; \ goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \ } \ } else \ GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__): \ fail(gtest_msg.value) #define GTEST_TEST_NO_THROW_(statement, fail) \ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ if (::testing::internal::AlwaysTrue()) { \ try { \ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ } \ catch (...) { \ goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \ } \ } else \ GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__): \ fail("Expected: " #statement " doesn't throw an exception.\n" \ " Actual: it throws.") #define GTEST_TEST_ANY_THROW_(statement, fail) \ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ if (::testing::internal::AlwaysTrue()) { \ bool gtest_caught_any = false; \ try { \ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ } \ catch (...) { \ gtest_caught_any = true; \ } \ if (!gtest_caught_any) { \ goto GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__); \ } \ } else \ GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__): \ fail("Expected: " #statement " throws an exception.\n" \ " Actual: it doesn't.") // Implements Boolean test assertions such as EXPECT_TRUE. expression can be // either a boolean expression or an AssertionResult. text is a textual // represenation of expression as it was passed into the EXPECT_TRUE. #define GTEST_TEST_BOOLEAN_(expression, text, actual, expected, fail) \ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ if (const ::testing::AssertionResult gtest_ar_ = \ ::testing::AssertionResult(expression)) \ ; \ else \ fail(::testing::internal::GetBoolAssertionFailureMessage(\ gtest_ar_, text, #actual, #expected).c_str()) #define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ if (::testing::internal::AlwaysTrue()) { \ ::testing::internal::HasNewFatalFailureHelper gtest_fatal_failure_checker; \ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \ goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \ } \ } else \ GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__): \ fail("Expected: " #statement " doesn't generate new fatal " \ "failures in the current thread.\n" \ " Actual: it does.") // Expands to the name of the class that implements the given test. #define GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \ test_case_name##_##test_name##_Test // Helper macro for defining tests. #define GTEST_TEST_(test_case_name, test_name, parent_class, parent_id)\ class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\ public:\ GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\ private:\ virtual void TestBody();\ static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_;\ GTEST_DISALLOW_COPY_AND_ASSIGN_(\ GTEST_TEST_CLASS_NAME_(test_case_name, test_name));\ };\ \ ::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_case_name, test_name)\ ::test_info_ =\ ::testing::internal::MakeAndRegisterTestInfo(\ #test_case_name, #test_name, NULL, NULL, \ ::testing::internal::CodeLocation(__FILE__, __LINE__), \ (parent_id), \ parent_class::SetUpTestCase, \ parent_class::TearDownTestCase, \ new ::testing::internal::TestFactoryImpl<\ GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\ void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody() #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_ // Copyright 2005, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Author: [email protected] (Zhanyong Wan) // // The Google C++ Testing Framework (Google Test) // // This header file defines the public API for death tests. It is // #included by gtest.h so a user doesn't need to include this // directly. #ifndef GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_ #define GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_ // Copyright 2005, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Authors: [email protected] (Zhanyong Wan), [email protected] (Sean Mcafee) // // The Google C++ Testing Framework (Google Test) // // This header file defines internal utilities needed for implementing // death tests. They are subject to change without notice. #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_ #include <stdio.h> namespace testing { namespace internal { GTEST_DECLARE_string_(internal_run_death_test); // Names of the flags (needed for parsing Google Test flags). const char kDeathTestStyleFlag[] = "death_test_style"; const char kDeathTestUseFork[] = "death_test_use_fork"; const char kInternalRunDeathTestFlag[] = "internal_run_death_test"; #if GTEST_HAS_DEATH_TEST // DeathTest is a class that hides much of the complexity of the // GTEST_DEATH_TEST_ macro. It is abstract; its static Create method // returns a concrete class that depends on the prevailing death test // style, as defined by the --gtest_death_test_style and/or // --gtest_internal_run_death_test flags. // In describing the results of death tests, these terms are used with // the corresponding definitions: // // exit status: The integer exit information in the format specified // by wait(2) // exit code: The integer code passed to exit(3), _exit(2), or // returned from main() class GTEST_API_ DeathTest { public: // Create returns false if there was an error determining the // appropriate action to take for the current death test; for example, // if the gtest_death_test_style flag is set to an invalid value. // The LastMessage method will return a more detailed message in that // case. Otherwise, the DeathTest pointer pointed to by the "test" // argument is set. If the death test should be skipped, the pointer // is set to NULL; otherwise, it is set to the address of a new concrete // DeathTest object that controls the execution of the current test. static bool Create(const char* statement, const RE* regex, const char* file, int line, DeathTest** test); DeathTest(); virtual ~DeathTest() { } // A helper class that aborts a death test when it's deleted. class ReturnSentinel { public: explicit ReturnSentinel(DeathTest* test) : test_(test) { } ~ReturnSentinel() { test_->Abort(TEST_ENCOUNTERED_RETURN_STATEMENT); } private: DeathTest* const test_; GTEST_DISALLOW_COPY_AND_ASSIGN_(ReturnSentinel); } GTEST_ATTRIBUTE_UNUSED_; // An enumeration of possible roles that may be taken when a death // test is encountered. EXECUTE means that the death test logic should // be executed immediately. OVERSEE means that the program should prepare // the appropriate environment for a child process to execute the death // test, then wait for it to complete. enum TestRole { OVERSEE_TEST, EXECUTE_TEST }; // An enumeration of the three reasons that a test might be aborted. enum AbortReason { TEST_ENCOUNTERED_RETURN_STATEMENT, TEST_THREW_EXCEPTION, TEST_DID_NOT_DIE }; // Assumes one of the above roles. virtual TestRole AssumeRole() = 0; // Waits for the death test to finish and returns its status. virtual int Wait() = 0; // Returns true if the death test passed; that is, the test process // exited during the test, its exit status matches a user-supplied // predicate, and its stderr output matches a user-supplied regular // expression. // The user-supplied predicate may be a macro expression rather // than a function pointer or functor, or else Wait and Passed could // be combined. virtual bool Passed(bool exit_status_ok) = 0; // Signals that the death test did not die as expected. virtual void Abort(AbortReason reason) = 0; // Returns a human-readable outcome message regarding the outcome of // the last death test. static const char* LastMessage(); static void set_last_death_test_message(const std::string& message); private: // A string containing a description of the outcome of the last death test. static std::string last_death_test_message_; GTEST_DISALLOW_COPY_AND_ASSIGN_(DeathTest); }; // Factory interface for death tests. May be mocked out for testing. class DeathTestFactory { public: virtual ~DeathTestFactory() { } virtual bool Create(const char* statement, const RE* regex, const char* file, int line, DeathTest** test) = 0; }; // A concrete DeathTestFactory implementation for normal use. class DefaultDeathTestFactory : public DeathTestFactory { public: virtual bool Create(const char* statement, const RE* regex, const char* file, int line, DeathTest** test); }; // Returns true if exit_status describes a process that was terminated // by a signal, or exited normally with a nonzero exit code. GTEST_API_ bool ExitedUnsuccessfully(int exit_status); // Traps C++ exceptions escaping statement and reports them as test // failures. Note that trapping SEH exceptions is not implemented here. # if GTEST_HAS_EXCEPTIONS # define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \ try { \ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ } catch (const ::std::exception& gtest_exception) { \ fprintf(\ stderr, \ "\n%s: Caught std::exception-derived exception escaping the " \ "death test statement. Exception message: %s\n", \ ::testing::internal::FormatFileLocation(__FILE__, __LINE__).c_str(), \ gtest_exception.what()); \ fflush(stderr); \ death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \ } catch (...) { \ death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \ } # else # define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) # endif // This macro is for implementing ASSERT_DEATH*, EXPECT_DEATH*, // ASSERT_EXIT*, and EXPECT_EXIT*. # define GTEST_DEATH_TEST_(statement, predicate, regex, fail) \ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ if (::testing::internal::AlwaysTrue()) { \ const ::testing::internal::RE& gtest_regex = (regex); \ ::testing::internal::DeathTest* gtest_dt; \ if (!::testing::internal::DeathTest::Create(#statement, &gtest_regex, \ __FILE__, __LINE__, &gtest_dt)) { \ goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \ } \ if (gtest_dt != NULL) { \ ::testing::internal::scoped_ptr< ::testing::internal::DeathTest> \ gtest_dt_ptr(gtest_dt); \ switch (gtest_dt->AssumeRole()) { \ case ::testing::internal::DeathTest::OVERSEE_TEST: \ if (!gtest_dt->Passed(predicate(gtest_dt->Wait()))) { \ goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \ } \ break; \ case ::testing::internal::DeathTest::EXECUTE_TEST: { \ ::testing::internal::DeathTest::ReturnSentinel \ gtest_sentinel(gtest_dt); \ GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, gtest_dt); \ gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE); \ break; \ } \ default: \ break; \ } \ } \ } else \ GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__): \ fail(::testing::internal::DeathTest::LastMessage()) // The symbol "fail" here expands to something into which a message // can be streamed. // This macro is for implementing ASSERT/EXPECT_DEBUG_DEATH when compiled in // NDEBUG mode. In this case we need the statements to be executed, the regex is // ignored, and the macro must accept a streamed message even though the message // is never printed. # define GTEST_EXECUTE_STATEMENT_(statement, regex) \ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ if (::testing::internal::AlwaysTrue()) { \ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ } else \ ::testing::Message() // A class representing the parsed contents of the // --gtest_internal_run_death_test flag, as it existed when // RUN_ALL_TESTS was called. class InternalRunDeathTestFlag { public: InternalRunDeathTestFlag(const std::string& a_file, int a_line, int an_index, int a_write_fd) : file_(a_file), line_(a_line), index_(an_index), write_fd_(a_write_fd) {} ~InternalRunDeathTestFlag() { if (write_fd_ >= 0) posix::Close(write_fd_); } const std::string& file() const { return file_; } int line() const { return line_; } int index() const { return index_; } int write_fd() const { return write_fd_; } private: std::string file_; int line_; int index_; int write_fd_; GTEST_DISALLOW_COPY_AND_ASSIGN_(InternalRunDeathTestFlag); }; // Returns a newly created InternalRunDeathTestFlag object with fields // initialized from the GTEST_FLAG(internal_run_death_test) flag if // the flag is specified; otherwise returns NULL. InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag(); #else // GTEST_HAS_DEATH_TEST // This macro is used for implementing macros such as // EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED on systems where // death tests are not supported. Those macros must compile on such systems // iff EXPECT_DEATH and ASSERT_DEATH compile with the same parameters on // systems that support death tests. This allows one to write such a macro // on a system that does not support death tests and be sure that it will // compile on a death-test supporting system. // // Parameters: // statement - A statement that a macro such as EXPECT_DEATH would test // for program termination. This macro has to make sure this // statement is compiled but not executed, to ensure that // EXPECT_DEATH_IF_SUPPORTED compiles with a certain // parameter iff EXPECT_DEATH compiles with it. // regex - A regex that a macro such as EXPECT_DEATH would use to test // the output of statement. This parameter has to be // compiled but not evaluated by this macro, to ensure that // this macro only accepts expressions that a macro such as // EXPECT_DEATH would accept. // terminator - Must be an empty statement for EXPECT_DEATH_IF_SUPPORTED // and a return statement for ASSERT_DEATH_IF_SUPPORTED. // This ensures that ASSERT_DEATH_IF_SUPPORTED will not // compile inside functions where ASSERT_DEATH doesn't // compile. // // The branch that has an always false condition is used to ensure that // statement and regex are compiled (and thus syntactically correct) but // never executed. The unreachable code macro protects the terminator // statement from generating an 'unreachable code' warning in case // statement unconditionally returns or throws. The Message constructor at // the end allows the syntax of streaming additional messages into the // macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH. # define GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, terminator) \ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ if (::testing::internal::AlwaysTrue()) { \ GTEST_LOG_(WARNING) \ << "Death tests are not supported on this platform.\n" \ << "Statement '" #statement "' cannot be verified."; \ } else if (::testing::internal::AlwaysFalse()) { \ ::testing::internal::RE::PartialMatch(".*", (regex)); \ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ terminator; \ } else \ ::testing::Message() #endif // GTEST_HAS_DEATH_TEST } // namespace internal } // namespace testing #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_ namespace testing { // This flag controls the style of death tests. Valid values are "threadsafe", // meaning that the death test child process will re-execute the test binary // from the start, running only a single death test, or "fast", // meaning that the child process will execute the test logic immediately // after forking. GTEST_DECLARE_string_(death_test_style); #if GTEST_HAS_DEATH_TEST namespace internal { // Returns a Boolean value indicating whether the caller is currently // executing in the context of the death test child process. Tools such as // Valgrind heap checkers may need this to modify their behavior in death // tests. IMPORTANT: This is an internal utility. Using it may break the // implementation of death tests. User code MUST NOT use it. GTEST_API_ bool InDeathTestChild(); } // namespace internal // The following macros are useful for writing death tests. // Here's what happens when an ASSERT_DEATH* or EXPECT_DEATH* is // executed: // // 1. It generates a warning if there is more than one active // thread. This is because it's safe to fork() or clone() only // when there is a single thread. // // 2. The parent process clone()s a sub-process and runs the death // test in it; the sub-process exits with code 0 at the end of the // death test, if it hasn't exited already. // // 3. The parent process waits for the sub-process to terminate. // // 4. The parent process checks the exit code and error message of // the sub-process. // // Examples: // // ASSERT_DEATH(server.SendMessage(56, "Hello"), "Invalid port number"); // for (int i = 0; i < 5; i++) { // EXPECT_DEATH(server.ProcessRequest(i), // "Invalid request .* in ProcessRequest()") // << "Failed to die on request " << i; // } // // ASSERT_EXIT(server.ExitNow(), ::testing::ExitedWithCode(0), "Exiting"); // // bool KilledBySIGHUP(int exit_code) { // return WIFSIGNALED(exit_code) && WTERMSIG(exit_code) == SIGHUP; // } // // ASSERT_EXIT(client.HangUpServer(), KilledBySIGHUP, "Hanging up!"); // // On the regular expressions used in death tests: // // On POSIX-compliant systems (*nix), we use the <regex.h> library, // which uses the POSIX extended regex syntax. // // On other platforms (e.g. Windows), we only support a simple regex // syntax implemented as part of Google Test. This limited // implementation should be enough most of the time when writing // death tests; though it lacks many features you can find in PCRE // or POSIX extended regex syntax. For example, we don't support // union ("x|y"), grouping ("(xy)"), brackets ("[xy]"), and // repetition count ("x{5,7}"), among others. // // Below is the syntax that we do support. We chose it to be a // subset of both PCRE and POSIX extended regex, so it's easy to // learn wherever you come from. In the following: 'A' denotes a // literal character, period (.), or a single \\ escape sequence; // 'x' and 'y' denote regular expressions; 'm' and 'n' are for // natural numbers. // // c matches any literal character c // \\d matches any decimal digit // \\D matches any character that's not a decimal digit // \\f matches \f // \\n matches \n // \\r matches \r // \\s matches any ASCII whitespace, including \n // \\S matches any character that's not a whitespace // \\t matches \t // \\v matches \v // \\w matches any letter, _, or decimal digit // \\W matches any character that \\w doesn't match // \\c matches any literal character c, which must be a punctuation // . matches any single character except \n // A? matches 0 or 1 occurrences of A // A* matches 0 or many occurrences of A // A+ matches 1 or many occurrences of A // ^ matches the beginning of a string (not that of each line) // $ matches the end of a string (not that of each line) // xy matches x followed by y // // If you accidentally use PCRE or POSIX extended regex features // not implemented by us, you will get a run-time failure. In that // case, please try to rewrite your regular expression within the // above syntax. // // This implementation is *not* meant to be as highly tuned or robust // as a compiled regex library, but should perform well enough for a // death test, which already incurs significant overhead by launching // a child process. // // Known caveats: // // A "threadsafe" style death test obtains the path to the test // program from argv[0] and re-executes it in the sub-process. For // simplicity, the current implementation doesn't search the PATH // when launching the sub-process. This means that the user must // invoke the test program via a path that contains at least one // path separator (e.g. path/to/foo_test and // /absolute/path/to/bar_test are fine, but foo_test is not). This // is rarely a problem as people usually don't put the test binary // directory in PATH. // // TODO([email protected]): make thread-safe death tests search the PATH. // Asserts that a given statement causes the program to exit, with an // integer exit status that satisfies predicate, and emitting error output // that matches regex. # define ASSERT_EXIT(statement, predicate, regex) \ GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_FATAL_FAILURE_) // Like ASSERT_EXIT, but continues on to successive tests in the // test case, if any: # define EXPECT_EXIT(statement, predicate, regex) \ GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_NONFATAL_FAILURE_) // Asserts that a given statement causes the program to exit, either by // explicitly exiting with a nonzero exit code or being killed by a // signal, and emitting error output that matches regex. # define ASSERT_DEATH(statement, regex) \ ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex) // Like ASSERT_DEATH, but continues on to successive tests in the // test case, if any: # define EXPECT_DEATH(statement, regex) \ EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex) // Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*: // Tests that an exit code describes a normal exit with a given exit code. class GTEST_API_ ExitedWithCode { public: explicit ExitedWithCode(int exit_code); bool operator()(int exit_status) const; private: // No implementation - assignment is unsupported. void operator=(const ExitedWithCode& other); const int exit_code_; }; # if !GTEST_OS_WINDOWS // Tests that an exit code describes an exit due to termination by a // given signal. class GTEST_API_ KilledBySignal { public: explicit KilledBySignal(int signum); bool operator()(int exit_status) const; private: const int signum_; }; # endif // !GTEST_OS_WINDOWS // EXPECT_DEBUG_DEATH asserts that the given statements die in debug mode. // The death testing framework causes this to have interesting semantics, // since the sideeffects of the call are only visible in opt mode, and not // in debug mode. // // In practice, this can be used to test functions that utilize the // LOG(DFATAL) macro using the following style: // // int DieInDebugOr12(int* sideeffect) { // if (sideeffect) { // *sideeffect = 12; // } // LOG(DFATAL) << "death"; // return 12; // } // // TEST(TestCase, TestDieOr12WorksInDgbAndOpt) { // int sideeffect = 0; // // Only asserts in dbg. // EXPECT_DEBUG_DEATH(DieInDebugOr12(&sideeffect), "death"); // // #ifdef NDEBUG // // opt-mode has sideeffect visible. // EXPECT_EQ(12, sideeffect); // #else // // dbg-mode no visible sideeffect. // EXPECT_EQ(0, sideeffect); // #endif // } // // This will assert that DieInDebugReturn12InOpt() crashes in debug // mode, usually due to a DCHECK or LOG(DFATAL), but returns the // appropriate fallback value (12 in this case) in opt mode. If you // need to test that a function has appropriate side-effects in opt // mode, include assertions against the side-effects. A general // pattern for this is: // // EXPECT_DEBUG_DEATH({ // // Side-effects here will have an effect after this statement in // // opt mode, but none in debug mode. // EXPECT_EQ(12, DieInDebugOr12(&sideeffect)); // }, "death"); // # ifdef NDEBUG # define EXPECT_DEBUG_DEATH(statement, regex) \ GTEST_EXECUTE_STATEMENT_(statement, regex) # define ASSERT_DEBUG_DEATH(statement, regex) \ GTEST_EXECUTE_STATEMENT_(statement, regex) # else # define EXPECT_DEBUG_DEATH(statement, regex) \ EXPECT_DEATH(statement, regex) # define ASSERT_DEBUG_DEATH(statement, regex) \ ASSERT_DEATH(statement, regex) # endif // NDEBUG for EXPECT_DEBUG_DEATH #endif // GTEST_HAS_DEATH_TEST // EXPECT_DEATH_IF_SUPPORTED(statement, regex) and // ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if // death tests are supported; otherwise they just issue a warning. This is // useful when you are combining death test assertions with normal test // assertions in one test. #if GTEST_HAS_DEATH_TEST # define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \ EXPECT_DEATH(statement, regex) # define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \ ASSERT_DEATH(statement, regex) #else # define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \ GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, ) # define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \ GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, return) #endif } // namespace testing #endif // GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_ // This file was GENERATED by command: // pump.py gtest-param-test.h.pump // DO NOT EDIT BY HAND!!! // Copyright 2008, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Authors: [email protected] (Vlad Losev) // // Macros and functions for implementing parameterized tests // in Google C++ Testing Framework (Google Test) // // This file is generated by a SCRIPT. DO NOT EDIT BY HAND! // #ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ #define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ // Value-parameterized tests allow you to test your code with different // parameters without writing multiple copies of the same test. // // Here is how you use value-parameterized tests: #if 0 // To write value-parameterized tests, first you should define a fixture // class. It is usually derived from testing::TestWithParam<T> (see below for // another inheritance scheme that's sometimes useful in more complicated // class hierarchies), where the type of your parameter values. // TestWithParam<T> is itself derived from testing::Test. T can be any // copyable type. If it's a raw pointer, you are responsible for managing the // lifespan of the pointed values. class FooTest : public ::testing::TestWithParam<const char*> { // You can implement all the usual class fixture members here. }; // Then, use the TEST_P macro to define as many parameterized tests // for this fixture as you want. The _P suffix is for "parameterized" // or "pattern", whichever you prefer to think. TEST_P(FooTest, DoesBlah) { // Inside a test, access the test parameter with the GetParam() method // of the TestWithParam<T> class: EXPECT_TRUE(foo.Blah(GetParam())); ... } TEST_P(FooTest, HasBlahBlah) { ... } // Finally, you can use INSTANTIATE_TEST_CASE_P to instantiate the test // case with any set of parameters you want. Google Test defines a number // of functions for generating test parameters. They return what we call // (surprise!) parameter generators. Here is a summary of them, which // are all in the testing namespace: // // // Range(begin, end [, step]) - Yields values {begin, begin+step, // begin+step+step, ...}. The values do not // include end. step defaults to 1. // Values(v1, v2, ..., vN) - Yields values {v1, v2, ..., vN}. // ValuesIn(container) - Yields values from a C-style array, an STL // ValuesIn(begin,end) container, or an iterator range [begin, end). // Bool() - Yields sequence {false, true}. // Combine(g1, g2, ..., gN) - Yields all combinations (the Cartesian product // for the math savvy) of the values generated // by the N generators. // // For more details, see comments at the definitions of these functions below // in this file. // // The following statement will instantiate tests from the FooTest test case // each with parameter values "meeny", "miny", and "moe". INSTANTIATE_TEST_CASE_P(InstantiationName, FooTest, Values("meeny", "miny", "moe")); // To distinguish different instances of the pattern, (yes, you // can instantiate it more then once) the first argument to the // INSTANTIATE_TEST_CASE_P macro is a prefix that will be added to the // actual test case name. Remember to pick unique prefixes for different // instantiations. The tests from the instantiation above will have // these names: // // * InstantiationName/FooTest.DoesBlah/0 for "meeny" // * InstantiationName/FooTest.DoesBlah/1 for "miny" // * InstantiationName/FooTest.DoesBlah/2 for "moe" // * InstantiationName/FooTest.HasBlahBlah/0 for "meeny" // * InstantiationName/FooTest.HasBlahBlah/1 for "miny" // * InstantiationName/FooTest.HasBlahBlah/2 for "moe" // // You can use these names in --gtest_filter. // // This statement will instantiate all tests from FooTest again, each // with parameter values "cat" and "dog": const char* pets[] = {"cat", "dog"}; INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets)); // The tests from the instantiation above will have these names: // // * AnotherInstantiationName/FooTest.DoesBlah/0 for "cat" // * AnotherInstantiationName/FooTest.DoesBlah/1 for "dog" // * AnotherInstantiationName/FooTest.HasBlahBlah/0 for "cat" // * AnotherInstantiationName/FooTest.HasBlahBlah/1 for "dog" // // Please note that INSTANTIATE_TEST_CASE_P will instantiate all tests // in the given test case, whether their definitions come before or // AFTER the INSTANTIATE_TEST_CASE_P statement. // // Please also note that generator expressions (including parameters to the // generators) are evaluated in InitGoogleTest(), after main() has started. // This allows the user on one hand, to adjust generator parameters in order // to dynamically determine a set of tests to run and on the other hand, // give the user a chance to inspect the generated tests with Google Test // reflection API before RUN_ALL_TESTS() is executed. // // You can see samples/sample7_unittest.cc and samples/sample8_unittest.cc // for more examples. // // In the future, we plan to publish the API for defining new parameter // generators. But for now this interface remains part of the internal // implementation and is subject to change. // // // A parameterized test fixture must be derived from testing::Test and from // testing::WithParamInterface<T>, where T is the type of the parameter // values. Inheriting from TestWithParam<T> satisfies that requirement because // TestWithParam<T> inherits from both Test and WithParamInterface. In more // complicated hierarchies, however, it is occasionally useful to inherit // separately from Test and WithParamInterface. For example: class BaseTest : public ::testing::Test { // You can inherit all the usual members for a non-parameterized test // fixture here. }; class DerivedTest : public BaseTest, public ::testing::WithParamInterface<int> { // The usual test fixture members go here too. }; TEST_F(BaseTest, HasFoo) { // This is an ordinary non-parameterized test. } TEST_P(DerivedTest, DoesBlah) { // GetParam works just the same here as if you inherit from TestWithParam. EXPECT_TRUE(foo.Blah(GetParam())); } #endif // 0 #if !GTEST_OS_SYMBIAN # include <utility> #endif // scripts/fuse_gtest.py depends on gtest's own header being #included // *unconditionally*. Therefore these #includes cannot be moved // inside #if GTEST_HAS_PARAM_TEST. // Copyright 2008 Google Inc. // All Rights Reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Author: [email protected] (Vlad Losev) // Type and function utilities for implementing parameterized tests. #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_ #include <ctype.h> #include <iterator> #include <set> #include <utility> #include <vector> // scripts/fuse_gtest.py depends on gtest's own header being #included // *unconditionally*. Therefore these #includes cannot be moved // inside #if GTEST_HAS_PARAM_TEST. // Copyright 2003 Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Authors: Dan Egnor ([email protected]) // // A "smart" pointer type with reference tracking. Every pointer to a // particular object is kept on a circular linked list. When the last pointer // to an object is destroyed or reassigned, the object is deleted. // // Used properly, this deletes the object when the last reference goes away. // There are several caveats: // - Like all reference counting schemes, cycles lead to leaks. // - Each smart pointer is actually two pointers (8 bytes instead of 4). // - Every time a pointer is assigned, the entire list of pointers to that // object is traversed. This class is therefore NOT SUITABLE when there // will often be more than two or three pointers to a particular object. // - References are only tracked as long as linked_ptr<> objects are copied. // If a linked_ptr<> is converted to a raw pointer and back, BAD THINGS // will happen (double deletion). // // A good use of this class is storing object references in STL containers. // You can safely put linked_ptr<> in a vector<>. // Other uses may not be as good. // // Note: If you use an incomplete type with linked_ptr<>, the class // *containing* linked_ptr<> must have a constructor and destructor (even // if they do nothing!). // // Bill Gibbons suggested we use something like this. // // Thread Safety: // Unlike other linked_ptr implementations, in this implementation // a linked_ptr object is thread-safe in the sense that: // - it's safe to copy linked_ptr objects concurrently, // - it's safe to copy *from* a linked_ptr and read its underlying // raw pointer (e.g. via get()) concurrently, and // - it's safe to write to two linked_ptrs that point to the same // shared object concurrently. // TODO([email protected]): rename this to safe_linked_ptr to avoid // confusion with normal linked_ptr. #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_ #include <stdlib.h> #include <assert.h> namespace testing { namespace internal { // Protects copying of all linked_ptr objects. GTEST_API_ GTEST_DECLARE_STATIC_MUTEX_(g_linked_ptr_mutex); // This is used internally by all instances of linked_ptr<>. It needs to be // a non-template class because different types of linked_ptr<> can refer to // the same object (linked_ptr<Superclass>(obj) vs linked_ptr<Subclass>(obj)). // So, it needs to be possible for different types of linked_ptr to participate // in the same circular linked list, so we need a single class type here. // // DO NOT USE THIS CLASS DIRECTLY YOURSELF. Use linked_ptr<T>. class linked_ptr_internal { public: // Create a new circle that includes only this instance. void join_new() { next_ = this; } // Many linked_ptr operations may change p.link_ for some linked_ptr // variable p in the same circle as this object. Therefore we need // to prevent two such operations from occurring concurrently. // // Note that different types of linked_ptr objects can coexist in a // circle (e.g. linked_ptr<Base>, linked_ptr<Derived1>, and // linked_ptr<Derived2>). Therefore we must use a single mutex to // protect all linked_ptr objects. This can create serious // contention in production code, but is acceptable in a testing // framework. // Join an existing circle. void join(linked_ptr_internal const* ptr) GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) { MutexLock lock(&g_linked_ptr_mutex); linked_ptr_internal const* p = ptr; while (p->next_ != ptr) { assert(p->next_ != this && "Trying to join() a linked ring we are already in. " "Is GMock thread safety enabled?"); p = p->next_; } p->next_ = this; next_ = ptr; } // Leave whatever circle we're part of. Returns true if we were the // last member of the circle. Once this is done, you can join() another. bool depart() GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) { MutexLock lock(&g_linked_ptr_mutex); if (next_ == this) return true; linked_ptr_internal const* p = next_; while (p->next_ != this) { assert(p->next_ != next_ && "Trying to depart() a linked ring we are not in. " "Is GMock thread safety enabled?"); p = p->next_; } p->next_ = next_; return false; } private: mutable linked_ptr_internal const* next_; }; template <typename T> class linked_ptr { public: typedef T element_type; // Take over ownership of a raw pointer. This should happen as soon as // possible after the object is created. explicit linked_ptr(T* ptr = NULL) { capture(ptr); } ~linked_ptr() { depart(); } // Copy an existing linked_ptr<>, adding ourselves to the list of references. template <typename U> linked_ptr(linked_ptr<U> const& ptr) { copy(&ptr); } linked_ptr(linked_ptr const& ptr) { // NOLINT assert(&ptr != this); copy(&ptr); } // Assignment releases the old value and acquires the new. template <typename U> linked_ptr& operator=(linked_ptr<U> const& ptr) { depart(); copy(&ptr); return *this; } linked_ptr& operator=(linked_ptr const& ptr) { if (&ptr != this) { depart(); copy(&ptr); } return *this; } // Smart pointer members. void reset(T* ptr = NULL) { depart(); capture(ptr); } T* get() const { return value_; } T* operator->() const { return value_; } T& operator*() const { return *value_; } bool operator==(T* p) const { return value_ == p; } bool operator!=(T* p) const { return value_ != p; } template <typename U> bool operator==(linked_ptr<U> const& ptr) const { return value_ == ptr.get(); } template <typename U> bool operator!=(linked_ptr<U> const& ptr) const { return value_ != ptr.get(); } private: template <typename U> friend class linked_ptr; T* value_; linked_ptr_internal link_; void depart() { if (link_.depart()) delete value_; } void capture(T* ptr) { value_ = ptr; link_.join_new(); } template <typename U> void copy(linked_ptr<U> const* ptr) { value_ = ptr->get(); if (value_) link_.join(&ptr->link_); else link_.join_new(); } }; template<typename T> inline bool operator==(T* ptr, const linked_ptr<T>& x) { return ptr == x.get(); } template<typename T> inline bool operator!=(T* ptr, const linked_ptr<T>& x) { return ptr != x.get(); } // A function to convert T* into linked_ptr<T> // Doing e.g. make_linked_ptr(new FooBarBaz<type>(arg)) is a shorter notation // for linked_ptr<FooBarBaz<type> >(new FooBarBaz<type>(arg)) template <typename T> linked_ptr<T> make_linked_ptr(T* ptr) { return linked_ptr<T>(ptr); } } // namespace internal } // namespace testing #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_ // Copyright 2007, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Author: [email protected] (Zhanyong Wan) // Google Test - The Google C++ Testing Framework // // This file implements a universal value printer that can print a // value of any type T: // // void ::testing::internal::UniversalPrinter<T>::Print(value, ostream_ptr); // // A user can teach this function how to print a class type T by // defining either operator<<() or PrintTo() in the namespace that // defines T. More specifically, the FIRST defined function in the // following list will be used (assuming T is defined in namespace // foo): // // 1. foo::PrintTo(const T&, ostream*) // 2. operator<<(ostream&, const T&) defined in either foo or the // global namespace. // // If none of the above is defined, it will print the debug string of // the value if it is a protocol buffer, or print the raw bytes in the // value otherwise. // // To aid debugging: when T is a reference type, the address of the // value is also printed; when T is a (const) char pointer, both the // pointer value and the NUL-terminated string it points to are // printed. // // We also provide some convenient wrappers: // // // Prints a value to a string. For a (const or not) char // // pointer, the NUL-terminated string (but not the pointer) is // // printed. // std::string ::testing::PrintToString(const T& value); // // // Prints a value tersely: for a reference type, the referenced // // value (but not the address) is printed; for a (const or not) char // // pointer, the NUL-terminated string (but not the pointer) is // // printed. // void ::testing::internal::UniversalTersePrint(const T& value, ostream*); // // // Prints value using the type inferred by the compiler. The difference // // from UniversalTersePrint() is that this function prints both the // // pointer and the NUL-terminated string for a (const or not) char pointer. // void ::testing::internal::UniversalPrint(const T& value, ostream*); // // // Prints the fields of a tuple tersely to a string vector, one // // element for each field. Tuple support must be enabled in // // gtest-port.h. // std::vector<string> UniversalTersePrintTupleFieldsToStrings( // const Tuple& value); // // Known limitation: // // The print primitives print the elements of an STL-style container // using the compiler-inferred type of *iter where iter is a // const_iterator of the container. When const_iterator is an input // iterator but not a forward iterator, this inferred type may not // match value_type, and the print output may be incorrect. In // practice, this is rarely a problem as for most containers // const_iterator is a forward iterator. We'll fix this if there's an // actual need for it. Note that this fix cannot rely on value_type // being defined as many user-defined container types don't have // value_type. #ifndef GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_ #define GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_ #include <ostream> // NOLINT #include <sstream> #include <string> #include <utility> #include <vector> #if GTEST_HAS_STD_TUPLE_ # include <tuple> #endif namespace testing { // Definitions in the 'internal' and 'internal2' name spaces are // subject to change without notice. DO NOT USE THEM IN USER CODE! namespace internal2 { // Prints the given number of bytes in the given object to the given // ostream. GTEST_API_ void PrintBytesInObjectTo(const unsigned char* obj_bytes, size_t count, ::std::ostream* os); // For selecting which printer to use when a given type has neither << // nor PrintTo(). enum TypeKind { kProtobuf, // a protobuf type kConvertibleToInteger, // a type implicitly convertible to BiggestInt // (e.g. a named or unnamed enum type) kOtherType // anything else }; // TypeWithoutFormatter<T, kTypeKind>::PrintValue(value, os) is called // by the universal printer to print a value of type T when neither // operator<< nor PrintTo() is defined for T, where kTypeKind is the // "kind" of T as defined by enum TypeKind. template <typename T, TypeKind kTypeKind> class TypeWithoutFormatter { public: // This default version is called when kTypeKind is kOtherType. static void PrintValue(const T& value, ::std::ostream* os) { PrintBytesInObjectTo(reinterpret_cast<const unsigned char*>(&value), sizeof(value), os); } }; // We print a protobuf using its ShortDebugString() when the string // doesn't exceed this many characters; otherwise we print it using // DebugString() for better readability. const size_t kProtobufOneLinerMaxLength = 50; template <typename T> class TypeWithoutFormatter<T, kProtobuf> { public: static void PrintValue(const T& value, ::std::ostream* os) { const ::testing::internal::string short_str = value.ShortDebugString(); const ::testing::internal::string pretty_str = short_str.length() <= kProtobufOneLinerMaxLength ? short_str : ("\n" + value.DebugString()); *os << ("<" + pretty_str + ">"); } }; template <typename T> class TypeWithoutFormatter<T, kConvertibleToInteger> { public: // Since T has no << operator or PrintTo() but can be implicitly // converted to BiggestInt, we print it as a BiggestInt. // // Most likely T is an enum type (either named or unnamed), in which // case printing it as an integer is the desired behavior. In case // T is not an enum, printing it as an integer is the best we can do // given that it has no user-defined printer. static void PrintValue(const T& value, ::std::ostream* os) { const internal::BiggestInt kBigInt = value; *os << kBigInt; } }; // Prints the given value to the given ostream. If the value is a // protocol message, its debug string is printed; if it's an enum or // of a type implicitly convertible to BiggestInt, it's printed as an // integer; otherwise the bytes in the value are printed. This is // what UniversalPrinter<T>::Print() does when it knows nothing about // type T and T has neither << operator nor PrintTo(). // // A user can override this behavior for a class type Foo by defining // a << operator in the namespace where Foo is defined. // // We put this operator in namespace 'internal2' instead of 'internal' // to simplify the implementation, as much code in 'internal' needs to // use << in STL, which would conflict with our own << were it defined // in 'internal'. // // Note that this operator<< takes a generic std::basic_ostream<Char, // CharTraits> type instead of the more restricted std::ostream. If // we define it to take an std::ostream instead, we'll get an // "ambiguous overloads" compiler error when trying to print a type // Foo that supports streaming to std::basic_ostream<Char, // CharTraits>, as the compiler cannot tell whether // operator<<(std::ostream&, const T&) or // operator<<(std::basic_stream<Char, CharTraits>, const Foo&) is more // specific. template <typename Char, typename CharTraits, typename T> ::std::basic_ostream<Char, CharTraits>& operator<<( ::std::basic_ostream<Char, CharTraits>& os, const T& x) { TypeWithoutFormatter<T, (internal::IsAProtocolMessage<T>::value ? kProtobuf : internal::ImplicitlyConvertible<const T&, internal::BiggestInt>::value ? kConvertibleToInteger : kOtherType)>::PrintValue(x, &os); return os; } } // namespace internal2 } // namespace testing // This namespace MUST NOT BE NESTED IN ::testing, or the name look-up // magic needed for implementing UniversalPrinter won't work. namespace testing_internal { // Used to print a value that is not an STL-style container when the // user doesn't define PrintTo() for it. template <typename T> void DefaultPrintNonContainerTo(const T& value, ::std::ostream* os) { // With the following statement, during unqualified name lookup, // testing::internal2::operator<< appears as if it was declared in // the nearest enclosing namespace that contains both // ::testing_internal and ::testing::internal2, i.e. the global // namespace. For more details, refer to the C++ Standard section // 7.3.4-1 [namespace.udir]. This allows us to fall back onto // testing::internal2::operator<< in case T doesn't come with a << // operator. // // We cannot write 'using ::testing::internal2::operator<<;', which // gcc 3.3 fails to compile due to a compiler bug. using namespace ::testing::internal2; // NOLINT // Assuming T is defined in namespace foo, in the next statement, // the compiler will consider all of: // // 1. foo::operator<< (thanks to Koenig look-up), // 2. ::operator<< (as the current namespace is enclosed in ::), // 3. testing::internal2::operator<< (thanks to the using statement above). // // The operator<< whose type matches T best will be picked. // // We deliberately allow #2 to be a candidate, as sometimes it's // impossible to define #1 (e.g. when foo is ::std, defining // anything in it is undefined behavior unless you are a compiler // vendor.). *os << value; } } // namespace testing_internal namespace testing { namespace internal { // FormatForComparison<ToPrint, OtherOperand>::Format(value) formats a // value of type ToPrint that is an operand of a comparison assertion // (e.g. ASSERT_EQ). OtherOperand is the type of the other operand in // the comparison, and is used to help determine the best way to // format the value. In particular, when the value is a C string // (char pointer) and the other operand is an STL string object, we // want to format the C string as a string, since we know it is // compared by value with the string object. If the value is a char // pointer but the other operand is not an STL string object, we don't // know whether the pointer is supposed to point to a NUL-terminated // string, and thus want to print it as a pointer to be safe. // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. // The default case. template <typename ToPrint, typename OtherOperand> class FormatForComparison { public: static ::std::string Format(const ToPrint& value) { return ::testing::PrintToString(value); } }; // Array. template <typename ToPrint, size_t N, typename OtherOperand> class FormatForComparison<ToPrint[N], OtherOperand> { public: static ::std::string Format(const ToPrint* value) { return FormatForComparison<const ToPrint*, OtherOperand>::Format(value); } }; // By default, print C string as pointers to be safe, as we don't know // whether they actually point to a NUL-terminated string. #define GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(CharType) \ template <typename OtherOperand> \ class FormatForComparison<CharType*, OtherOperand> { \ public: \ static ::std::string Format(CharType* value) { \ return ::testing::PrintToString(static_cast<const void*>(value)); \ } \ } GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(char); GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const char); GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(wchar_t); GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const wchar_t); #undef GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_ // If a C string is compared with an STL string object, we know it's meant // to point to a NUL-terminated string, and thus can print it as a string. #define GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(CharType, OtherStringType) \ template <> \ class FormatForComparison<CharType*, OtherStringType> { \ public: \ static ::std::string Format(CharType* value) { \ return ::testing::PrintToString(value); \ } \ } GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::std::string); GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::std::string); #if GTEST_HAS_GLOBAL_STRING GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::string); GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::string); #endif #if GTEST_HAS_GLOBAL_WSTRING GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::wstring); GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::wstring); #endif #if GTEST_HAS_STD_WSTRING GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::std::wstring); GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::std::wstring); #endif #undef GTEST_IMPL_FORMAT_C_STRING_AS_STRING_ // Formats a comparison assertion (e.g. ASSERT_EQ, EXPECT_LT, and etc) // operand to be used in a failure message. The type (but not value) // of the other operand may affect the format. This allows us to // print a char* as a raw pointer when it is compared against another // char* or void*, and print it as a C string when it is compared // against an std::string object, for example. // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. template <typename T1, typename T2> std::string FormatForComparisonFailureMessage( const T1& value, const T2& /* other_operand */) { return FormatForComparison<T1, T2>::Format(value); } // UniversalPrinter<T>::Print(value, ostream_ptr) prints the given // value to the given ostream. The caller must ensure that // 'ostream_ptr' is not NULL, or the behavior is undefined. // // We define UniversalPrinter as a class template (as opposed to a // function template), as we need to partially specialize it for // reference types, which cannot be done with function templates. template <typename T> class UniversalPrinter; template <typename T> void UniversalPrint(const T& value, ::std::ostream* os); // Used to print an STL-style container when the user doesn't define // a PrintTo() for it. template <typename C> void DefaultPrintTo(IsContainer /* dummy */, false_type /* is not a pointer */, const C& container, ::std::ostream* os) { const size_t kMaxCount = 32; // The maximum number of elements to print. *os << '{'; size_t count = 0; for (typename C::const_iterator it = container.begin(); it != container.end(); ++it, ++count) { if (count > 0) { *os << ','; if (count == kMaxCount) { // Enough has been printed. *os << " ..."; break; } } *os << ' '; // We cannot call PrintTo(*it, os) here as PrintTo() doesn't // handle *it being a native array. internal::UniversalPrint(*it, os); } if (count > 0) { *os << ' '; } *os << '}'; } // Used to print a pointer that is neither a char pointer nor a member // pointer, when the user doesn't define PrintTo() for it. (A member // variable pointer or member function pointer doesn't really point to // a location in the address space. Their representation is // implementation-defined. Therefore they will be printed as raw // bytes.) template <typename T> void DefaultPrintTo(IsNotContainer /* dummy */, true_type /* is a pointer */, T* p, ::std::ostream* os) { if (p == NULL) { *os << "NULL"; } else { // C++ doesn't allow casting from a function pointer to any object // pointer. // // IsTrue() silences warnings: "Condition is always true", // "unreachable code". if (IsTrue(ImplicitlyConvertible<T*, const void*>::value)) { // T is not a function type. We just call << to print p, // relying on ADL to pick up user-defined << for their pointer // types, if any. *os << p; } else { // T is a function type, so '*os << p' doesn't do what we want // (it just prints p as bool). We want to print p as a const // void*. However, we cannot cast it to const void* directly, // even using reinterpret_cast, as earlier versions of gcc // (e.g. 3.4.5) cannot compile the cast when p is a function // pointer. Casting to UInt64 first solves the problem. *os << reinterpret_cast<const void*>( reinterpret_cast<internal::UInt64>(p)); } } } // Used to print a non-container, non-pointer value when the user // doesn't define PrintTo() for it. template <typename T> void DefaultPrintTo(IsNotContainer /* dummy */, false_type /* is not a pointer */, const T& value, ::std::ostream* os) { ::testing_internal::DefaultPrintNonContainerTo(value, os); } // Prints the given value using the << operator if it has one; // otherwise prints the bytes in it. This is what // UniversalPrinter<T>::Print() does when PrintTo() is not specialized // or overloaded for type T. // // A user can override this behavior for a class type Foo by defining // an overload of PrintTo() in the namespace where Foo is defined. We // give the user this option as sometimes defining a << operator for // Foo is not desirable (e.g. the coding style may prevent doing it, // or there is already a << operator but it doesn't do what the user // wants). template <typename T> void PrintTo(const T& value, ::std::ostream* os) { // DefaultPrintTo() is overloaded. The type of its first two // arguments determine which version will be picked. If T is an // STL-style container, the version for container will be called; if // T is a pointer, the pointer version will be called; otherwise the // generic version will be called. // // Note that we check for container types here, prior to we check // for protocol message types in our operator<<. The rationale is: // // For protocol messages, we want to give people a chance to // override Google Mock's format by defining a PrintTo() or // operator<<. For STL containers, other formats can be // incompatible with Google Mock's format for the container // elements; therefore we check for container types here to ensure // that our format is used. // // The second argument of DefaultPrintTo() is needed to bypass a bug // in Symbian's C++ compiler that prevents it from picking the right // overload between: // // PrintTo(const T& x, ...); // PrintTo(T* x, ...); DefaultPrintTo(IsContainerTest<T>(0), is_pointer<T>(), value, os); } // The following list of PrintTo() overloads tells // UniversalPrinter<T>::Print() how to print standard types (built-in // types, strings, plain arrays, and pointers). // Overloads for various char types. GTEST_API_ void PrintTo(unsigned char c, ::std::ostream* os); GTEST_API_ void PrintTo(signed char c, ::std::ostream* os); inline void PrintTo(char c, ::std::ostream* os) { // When printing a plain char, we always treat it as unsigned. This // way, the output won't be affected by whether the compiler thinks // char is signed or not. PrintTo(static_cast<unsigned char>(c), os); } // Overloads for other simple built-in types. inline void PrintTo(bool x, ::std::ostream* os) { *os << (x ? "true" : "false"); } // Overload for wchar_t type. // Prints a wchar_t as a symbol if it is printable or as its internal // code otherwise and also as its decimal code (except for L'\0'). // The L'\0' char is printed as "L'\\0'". The decimal code is printed // as signed integer when wchar_t is implemented by the compiler // as a signed type and is printed as an unsigned integer when wchar_t // is implemented as an unsigned type. GTEST_API_ void PrintTo(wchar_t wc, ::std::ostream* os); // Overloads for C strings. GTEST_API_ void PrintTo(const char* s, ::std::ostream* os); inline void PrintTo(char* s, ::std::ostream* os) { PrintTo(ImplicitCast_<const char*>(s), os); } // signed/unsigned char is often used for representing binary data, so // we print pointers to it as void* to be safe. inline void PrintTo(const signed char* s, ::std::ostream* os) { PrintTo(ImplicitCast_<const void*>(s), os); } inline void PrintTo(signed char* s, ::std::ostream* os) { PrintTo(ImplicitCast_<const void*>(s), os); } inline void PrintTo(const unsigned char* s, ::std::ostream* os) { PrintTo(ImplicitCast_<const void*>(s), os); } inline void PrintTo(unsigned char* s, ::std::ostream* os) { PrintTo(ImplicitCast_<const void*>(s), os); } // MSVC can be configured to define wchar_t as a typedef of unsigned // short. It defines _NATIVE_WCHAR_T_DEFINED when wchar_t is a native // type. When wchar_t is a typedef, defining an overload for const // wchar_t* would cause unsigned short* be printed as a wide string, // possibly causing invalid memory accesses. #if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED) // Overloads for wide C strings GTEST_API_ void PrintTo(const wchar_t* s, ::std::ostream* os); inline void PrintTo(wchar_t* s, ::std::ostream* os) { PrintTo(ImplicitCast_<const wchar_t*>(s), os); } #endif // Overload for C arrays. Multi-dimensional arrays are printed // properly. // Prints the given number of elements in an array, without printing // the curly braces. template <typename T> void PrintRawArrayTo(const T a[], size_t count, ::std::ostream* os) { UniversalPrint(a[0], os); for (size_t i = 1; i != count; i++) { *os << ", "; UniversalPrint(a[i], os); } } // Overloads for ::string and ::std::string. #if GTEST_HAS_GLOBAL_STRING GTEST_API_ void PrintStringTo(const ::string&s, ::std::ostream* os); inline void PrintTo(const ::string& s, ::std::ostream* os) { PrintStringTo(s, os); } #endif // GTEST_HAS_GLOBAL_STRING GTEST_API_ void PrintStringTo(const ::std::string&s, ::std::ostream* os); inline void PrintTo(const ::std::string& s, ::std::ostream* os) { PrintStringTo(s, os); } // Overloads for ::wstring and ::std::wstring. #if GTEST_HAS_GLOBAL_WSTRING GTEST_API_ void PrintWideStringTo(const ::wstring&s, ::std::ostream* os); inline void PrintTo(const ::wstring& s, ::std::ostream* os) { PrintWideStringTo(s, os); } #endif // GTEST_HAS_GLOBAL_WSTRING #if GTEST_HAS_STD_WSTRING GTEST_API_ void PrintWideStringTo(const ::std::wstring&s, ::std::ostream* os); inline void PrintTo(const ::std::wstring& s, ::std::ostream* os) { PrintWideStringTo(s, os); } #endif // GTEST_HAS_STD_WSTRING #if GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_ // Helper function for printing a tuple. T must be instantiated with // a tuple type. template <typename T> void PrintTupleTo(const T& t, ::std::ostream* os); #endif // GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_ #if GTEST_HAS_TR1_TUPLE // Overload for ::std::tr1::tuple. Needed for printing function arguments, // which are packed as tuples. // Overloaded PrintTo() for tuples of various arities. We support // tuples of up-to 10 fields. The following implementation works // regardless of whether tr1::tuple is implemented using the // non-standard variadic template feature or not. inline void PrintTo(const ::std::tr1::tuple<>& t, ::std::ostream* os) { PrintTupleTo(t, os); } template <typename T1> void PrintTo(const ::std::tr1::tuple<T1>& t, ::std::ostream* os) { PrintTupleTo(t, os); } template <typename T1, typename T2> void PrintTo(const ::std::tr1::tuple<T1, T2>& t, ::std::ostream* os) { PrintTupleTo(t, os); } template <typename T1, typename T2, typename T3> void PrintTo(const ::std::tr1::tuple<T1, T2, T3>& t, ::std::ostream* os) { PrintTupleTo(t, os); } template <typename T1, typename T2, typename T3, typename T4> void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4>& t, ::std::ostream* os) { PrintTupleTo(t, os); } template <typename T1, typename T2, typename T3, typename T4, typename T5> void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5>& t, ::std::ostream* os) { PrintTupleTo(t, os); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6>& t, ::std::ostream* os) { PrintTupleTo(t, os); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7>& t, ::std::ostream* os) { PrintTupleTo(t, os); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8>& t, ::std::ostream* os) { PrintTupleTo(t, os); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9> void PrintTo(const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>& t, ::std::ostream* os) { PrintTupleTo(t, os); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10> void PrintTo( const ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>& t, ::std::ostream* os) { PrintTupleTo(t, os); } #endif // GTEST_HAS_TR1_TUPLE #if GTEST_HAS_STD_TUPLE_ template <typename... Types> void PrintTo(const ::std::tuple<Types...>& t, ::std::ostream* os) { PrintTupleTo(t, os); } #endif // GTEST_HAS_STD_TUPLE_ // Overload for std::pair. template <typename T1, typename T2> void PrintTo(const ::std::pair<T1, T2>& value, ::std::ostream* os) { *os << '('; // We cannot use UniversalPrint(value.first, os) here, as T1 may be // a reference type. The same for printing value.second. UniversalPrinter<T1>::Print(value.first, os); *os << ", "; UniversalPrinter<T2>::Print(value.second, os); *os << ')'; } // Implements printing a non-reference type T by letting the compiler // pick the right overload of PrintTo() for T. template <typename T> class UniversalPrinter { public: // MSVC warns about adding const to a function type, so we want to // disable the warning. GTEST_DISABLE_MSC_WARNINGS_PUSH_(4180) // Note: we deliberately don't call this PrintTo(), as that name // conflicts with ::testing::internal::PrintTo in the body of the // function. static void Print(const T& value, ::std::ostream* os) { // By default, ::testing::internal::PrintTo() is used for printing // the value. // // Thanks to Koenig look-up, if T is a class and has its own // PrintTo() function defined in its namespace, that function will // be visible here. Since it is more specific than the generic ones // in ::testing::internal, it will be picked by the compiler in the // following statement - exactly what we want. PrintTo(value, os); } GTEST_DISABLE_MSC_WARNINGS_POP_() }; // UniversalPrintArray(begin, len, os) prints an array of 'len' // elements, starting at address 'begin'. template <typename T> void UniversalPrintArray(const T* begin, size_t len, ::std::ostream* os) { if (len == 0) { *os << "{}"; } else { *os << "{ "; const size_t kThreshold = 18; const size_t kChunkSize = 8; // If the array has more than kThreshold elements, we'll have to // omit some details by printing only the first and the last // kChunkSize elements. // TODO([email protected]): let the user control the threshold using a flag. if (len <= kThreshold) { PrintRawArrayTo(begin, len, os); } else { PrintRawArrayTo(begin, kChunkSize, os); *os << ", ..., "; PrintRawArrayTo(begin + len - kChunkSize, kChunkSize, os); } *os << " }"; } } // This overload prints a (const) char array compactly. GTEST_API_ void UniversalPrintArray( const char* begin, size_t len, ::std::ostream* os); // This overload prints a (const) wchar_t array compactly. GTEST_API_ void UniversalPrintArray( const wchar_t* begin, size_t len, ::std::ostream* os); // Implements printing an array type T[N]. template <typename T, size_t N> class UniversalPrinter<T[N]> { public: // Prints the given array, omitting some elements when there are too // many. static void Print(const T (&a)[N], ::std::ostream* os) { UniversalPrintArray(a, N, os); } }; // Implements printing a reference type T&. template <typename T> class UniversalPrinter<T&> { public: // MSVC warns about adding const to a function type, so we want to // disable the warning. GTEST_DISABLE_MSC_WARNINGS_PUSH_(4180) static void Print(const T& value, ::std::ostream* os) { // Prints the address of the value. We use reinterpret_cast here // as static_cast doesn't compile when T is a function type. *os << "@" << reinterpret_cast<const void*>(&value) << " "; // Then prints the value itself. UniversalPrint(value, os); } GTEST_DISABLE_MSC_WARNINGS_POP_() }; // Prints a value tersely: for a reference type, the referenced value // (but not the address) is printed; for a (const) char pointer, the // NUL-terminated string (but not the pointer) is printed. template <typename T> class UniversalTersePrinter { public: static void Print(const T& value, ::std::ostream* os) { UniversalPrint(value, os); } }; template <typename T> class UniversalTersePrinter<T&> { public: static void Print(const T& value, ::std::ostream* os) { UniversalPrint(value, os); } }; template <typename T, size_t N> class UniversalTersePrinter<T[N]> { public: static void Print(const T (&value)[N], ::std::ostream* os) { UniversalPrinter<T[N]>::Print(value, os); } }; template <> class UniversalTersePrinter<const char*> { public: static void Print(const char* str, ::std::ostream* os) { if (str == NULL) { *os << "NULL"; } else { UniversalPrint(string(str), os); } } }; template <> class UniversalTersePrinter<char*> { public: static void Print(char* str, ::std::ostream* os) { UniversalTersePrinter<const char*>::Print(str, os); } }; #if GTEST_HAS_STD_WSTRING template <> class UniversalTersePrinter<const wchar_t*> { public: static void Print(const wchar_t* str, ::std::ostream* os) { if (str == NULL) { *os << "NULL"; } else { UniversalPrint(::std::wstring(str), os); } } }; #endif template <> class UniversalTersePrinter<wchar_t*> { public: static void Print(wchar_t* str, ::std::ostream* os) { UniversalTersePrinter<const wchar_t*>::Print(str, os); } }; template <typename T> void UniversalTersePrint(const T& value, ::std::ostream* os) { UniversalTersePrinter<T>::Print(value, os); } // Prints a value using the type inferred by the compiler. The // difference between this and UniversalTersePrint() is that for a // (const) char pointer, this prints both the pointer and the // NUL-terminated string. template <typename T> void UniversalPrint(const T& value, ::std::ostream* os) { // A workarond for the bug in VC++ 7.1 that prevents us from instantiating // UniversalPrinter with T directly. typedef T T1; UniversalPrinter<T1>::Print(value, os); } typedef ::std::vector<string> Strings; // TuplePolicy<TupleT> must provide: // - tuple_size // size of tuple TupleT. // - get<size_t I>(const TupleT& t) // static function extracting element I of tuple TupleT. // - tuple_element<size_t I>::type // type of element I of tuple TupleT. template <typename TupleT> struct TuplePolicy; #if GTEST_HAS_TR1_TUPLE template <typename TupleT> struct TuplePolicy { typedef TupleT Tuple; static const size_t tuple_size = ::std::tr1::tuple_size<Tuple>::value; template <size_t I> struct tuple_element : ::std::tr1::tuple_element<I, Tuple> {}; template <size_t I> static typename AddReference< const typename ::std::tr1::tuple_element<I, Tuple>::type>::type get( const Tuple& tuple) { return ::std::tr1::get<I>(tuple); } }; template <typename TupleT> const size_t TuplePolicy<TupleT>::tuple_size; #endif // GTEST_HAS_TR1_TUPLE #if GTEST_HAS_STD_TUPLE_ template <typename... Types> struct TuplePolicy< ::std::tuple<Types...> > { typedef ::std::tuple<Types...> Tuple; static const size_t tuple_size = ::std::tuple_size<Tuple>::value; template <size_t I> struct tuple_element : ::std::tuple_element<I, Tuple> {}; template <size_t I> static const typename ::std::tuple_element<I, Tuple>::type& get( const Tuple& tuple) { return ::std::get<I>(tuple); } }; template <typename... Types> const size_t TuplePolicy< ::std::tuple<Types...> >::tuple_size; #endif // GTEST_HAS_STD_TUPLE_ #if GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_ // This helper template allows PrintTo() for tuples and // UniversalTersePrintTupleFieldsToStrings() to be defined by // induction on the number of tuple fields. The idea is that // TuplePrefixPrinter<N>::PrintPrefixTo(t, os) prints the first N // fields in tuple t, and can be defined in terms of // TuplePrefixPrinter<N - 1>. // // The inductive case. template <size_t N> struct TuplePrefixPrinter { // Prints the first N fields of a tuple. template <typename Tuple> static void PrintPrefixTo(const Tuple& t, ::std::ostream* os) { TuplePrefixPrinter<N - 1>::PrintPrefixTo(t, os); GTEST_INTENTIONAL_CONST_COND_PUSH_() if (N > 1) { GTEST_INTENTIONAL_CONST_COND_POP_() *os << ", "; } UniversalPrinter< typename TuplePolicy<Tuple>::template tuple_element<N - 1>::type> ::Print(TuplePolicy<Tuple>::template get<N - 1>(t), os); } // Tersely prints the first N fields of a tuple to a string vector, // one element for each field. template <typename Tuple> static void TersePrintPrefixToStrings(const Tuple& t, Strings* strings) { TuplePrefixPrinter<N - 1>::TersePrintPrefixToStrings(t, strings); ::std::stringstream ss; UniversalTersePrint(TuplePolicy<Tuple>::template get<N - 1>(t), &ss); strings->push_back(ss.str()); } }; // Base case. template <> struct TuplePrefixPrinter<0> { template <typename Tuple> static void PrintPrefixTo(const Tuple&, ::std::ostream*) {} template <typename Tuple> static void TersePrintPrefixToStrings(const Tuple&, Strings*) {} }; // Helper function for printing a tuple. // Tuple must be either std::tr1::tuple or std::tuple type. template <typename Tuple> void PrintTupleTo(const Tuple& t, ::std::ostream* os) { *os << "("; TuplePrefixPrinter<TuplePolicy<Tuple>::tuple_size>::PrintPrefixTo(t, os); *os << ")"; } // Prints the fields of a tuple tersely to a string vector, one // element for each field. See the comment before // UniversalTersePrint() for how we define "tersely". template <typename Tuple> Strings UniversalTersePrintTupleFieldsToStrings(const Tuple& value) { Strings result; TuplePrefixPrinter<TuplePolicy<Tuple>::tuple_size>:: TersePrintPrefixToStrings(value, &result); return result; } #endif // GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_ } // namespace internal template <typename T> ::std::string PrintToString(const T& value) { ::std::stringstream ss; internal::UniversalTersePrinter<T>::Print(value, &ss); return ss.str(); } } // namespace testing // Include any custom printer added by the local installation. // We must include this header at the end to make sure it can use the // declarations from this file. // Copyright 2015, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // This file provides an injection point for custom printers in a local // installation of gTest. // It will be included from gtest-printers.h and the overrides in this file // will be visible to everyone. // See documentation at gtest/gtest-printers.h for details on how to define a // custom printer. // // ** Custom implementation starts here ** #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ #endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ #endif // GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_ #if GTEST_HAS_PARAM_TEST namespace testing { // Input to a parameterized test name generator, describing a test parameter. // Consists of the parameter value and the integer parameter index. template <class ParamType> struct TestParamInfo { TestParamInfo(const ParamType& a_param, size_t an_index) : param(a_param), index(an_index) {} ParamType param; size_t index; }; // A builtin parameterized test name generator which returns the result of // testing::PrintToString. struct PrintToStringParamName { template <class ParamType> std::string operator()(const TestParamInfo<ParamType>& info) const { return PrintToString(info.param); } }; namespace internal { // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // Outputs a message explaining invalid registration of different // fixture class for the same test case. This may happen when // TEST_P macro is used to define two tests with the same name // but in different namespaces. GTEST_API_ void ReportInvalidTestCaseType(const char* test_case_name, CodeLocation code_location); template <typename> class ParamGeneratorInterface; template <typename> class ParamGenerator; // Interface for iterating over elements provided by an implementation // of ParamGeneratorInterface<T>. template <typename T> class ParamIteratorInterface { public: virtual ~ParamIteratorInterface() {} // A pointer to the base generator instance. // Used only for the purposes of iterator comparison // to make sure that two iterators belong to the same generator. virtual const ParamGeneratorInterface<T>* BaseGenerator() const = 0; // Advances iterator to point to the next element // provided by the generator. The caller is responsible // for not calling Advance() on an iterator equal to // BaseGenerator()->End(). virtual void Advance() = 0; // Clones the iterator object. Used for implementing copy semantics // of ParamIterator<T>. virtual ParamIteratorInterface* Clone() const = 0; // Dereferences the current iterator and provides (read-only) access // to the pointed value. It is the caller's responsibility not to call // Current() on an iterator equal to BaseGenerator()->End(). // Used for implementing ParamGenerator<T>::operator*(). virtual const T* Current() const = 0; // Determines whether the given iterator and other point to the same // element in the sequence generated by the generator. // Used for implementing ParamGenerator<T>::operator==(). virtual bool Equals(const ParamIteratorInterface& other) const = 0; }; // Class iterating over elements provided by an implementation of // ParamGeneratorInterface<T>. It wraps ParamIteratorInterface<T> // and implements the const forward iterator concept. template <typename T> class ParamIterator { public: typedef T value_type; typedef const T& reference; typedef ptrdiff_t difference_type; // ParamIterator assumes ownership of the impl_ pointer. ParamIterator(const ParamIterator& other) : impl_(other.impl_->Clone()) {} ParamIterator& operator=(const ParamIterator& other) { if (this != &other) impl_.reset(other.impl_->Clone()); return *this; } const T& operator*() const { return *impl_->Current(); } const T* operator->() const { return impl_->Current(); } // Prefix version of operator++. ParamIterator& operator++() { impl_->Advance(); return *this; } // Postfix version of operator++. ParamIterator operator++(int /*unused*/) { ParamIteratorInterface<T>* clone = impl_->Clone(); impl_->Advance(); return ParamIterator(clone); } bool operator==(const ParamIterator& other) const { return impl_.get() == other.impl_.get() || impl_->Equals(*other.impl_); } bool operator!=(const ParamIterator& other) const { return !(*this == other); } private: friend class ParamGenerator<T>; explicit ParamIterator(ParamIteratorInterface<T>* impl) : impl_(impl) {} scoped_ptr<ParamIteratorInterface<T> > impl_; }; // ParamGeneratorInterface<T> is the binary interface to access generators // defined in other translation units. template <typename T> class ParamGeneratorInterface { public: typedef T ParamType; virtual ~ParamGeneratorInterface() {} // Generator interface definition virtual ParamIteratorInterface<T>* Begin() const = 0; virtual ParamIteratorInterface<T>* End() const = 0; }; // Wraps ParamGeneratorInterface<T> and provides general generator syntax // compatible with the STL Container concept. // This class implements copy initialization semantics and the contained // ParamGeneratorInterface<T> instance is shared among all copies // of the original object. This is possible because that instance is immutable. template<typename T> class ParamGenerator { public: typedef ParamIterator<T> iterator; explicit ParamGenerator(ParamGeneratorInterface<T>* impl) : impl_(impl) {} ParamGenerator(const ParamGenerator& other) : impl_(other.impl_) {} ParamGenerator& operator=(const ParamGenerator& other) { impl_ = other.impl_; return *this; } iterator begin() const { return iterator(impl_->Begin()); } iterator end() const { return iterator(impl_->End()); } private: linked_ptr<const ParamGeneratorInterface<T> > impl_; }; // Generates values from a range of two comparable values. Can be used to // generate sequences of user-defined types that implement operator+() and // operator<(). // This class is used in the Range() function. template <typename T, typename IncrementT> class RangeGenerator : public ParamGeneratorInterface<T> { public: RangeGenerator(T begin, T end, IncrementT step) : begin_(begin), end_(end), step_(step), end_index_(CalculateEndIndex(begin, end, step)) {} virtual ~RangeGenerator() {} virtual ParamIteratorInterface<T>* Begin() const { return new Iterator(this, begin_, 0, step_); } virtual ParamIteratorInterface<T>* End() const { return new Iterator(this, end_, end_index_, step_); } private: class Iterator : public ParamIteratorInterface<T> { public: Iterator(const ParamGeneratorInterface<T>* base, T value, int index, IncrementT step) : base_(base), value_(value), index_(index), step_(step) {} virtual ~Iterator() {} virtual const ParamGeneratorInterface<T>* BaseGenerator() const { return base_; } virtual void Advance() { value_ = static_cast<T>(value_ + step_); index_++; } virtual ParamIteratorInterface<T>* Clone() const { return new Iterator(*this); } virtual const T* Current() const { return &value_; } virtual bool Equals(const ParamIteratorInterface<T>& other) const { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) << "The program attempted to compare iterators " << "from different generators." << std::endl; const int other_index = CheckedDowncastToActualType<const Iterator>(&other)->index_; return index_ == other_index; } private: Iterator(const Iterator& other) : ParamIteratorInterface<T>(), base_(other.base_), value_(other.value_), index_(other.index_), step_(other.step_) {} // No implementation - assignment is unsupported. void operator=(const Iterator& other); const ParamGeneratorInterface<T>* const base_; T value_; int index_; const IncrementT step_; }; // class RangeGenerator::Iterator static int CalculateEndIndex(const T& begin, const T& end, const IncrementT& step) { int end_index = 0; for (T i = begin; i < end; i = static_cast<T>(i + step)) end_index++; return end_index; } // No implementation - assignment is unsupported. void operator=(const RangeGenerator& other); const T begin_; const T end_; const IncrementT step_; // The index for the end() iterator. All the elements in the generated // sequence are indexed (0-based) to aid iterator comparison. const int end_index_; }; // class RangeGenerator // Generates values from a pair of STL-style iterators. Used in the // ValuesIn() function. The elements are copied from the source range // since the source can be located on the stack, and the generator // is likely to persist beyond that stack frame. template <typename T> class ValuesInIteratorRangeGenerator : public ParamGeneratorInterface<T> { public: template <typename ForwardIterator> ValuesInIteratorRangeGenerator(ForwardIterator begin, ForwardIterator end) : container_(begin, end) {} virtual ~ValuesInIteratorRangeGenerator() {} virtual ParamIteratorInterface<T>* Begin() const { return new Iterator(this, container_.begin()); } virtual ParamIteratorInterface<T>* End() const { return new Iterator(this, container_.end()); } private: typedef typename ::std::vector<T> ContainerType; class Iterator : public ParamIteratorInterface<T> { public: Iterator(const ParamGeneratorInterface<T>* base, typename ContainerType::const_iterator iterator) : base_(base), iterator_(iterator) {} virtual ~Iterator() {} virtual const ParamGeneratorInterface<T>* BaseGenerator() const { return base_; } virtual void Advance() { ++iterator_; value_.reset(); } virtual ParamIteratorInterface<T>* Clone() const { return new Iterator(*this); } // We need to use cached value referenced by iterator_ because *iterator_ // can return a temporary object (and of type other then T), so just // having "return &*iterator_;" doesn't work. // value_ is updated here and not in Advance() because Advance() // can advance iterator_ beyond the end of the range, and we cannot // detect that fact. The client code, on the other hand, is // responsible for not calling Current() on an out-of-range iterator. virtual const T* Current() const { if (value_.get() == NULL) value_.reset(new T(*iterator_)); return value_.get(); } virtual bool Equals(const ParamIteratorInterface<T>& other) const { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) << "The program attempted to compare iterators " << "from different generators." << std::endl; return iterator_ == CheckedDowncastToActualType<const Iterator>(&other)->iterator_; } private: Iterator(const Iterator& other) // The explicit constructor call suppresses a false warning // emitted by gcc when supplied with the -Wextra option. : ParamIteratorInterface<T>(), base_(other.base_), iterator_(other.iterator_) {} const ParamGeneratorInterface<T>* const base_; typename ContainerType::const_iterator iterator_; // A cached value of *iterator_. We keep it here to allow access by // pointer in the wrapping iterator's operator->(). // value_ needs to be mutable to be accessed in Current(). // Use of scoped_ptr helps manage cached value's lifetime, // which is bound by the lifespan of the iterator itself. mutable scoped_ptr<const T> value_; }; // class ValuesInIteratorRangeGenerator::Iterator // No implementation - assignment is unsupported. void operator=(const ValuesInIteratorRangeGenerator& other); const ContainerType container_; }; // class ValuesInIteratorRangeGenerator // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // Default parameterized test name generator, returns a string containing the // integer test parameter index. template <class ParamType> std::string DefaultParamName(const TestParamInfo<ParamType>& info) { Message name_stream; name_stream << info.index; return name_stream.GetString(); } // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // Parameterized test name overload helpers, which help the // INSTANTIATE_TEST_CASE_P macro choose between the default parameterized // test name generator and user param name generator. template <class ParamType, class ParamNameGenFunctor> ParamNameGenFunctor GetParamNameGen(ParamNameGenFunctor func) { return func; } template <class ParamType> struct ParamNameGenFunc { typedef std::string Type(const TestParamInfo<ParamType>&); }; template <class ParamType> typename ParamNameGenFunc<ParamType>::Type *GetParamNameGen() { return DefaultParamName; } // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // Stores a parameter value and later creates tests parameterized with that // value. template <class TestClass> class ParameterizedTestFactory : public TestFactoryBase { public: typedef typename TestClass::ParamType ParamType; explicit ParameterizedTestFactory(ParamType parameter) : parameter_(parameter) {} virtual Test* CreateTest() { TestClass::SetParam(&parameter_); return new TestClass(); } private: const ParamType parameter_; GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestFactory); }; // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // TestMetaFactoryBase is a base class for meta-factories that create // test factories for passing into MakeAndRegisterTestInfo function. template <class ParamType> class TestMetaFactoryBase { public: virtual ~TestMetaFactoryBase() {} virtual TestFactoryBase* CreateTestFactory(ParamType parameter) = 0; }; // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // TestMetaFactory creates test factories for passing into // MakeAndRegisterTestInfo function. Since MakeAndRegisterTestInfo receives // ownership of test factory pointer, same factory object cannot be passed // into that method twice. But ParameterizedTestCaseInfo is going to call // it for each Test/Parameter value combination. Thus it needs meta factory // creator class. template <class TestCase> class TestMetaFactory : public TestMetaFactoryBase<typename TestCase::ParamType> { public: typedef typename TestCase::ParamType ParamType; TestMetaFactory() {} virtual TestFactoryBase* CreateTestFactory(ParamType parameter) { return new ParameterizedTestFactory<TestCase>(parameter); } private: GTEST_DISALLOW_COPY_AND_ASSIGN_(TestMetaFactory); }; // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // ParameterizedTestCaseInfoBase is a generic interface // to ParameterizedTestCaseInfo classes. ParameterizedTestCaseInfoBase // accumulates test information provided by TEST_P macro invocations // and generators provided by INSTANTIATE_TEST_CASE_P macro invocations // and uses that information to register all resulting test instances // in RegisterTests method. The ParameterizeTestCaseRegistry class holds // a collection of pointers to the ParameterizedTestCaseInfo objects // and calls RegisterTests() on each of them when asked. class ParameterizedTestCaseInfoBase { public: virtual ~ParameterizedTestCaseInfoBase() {} // Base part of test case name for display purposes. virtual const string& GetTestCaseName() const = 0; // Test case id to verify identity. virtual TypeId GetTestCaseTypeId() const = 0; // UnitTest class invokes this method to register tests in this // test case right before running them in RUN_ALL_TESTS macro. // This method should not be called more then once on any single // instance of a ParameterizedTestCaseInfoBase derived class. virtual void RegisterTests() = 0; protected: ParameterizedTestCaseInfoBase() {} private: GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseInfoBase); }; // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // ParameterizedTestCaseInfo accumulates tests obtained from TEST_P // macro invocations for a particular test case and generators // obtained from INSTANTIATE_TEST_CASE_P macro invocations for that // test case. It registers tests with all values generated by all // generators when asked. template <class TestCase> class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase { public: // ParamType and GeneratorCreationFunc are private types but are required // for declarations of public methods AddTestPattern() and // AddTestCaseInstantiation(). typedef typename TestCase::ParamType ParamType; // A function that returns an instance of appropriate generator type. typedef ParamGenerator<ParamType>(GeneratorCreationFunc)(); typedef typename ParamNameGenFunc<ParamType>::Type ParamNameGeneratorFunc; explicit ParameterizedTestCaseInfo( const char* name, CodeLocation code_location) : test_case_name_(name), code_location_(code_location) {} // Test case base name for display purposes. virtual const string& GetTestCaseName() const { return test_case_name_; } // Test case id to verify identity. virtual TypeId GetTestCaseTypeId() const { return GetTypeId<TestCase>(); } // TEST_P macro uses AddTestPattern() to record information // about a single test in a LocalTestInfo structure. // test_case_name is the base name of the test case (without invocation // prefix). test_base_name is the name of an individual test without // parameter index. For the test SequenceA/FooTest.DoBar/1 FooTest is // test case base name and DoBar is test base name. void AddTestPattern(const char* test_case_name, const char* test_base_name, TestMetaFactoryBase<ParamType>* meta_factory) { tests_.push_back(linked_ptr<TestInfo>(new TestInfo(test_case_name, test_base_name, meta_factory))); } // INSTANTIATE_TEST_CASE_P macro uses AddGenerator() to record information // about a generator. int AddTestCaseInstantiation(const string& instantiation_name, GeneratorCreationFunc* func, ParamNameGeneratorFunc* name_func, const char* file, int line) { instantiations_.push_back( InstantiationInfo(instantiation_name, func, name_func, file, line)); return 0; // Return value used only to run this method in namespace scope. } // UnitTest class invokes this method to register tests in this test case // test cases right before running tests in RUN_ALL_TESTS macro. // This method should not be called more then once on any single // instance of a ParameterizedTestCaseInfoBase derived class. // UnitTest has a guard to prevent from calling this method more then once. virtual void RegisterTests() { for (typename TestInfoContainer::iterator test_it = tests_.begin(); test_it != tests_.end(); ++test_it) { linked_ptr<TestInfo> test_info = *test_it; for (typename InstantiationContainer::iterator gen_it = instantiations_.begin(); gen_it != instantiations_.end(); ++gen_it) { const string& instantiation_name = gen_it->name; ParamGenerator<ParamType> generator((*gen_it->generator)()); ParamNameGeneratorFunc* name_func = gen_it->name_func; const char* file = gen_it->file; int line = gen_it->line; string test_case_name; if ( !instantiation_name.empty() ) test_case_name = instantiation_name + "/"; test_case_name += test_info->test_case_base_name; size_t i = 0; std::set<std::string> test_param_names; for (typename ParamGenerator<ParamType>::iterator param_it = generator.begin(); param_it != generator.end(); ++param_it, ++i) { Message test_name_stream; std::string param_name = name_func( TestParamInfo<ParamType>(*param_it, i)); GTEST_CHECK_(IsValidParamName(param_name)) << "Parameterized test name '" << param_name << "' is invalid, in " << file << " line " << line << std::endl; GTEST_CHECK_(test_param_names.count(param_name) == 0) << "Duplicate parameterized test name '" << param_name << "', in " << file << " line " << line << std::endl; test_param_names.insert(param_name); test_name_stream << test_info->test_base_name << "/" << param_name; MakeAndRegisterTestInfo( test_case_name.c_str(), test_name_stream.GetString().c_str(), NULL, // No type parameter. PrintToString(*param_it).c_str(), code_location_, GetTestCaseTypeId(), TestCase::SetUpTestCase, TestCase::TearDownTestCase, test_info->test_meta_factory->CreateTestFactory(*param_it)); } // for param_it } // for gen_it } // for test_it } // RegisterTests private: // LocalTestInfo structure keeps information about a single test registered // with TEST_P macro. struct TestInfo { TestInfo(const char* a_test_case_base_name, const char* a_test_base_name, TestMetaFactoryBase<ParamType>* a_test_meta_factory) : test_case_base_name(a_test_case_base_name), test_base_name(a_test_base_name), test_meta_factory(a_test_meta_factory) {} const string test_case_base_name; const string test_base_name; const scoped_ptr<TestMetaFactoryBase<ParamType> > test_meta_factory; }; typedef ::std::vector<linked_ptr<TestInfo> > TestInfoContainer; // Records data received from INSTANTIATE_TEST_CASE_P macros: // <Instantiation name, Sequence generator creation function, // Name generator function, Source file, Source line> struct InstantiationInfo { InstantiationInfo(const std::string &name_in, GeneratorCreationFunc* generator_in, ParamNameGeneratorFunc* name_func_in, const char* file_in, int line_in) : name(name_in), generator(generator_in), name_func(name_func_in), file(file_in), line(line_in) {} std::string name; GeneratorCreationFunc* generator; ParamNameGeneratorFunc* name_func; const char* file; int line; }; typedef ::std::vector<InstantiationInfo> InstantiationContainer; static bool IsValidParamName(const std::string& name) { // Check for empty string if (name.empty()) return false; // Check for invalid characters for (std::string::size_type index = 0; index < name.size(); ++index) { if (!isalnum(name[index]) && name[index] != '_') return false; } return true; } const string test_case_name_; CodeLocation code_location_; TestInfoContainer tests_; InstantiationContainer instantiations_; GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseInfo); }; // class ParameterizedTestCaseInfo // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // ParameterizedTestCaseRegistry contains a map of ParameterizedTestCaseInfoBase // classes accessed by test case names. TEST_P and INSTANTIATE_TEST_CASE_P // macros use it to locate their corresponding ParameterizedTestCaseInfo // descriptors. class ParameterizedTestCaseRegistry { public: ParameterizedTestCaseRegistry() {} ~ParameterizedTestCaseRegistry() { for (TestCaseInfoContainer::iterator it = test_case_infos_.begin(); it != test_case_infos_.end(); ++it) { delete *it; } } // Looks up or creates and returns a structure containing information about // tests and instantiations of a particular test case. template <class TestCase> ParameterizedTestCaseInfo<TestCase>* GetTestCasePatternHolder( const char* test_case_name, CodeLocation code_location) { ParameterizedTestCaseInfo<TestCase>* typed_test_info = NULL; for (TestCaseInfoContainer::iterator it = test_case_infos_.begin(); it != test_case_infos_.end(); ++it) { if ((*it)->GetTestCaseName() == test_case_name) { if ((*it)->GetTestCaseTypeId() != GetTypeId<TestCase>()) { // Complain about incorrect usage of Google Test facilities // and terminate the program since we cannot guaranty correct // test case setup and tear-down in this case. ReportInvalidTestCaseType(test_case_name, code_location); posix::Abort(); } else { // At this point we are sure that the object we found is of the same // type we are looking for, so we downcast it to that type // without further checks. typed_test_info = CheckedDowncastToActualType< ParameterizedTestCaseInfo<TestCase> >(*it); } break; } } if (typed_test_info == NULL) { typed_test_info = new ParameterizedTestCaseInfo<TestCase>( test_case_name, code_location); test_case_infos_.push_back(typed_test_info); } return typed_test_info; } void RegisterTests() { for (TestCaseInfoContainer::iterator it = test_case_infos_.begin(); it != test_case_infos_.end(); ++it) { (*it)->RegisterTests(); } } private: typedef ::std::vector<ParameterizedTestCaseInfoBase*> TestCaseInfoContainer; TestCaseInfoContainer test_case_infos_; GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestCaseRegistry); }; } // namespace internal } // namespace testing #endif // GTEST_HAS_PARAM_TEST #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_ // This file was GENERATED by command: // pump.py gtest-param-util-generated.h.pump // DO NOT EDIT BY HAND!!! // Copyright 2008 Google Inc. // All Rights Reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Author: [email protected] (Vlad Losev) // Type and function utilities for implementing parameterized tests. // This file is generated by a SCRIPT. DO NOT EDIT BY HAND! // // Currently Google Test supports at most 50 arguments in Values, // and at most 10 arguments in Combine. Please contact // [email protected] if you need more. // Please note that the number of arguments to Combine is limited // by the maximum arity of the implementation of tuple which is // currently set at 10. #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ // scripts/fuse_gtest.py depends on gtest's own header being #included // *unconditionally*. Therefore these #includes cannot be moved // inside #if GTEST_HAS_PARAM_TEST. #if GTEST_HAS_PARAM_TEST namespace testing { // Forward declarations of ValuesIn(), which is implemented in // include/gtest/gtest-param-test.h. template <typename ForwardIterator> internal::ParamGenerator< typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type> ValuesIn(ForwardIterator begin, ForwardIterator end); template <typename T, size_t N> internal::ParamGenerator<T> ValuesIn(const T (&array)[N]); template <class Container> internal::ParamGenerator<typename Container::value_type> ValuesIn( const Container& container); namespace internal { // Used in the Values() function to provide polymorphic capabilities. template <typename T1> class ValueArray1 { public: explicit ValueArray1(T1 v1) : v1_(v1) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray1& other); const T1 v1_; }; template <typename T1, typename T2> class ValueArray2 { public: ValueArray2(T1 v1, T2 v2) : v1_(v1), v2_(v2) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray2& other); const T1 v1_; const T2 v2_; }; template <typename T1, typename T2, typename T3> class ValueArray3 { public: ValueArray3(T1 v1, T2 v2, T3 v3) : v1_(v1), v2_(v2), v3_(v3) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray3& other); const T1 v1_; const T2 v2_; const T3 v3_; }; template <typename T1, typename T2, typename T3, typename T4> class ValueArray4 { public: ValueArray4(T1 v1, T2 v2, T3 v3, T4 v4) : v1_(v1), v2_(v2), v3_(v3), v4_(v4) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray4& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5> class ValueArray5 { public: ValueArray5(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray5& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> class ValueArray6 { public: ValueArray6(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray6& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> class ValueArray7 { public: ValueArray7(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray7& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> class ValueArray8 { public: ValueArray8(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray8& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9> class ValueArray9 { public: ValueArray9(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray9& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10> class ValueArray10 { public: ValueArray10(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray10& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11> class ValueArray11 { public: ValueArray11(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray11& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12> class ValueArray12 { public: ValueArray12(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray12& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13> class ValueArray13 { public: ValueArray13(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray13& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14> class ValueArray14 { public: ValueArray14(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray14& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15> class ValueArray15 { public: ValueArray15(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray15& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16> class ValueArray16 { public: ValueArray16(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray16& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17> class ValueArray17 { public: ValueArray17(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray17& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18> class ValueArray18 { public: ValueArray18(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray18& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19> class ValueArray19 { public: ValueArray19(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_), static_cast<T>(v19_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray19& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20> class ValueArray20 { public: ValueArray20(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray20& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21> class ValueArray21 { public: ValueArray21(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_), static_cast<T>(v21_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray21& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22> class ValueArray22 { public: ValueArray22(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_), static_cast<T>(v21_), static_cast<T>(v22_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray22& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23> class ValueArray23 { public: ValueArray23(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_), static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray23& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24> class ValueArray24 { public: ValueArray24(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_), static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_), static_cast<T>(v24_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray24& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25> class ValueArray25 { public: ValueArray25(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_), static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_), static_cast<T>(v24_), static_cast<T>(v25_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray25& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26> class ValueArray26 { public: ValueArray26(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_), static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_), static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray26& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27> class ValueArray27 { public: ValueArray27(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_), static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_), static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_), static_cast<T>(v27_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray27& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28> class ValueArray28 { public: ValueArray28(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_), static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_), static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_), static_cast<T>(v27_), static_cast<T>(v28_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray28& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29> class ValueArray29 { public: ValueArray29(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_), static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_), static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_), static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray29& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30> class ValueArray30 { public: ValueArray30(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_), static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_), static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_), static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_), static_cast<T>(v30_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray30& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31> class ValueArray31 { public: ValueArray31(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_), static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_), static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_), static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_), static_cast<T>(v30_), static_cast<T>(v31_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray31& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32> class ValueArray32 { public: ValueArray32(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_), static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_), static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_), static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_), static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray32& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33> class ValueArray33 { public: ValueArray33(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_), static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_), static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_), static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_), static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_), static_cast<T>(v33_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray33& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34> class ValueArray34 { public: ValueArray34(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_), static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_), static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_), static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_), static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_), static_cast<T>(v33_), static_cast<T>(v34_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray34& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35> class ValueArray35 { public: ValueArray35(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_), static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_), static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_), static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_), static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_), static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray35& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; const T35 v35_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36> class ValueArray36 { public: ValueArray36(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_), static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_), static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_), static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_), static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_), static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_), static_cast<T>(v36_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray36& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; const T35 v35_; const T36 v36_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37> class ValueArray37 { public: ValueArray37(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_), static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_), static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_), static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_), static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_), static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_), static_cast<T>(v36_), static_cast<T>(v37_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray37& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; const T35 v35_; const T36 v36_; const T37 v37_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38> class ValueArray38 { public: ValueArray38(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_), static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_), static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_), static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_), static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_), static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_), static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray38& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; const T35 v35_; const T36 v36_; const T37 v37_; const T38 v38_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39> class ValueArray39 { public: ValueArray39(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_), static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_), static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_), static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_), static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_), static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_), static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_), static_cast<T>(v39_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray39& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; const T35 v35_; const T36 v36_; const T37 v37_; const T38 v38_; const T39 v39_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40> class ValueArray40 { public: ValueArray40(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_), static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_), static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_), static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_), static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_), static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_), static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_), static_cast<T>(v39_), static_cast<T>(v40_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray40& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; const T35 v35_; const T36 v36_; const T37 v37_; const T38 v38_; const T39 v39_; const T40 v40_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41> class ValueArray41 { public: ValueArray41(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_), static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_), static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_), static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_), static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_), static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_), static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_), static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray41& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; const T35 v35_; const T36 v36_; const T37 v37_; const T38 v38_; const T39 v39_; const T40 v40_; const T41 v41_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42> class ValueArray42 { public: ValueArray42(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_), static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_), static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_), static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_), static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_), static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_), static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_), static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_), static_cast<T>(v42_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray42& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; const T35 v35_; const T36 v36_; const T37 v37_; const T38 v38_; const T39 v39_; const T40 v40_; const T41 v41_; const T42 v42_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42, typename T43> class ValueArray43 { public: ValueArray43(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_), static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_), static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_), static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_), static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_), static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_), static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_), static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_), static_cast<T>(v42_), static_cast<T>(v43_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray43& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; const T35 v35_; const T36 v36_; const T37 v37_; const T38 v38_; const T39 v39_; const T40 v40_; const T41 v41_; const T42 v42_; const T43 v43_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42, typename T43, typename T44> class ValueArray44 { public: ValueArray44(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_), static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_), static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_), static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_), static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_), static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_), static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_), static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_), static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray44& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; const T35 v35_; const T36 v36_; const T37 v37_; const T38 v38_; const T39 v39_; const T40 v40_; const T41 v41_; const T42 v42_; const T43 v43_; const T44 v44_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42, typename T43, typename T44, typename T45> class ValueArray45 { public: ValueArray45(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_), static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_), static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_), static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_), static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_), static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_), static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_), static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_), static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_), static_cast<T>(v45_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray45& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; const T35 v35_; const T36 v36_; const T37 v37_; const T38 v38_; const T39 v39_; const T40 v40_; const T41 v41_; const T42 v42_; const T43 v43_; const T44 v44_; const T45 v45_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42, typename T43, typename T44, typename T45, typename T46> class ValueArray46 { public: ValueArray46(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_), static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_), static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_), static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_), static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_), static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_), static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_), static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_), static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_), static_cast<T>(v45_), static_cast<T>(v46_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray46& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; const T35 v35_; const T36 v36_; const T37 v37_; const T38 v38_; const T39 v39_; const T40 v40_; const T41 v41_; const T42 v42_; const T43 v43_; const T44 v44_; const T45 v45_; const T46 v46_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42, typename T43, typename T44, typename T45, typename T46, typename T47> class ValueArray47 { public: ValueArray47(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46), v47_(v47) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_), static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_), static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_), static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_), static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_), static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_), static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_), static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_), static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_), static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray47& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; const T35 v35_; const T36 v36_; const T37 v37_; const T38 v38_; const T39 v39_; const T40 v40_; const T41 v41_; const T42 v42_; const T43 v43_; const T44 v44_; const T45 v45_; const T46 v46_; const T47 v47_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42, typename T43, typename T44, typename T45, typename T46, typename T47, typename T48> class ValueArray48 { public: ValueArray48(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46), v47_(v47), v48_(v48) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_), static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_), static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_), static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_), static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_), static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_), static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_), static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_), static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_), static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_), static_cast<T>(v48_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray48& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; const T35 v35_; const T36 v36_; const T37 v37_; const T38 v38_; const T39 v39_; const T40 v40_; const T41 v41_; const T42 v42_; const T43 v43_; const T44 v44_; const T45 v45_; const T46 v46_; const T47 v47_; const T48 v48_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42, typename T43, typename T44, typename T45, typename T46, typename T47, typename T48, typename T49> class ValueArray49 { public: ValueArray49(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48, T49 v49) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46), v47_(v47), v48_(v48), v49_(v49) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_), static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_), static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_), static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_), static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_), static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_), static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_), static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_), static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_), static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_), static_cast<T>(v48_), static_cast<T>(v49_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray49& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; const T35 v35_; const T36 v36_; const T37 v37_; const T38 v38_; const T39 v39_; const T40 v40_; const T41 v41_; const T42 v42_; const T43 v43_; const T44 v44_; const T45 v45_; const T46 v46_; const T47 v47_; const T48 v48_; const T49 v49_; }; template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42, typename T43, typename T44, typename T45, typename T46, typename T47, typename T48, typename T49, typename T50> class ValueArray50 { public: ValueArray50(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48, T49 v49, T50 v50) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22), v23_(v23), v24_(v24), v25_(v25), v26_(v26), v27_(v27), v28_(v28), v29_(v29), v30_(v30), v31_(v31), v32_(v32), v33_(v33), v34_(v34), v35_(v35), v36_(v36), v37_(v37), v38_(v38), v39_(v39), v40_(v40), v41_(v41), v42_(v42), v43_(v43), v44_(v44), v45_(v45), v46_(v46), v47_(v47), v48_(v48), v49_(v49), v50_(v50) {} template <typename T> operator ParamGenerator<T>() const { const T array[] = {static_cast<T>(v1_), static_cast<T>(v2_), static_cast<T>(v3_), static_cast<T>(v4_), static_cast<T>(v5_), static_cast<T>(v6_), static_cast<T>(v7_), static_cast<T>(v8_), static_cast<T>(v9_), static_cast<T>(v10_), static_cast<T>(v11_), static_cast<T>(v12_), static_cast<T>(v13_), static_cast<T>(v14_), static_cast<T>(v15_), static_cast<T>(v16_), static_cast<T>(v17_), static_cast<T>(v18_), static_cast<T>(v19_), static_cast<T>(v20_), static_cast<T>(v21_), static_cast<T>(v22_), static_cast<T>(v23_), static_cast<T>(v24_), static_cast<T>(v25_), static_cast<T>(v26_), static_cast<T>(v27_), static_cast<T>(v28_), static_cast<T>(v29_), static_cast<T>(v30_), static_cast<T>(v31_), static_cast<T>(v32_), static_cast<T>(v33_), static_cast<T>(v34_), static_cast<T>(v35_), static_cast<T>(v36_), static_cast<T>(v37_), static_cast<T>(v38_), static_cast<T>(v39_), static_cast<T>(v40_), static_cast<T>(v41_), static_cast<T>(v42_), static_cast<T>(v43_), static_cast<T>(v44_), static_cast<T>(v45_), static_cast<T>(v46_), static_cast<T>(v47_), static_cast<T>(v48_), static_cast<T>(v49_), static_cast<T>(v50_)}; return ValuesIn(array); } private: // No implementation - assignment is unsupported. void operator=(const ValueArray50& other); const T1 v1_; const T2 v2_; const T3 v3_; const T4 v4_; const T5 v5_; const T6 v6_; const T7 v7_; const T8 v8_; const T9 v9_; const T10 v10_; const T11 v11_; const T12 v12_; const T13 v13_; const T14 v14_; const T15 v15_; const T16 v16_; const T17 v17_; const T18 v18_; const T19 v19_; const T20 v20_; const T21 v21_; const T22 v22_; const T23 v23_; const T24 v24_; const T25 v25_; const T26 v26_; const T27 v27_; const T28 v28_; const T29 v29_; const T30 v30_; const T31 v31_; const T32 v32_; const T33 v33_; const T34 v34_; const T35 v35_; const T36 v36_; const T37 v37_; const T38 v38_; const T39 v39_; const T40 v40_; const T41 v41_; const T42 v42_; const T43 v43_; const T44 v44_; const T45 v45_; const T46 v46_; const T47 v47_; const T48 v48_; const T49 v49_; const T50 v50_; }; # if GTEST_HAS_COMBINE // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // Generates values from the Cartesian product of values produced // by the argument generators. // template <typename T1, typename T2> class CartesianProductGenerator2 : public ParamGeneratorInterface< ::testing::tuple<T1, T2> > { public: typedef ::testing::tuple<T1, T2> ParamType; CartesianProductGenerator2(const ParamGenerator<T1>& g1, const ParamGenerator<T2>& g2) : g1_(g1), g2_(g2) {} virtual ~CartesianProductGenerator2() {} virtual ParamIteratorInterface<ParamType>* Begin() const { return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin()); } virtual ParamIteratorInterface<ParamType>* End() const { return new Iterator(this, g1_, g1_.end(), g2_, g2_.end()); } private: class Iterator : public ParamIteratorInterface<ParamType> { public: Iterator(const ParamGeneratorInterface<ParamType>* base, const ParamGenerator<T1>& g1, const typename ParamGenerator<T1>::iterator& current1, const ParamGenerator<T2>& g2, const typename ParamGenerator<T2>::iterator& current2) : base_(base), begin1_(g1.begin()), end1_(g1.end()), current1_(current1), begin2_(g2.begin()), end2_(g2.end()), current2_(current2) { ComputeCurrentValue(); } virtual ~Iterator() {} virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const { return base_; } // Advance should not be called on beyond-of-range iterators // so no component iterators must be beyond end of range, either. virtual void Advance() { assert(!AtEnd()); ++current2_; if (current2_ == end2_) { current2_ = begin2_; ++current1_; } ComputeCurrentValue(); } virtual ParamIteratorInterface<ParamType>* Clone() const { return new Iterator(*this); } virtual const ParamType* Current() const { return &current_value_; } virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) << "The program attempted to compare iterators " << "from different generators." << std::endl; const Iterator* typed_other = CheckedDowncastToActualType<const Iterator>(&other); // We must report iterators equal if they both point beyond their // respective ranges. That can happen in a variety of fashions, // so we have to consult AtEnd(). return (AtEnd() && typed_other->AtEnd()) || ( current1_ == typed_other->current1_ && current2_ == typed_other->current2_); } private: Iterator(const Iterator& other) : base_(other.base_), begin1_(other.begin1_), end1_(other.end1_), current1_(other.current1_), begin2_(other.begin2_), end2_(other.end2_), current2_(other.current2_) { ComputeCurrentValue(); } void ComputeCurrentValue() { if (!AtEnd()) current_value_ = ParamType(*current1_, *current2_); } bool AtEnd() const { // We must report iterator past the end of the range when either of the // component iterators has reached the end of its range. return current1_ == end1_ || current2_ == end2_; } // No implementation - assignment is unsupported. void operator=(const Iterator& other); const ParamGeneratorInterface<ParamType>* const base_; // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. // current[i]_ is the actual traversing iterator. const typename ParamGenerator<T1>::iterator begin1_; const typename ParamGenerator<T1>::iterator end1_; typename ParamGenerator<T1>::iterator current1_; const typename ParamGenerator<T2>::iterator begin2_; const typename ParamGenerator<T2>::iterator end2_; typename ParamGenerator<T2>::iterator current2_; ParamType current_value_; }; // class CartesianProductGenerator2::Iterator // No implementation - assignment is unsupported. void operator=(const CartesianProductGenerator2& other); const ParamGenerator<T1> g1_; const ParamGenerator<T2> g2_; }; // class CartesianProductGenerator2 template <typename T1, typename T2, typename T3> class CartesianProductGenerator3 : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3> > { public: typedef ::testing::tuple<T1, T2, T3> ParamType; CartesianProductGenerator3(const ParamGenerator<T1>& g1, const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3) : g1_(g1), g2_(g2), g3_(g3) {} virtual ~CartesianProductGenerator3() {} virtual ParamIteratorInterface<ParamType>* Begin() const { return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_, g3_.begin()); } virtual ParamIteratorInterface<ParamType>* End() const { return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end()); } private: class Iterator : public ParamIteratorInterface<ParamType> { public: Iterator(const ParamGeneratorInterface<ParamType>* base, const ParamGenerator<T1>& g1, const typename ParamGenerator<T1>::iterator& current1, const ParamGenerator<T2>& g2, const typename ParamGenerator<T2>::iterator& current2, const ParamGenerator<T3>& g3, const typename ParamGenerator<T3>::iterator& current3) : base_(base), begin1_(g1.begin()), end1_(g1.end()), current1_(current1), begin2_(g2.begin()), end2_(g2.end()), current2_(current2), begin3_(g3.begin()), end3_(g3.end()), current3_(current3) { ComputeCurrentValue(); } virtual ~Iterator() {} virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const { return base_; } // Advance should not be called on beyond-of-range iterators // so no component iterators must be beyond end of range, either. virtual void Advance() { assert(!AtEnd()); ++current3_; if (current3_ == end3_) { current3_ = begin3_; ++current2_; } if (current2_ == end2_) { current2_ = begin2_; ++current1_; } ComputeCurrentValue(); } virtual ParamIteratorInterface<ParamType>* Clone() const { return new Iterator(*this); } virtual const ParamType* Current() const { return &current_value_; } virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) << "The program attempted to compare iterators " << "from different generators." << std::endl; const Iterator* typed_other = CheckedDowncastToActualType<const Iterator>(&other); // We must report iterators equal if they both point beyond their // respective ranges. That can happen in a variety of fashions, // so we have to consult AtEnd(). return (AtEnd() && typed_other->AtEnd()) || ( current1_ == typed_other->current1_ && current2_ == typed_other->current2_ && current3_ == typed_other->current3_); } private: Iterator(const Iterator& other) : base_(other.base_), begin1_(other.begin1_), end1_(other.end1_), current1_(other.current1_), begin2_(other.begin2_), end2_(other.end2_), current2_(other.current2_), begin3_(other.begin3_), end3_(other.end3_), current3_(other.current3_) { ComputeCurrentValue(); } void ComputeCurrentValue() { if (!AtEnd()) current_value_ = ParamType(*current1_, *current2_, *current3_); } bool AtEnd() const { // We must report iterator past the end of the range when either of the // component iterators has reached the end of its range. return current1_ == end1_ || current2_ == end2_ || current3_ == end3_; } // No implementation - assignment is unsupported. void operator=(const Iterator& other); const ParamGeneratorInterface<ParamType>* const base_; // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. // current[i]_ is the actual traversing iterator. const typename ParamGenerator<T1>::iterator begin1_; const typename ParamGenerator<T1>::iterator end1_; typename ParamGenerator<T1>::iterator current1_; const typename ParamGenerator<T2>::iterator begin2_; const typename ParamGenerator<T2>::iterator end2_; typename ParamGenerator<T2>::iterator current2_; const typename ParamGenerator<T3>::iterator begin3_; const typename ParamGenerator<T3>::iterator end3_; typename ParamGenerator<T3>::iterator current3_; ParamType current_value_; }; // class CartesianProductGenerator3::Iterator // No implementation - assignment is unsupported. void operator=(const CartesianProductGenerator3& other); const ParamGenerator<T1> g1_; const ParamGenerator<T2> g2_; const ParamGenerator<T3> g3_; }; // class CartesianProductGenerator3 template <typename T1, typename T2, typename T3, typename T4> class CartesianProductGenerator4 : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4> > { public: typedef ::testing::tuple<T1, T2, T3, T4> ParamType; CartesianProductGenerator4(const ParamGenerator<T1>& g1, const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3, const ParamGenerator<T4>& g4) : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {} virtual ~CartesianProductGenerator4() {} virtual ParamIteratorInterface<ParamType>* Begin() const { return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_, g3_.begin(), g4_, g4_.begin()); } virtual ParamIteratorInterface<ParamType>* End() const { return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(), g4_, g4_.end()); } private: class Iterator : public ParamIteratorInterface<ParamType> { public: Iterator(const ParamGeneratorInterface<ParamType>* base, const ParamGenerator<T1>& g1, const typename ParamGenerator<T1>::iterator& current1, const ParamGenerator<T2>& g2, const typename ParamGenerator<T2>::iterator& current2, const ParamGenerator<T3>& g3, const typename ParamGenerator<T3>::iterator& current3, const ParamGenerator<T4>& g4, const typename ParamGenerator<T4>::iterator& current4) : base_(base), begin1_(g1.begin()), end1_(g1.end()), current1_(current1), begin2_(g2.begin()), end2_(g2.end()), current2_(current2), begin3_(g3.begin()), end3_(g3.end()), current3_(current3), begin4_(g4.begin()), end4_(g4.end()), current4_(current4) { ComputeCurrentValue(); } virtual ~Iterator() {} virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const { return base_; } // Advance should not be called on beyond-of-range iterators // so no component iterators must be beyond end of range, either. virtual void Advance() { assert(!AtEnd()); ++current4_; if (current4_ == end4_) { current4_ = begin4_; ++current3_; } if (current3_ == end3_) { current3_ = begin3_; ++current2_; } if (current2_ == end2_) { current2_ = begin2_; ++current1_; } ComputeCurrentValue(); } virtual ParamIteratorInterface<ParamType>* Clone() const { return new Iterator(*this); } virtual const ParamType* Current() const { return &current_value_; } virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) << "The program attempted to compare iterators " << "from different generators." << std::endl; const Iterator* typed_other = CheckedDowncastToActualType<const Iterator>(&other); // We must report iterators equal if they both point beyond their // respective ranges. That can happen in a variety of fashions, // so we have to consult AtEnd(). return (AtEnd() && typed_other->AtEnd()) || ( current1_ == typed_other->current1_ && current2_ == typed_other->current2_ && current3_ == typed_other->current3_ && current4_ == typed_other->current4_); } private: Iterator(const Iterator& other) : base_(other.base_), begin1_(other.begin1_), end1_(other.end1_), current1_(other.current1_), begin2_(other.begin2_), end2_(other.end2_), current2_(other.current2_), begin3_(other.begin3_), end3_(other.end3_), current3_(other.current3_), begin4_(other.begin4_), end4_(other.end4_), current4_(other.current4_) { ComputeCurrentValue(); } void ComputeCurrentValue() { if (!AtEnd()) current_value_ = ParamType(*current1_, *current2_, *current3_, *current4_); } bool AtEnd() const { // We must report iterator past the end of the range when either of the // component iterators has reached the end of its range. return current1_ == end1_ || current2_ == end2_ || current3_ == end3_ || current4_ == end4_; } // No implementation - assignment is unsupported. void operator=(const Iterator& other); const ParamGeneratorInterface<ParamType>* const base_; // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. // current[i]_ is the actual traversing iterator. const typename ParamGenerator<T1>::iterator begin1_; const typename ParamGenerator<T1>::iterator end1_; typename ParamGenerator<T1>::iterator current1_; const typename ParamGenerator<T2>::iterator begin2_; const typename ParamGenerator<T2>::iterator end2_; typename ParamGenerator<T2>::iterator current2_; const typename ParamGenerator<T3>::iterator begin3_; const typename ParamGenerator<T3>::iterator end3_; typename ParamGenerator<T3>::iterator current3_; const typename ParamGenerator<T4>::iterator begin4_; const typename ParamGenerator<T4>::iterator end4_; typename ParamGenerator<T4>::iterator current4_; ParamType current_value_; }; // class CartesianProductGenerator4::Iterator // No implementation - assignment is unsupported. void operator=(const CartesianProductGenerator4& other); const ParamGenerator<T1> g1_; const ParamGenerator<T2> g2_; const ParamGenerator<T3> g3_; const ParamGenerator<T4> g4_; }; // class CartesianProductGenerator4 template <typename T1, typename T2, typename T3, typename T4, typename T5> class CartesianProductGenerator5 : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5> > { public: typedef ::testing::tuple<T1, T2, T3, T4, T5> ParamType; CartesianProductGenerator5(const ParamGenerator<T1>& g1, const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3, const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5) : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {} virtual ~CartesianProductGenerator5() {} virtual ParamIteratorInterface<ParamType>* Begin() const { return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_, g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin()); } virtual ParamIteratorInterface<ParamType>* End() const { return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(), g4_, g4_.end(), g5_, g5_.end()); } private: class Iterator : public ParamIteratorInterface<ParamType> { public: Iterator(const ParamGeneratorInterface<ParamType>* base, const ParamGenerator<T1>& g1, const typename ParamGenerator<T1>::iterator& current1, const ParamGenerator<T2>& g2, const typename ParamGenerator<T2>::iterator& current2, const ParamGenerator<T3>& g3, const typename ParamGenerator<T3>::iterator& current3, const ParamGenerator<T4>& g4, const typename ParamGenerator<T4>::iterator& current4, const ParamGenerator<T5>& g5, const typename ParamGenerator<T5>::iterator& current5) : base_(base), begin1_(g1.begin()), end1_(g1.end()), current1_(current1), begin2_(g2.begin()), end2_(g2.end()), current2_(current2), begin3_(g3.begin()), end3_(g3.end()), current3_(current3), begin4_(g4.begin()), end4_(g4.end()), current4_(current4), begin5_(g5.begin()), end5_(g5.end()), current5_(current5) { ComputeCurrentValue(); } virtual ~Iterator() {} virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const { return base_; } // Advance should not be called on beyond-of-range iterators // so no component iterators must be beyond end of range, either. virtual void Advance() { assert(!AtEnd()); ++current5_; if (current5_ == end5_) { current5_ = begin5_; ++current4_; } if (current4_ == end4_) { current4_ = begin4_; ++current3_; } if (current3_ == end3_) { current3_ = begin3_; ++current2_; } if (current2_ == end2_) { current2_ = begin2_; ++current1_; } ComputeCurrentValue(); } virtual ParamIteratorInterface<ParamType>* Clone() const { return new Iterator(*this); } virtual const ParamType* Current() const { return &current_value_; } virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) << "The program attempted to compare iterators " << "from different generators." << std::endl; const Iterator* typed_other = CheckedDowncastToActualType<const Iterator>(&other); // We must report iterators equal if they both point beyond their // respective ranges. That can happen in a variety of fashions, // so we have to consult AtEnd(). return (AtEnd() && typed_other->AtEnd()) || ( current1_ == typed_other->current1_ && current2_ == typed_other->current2_ && current3_ == typed_other->current3_ && current4_ == typed_other->current4_ && current5_ == typed_other->current5_); } private: Iterator(const Iterator& other) : base_(other.base_), begin1_(other.begin1_), end1_(other.end1_), current1_(other.current1_), begin2_(other.begin2_), end2_(other.end2_), current2_(other.current2_), begin3_(other.begin3_), end3_(other.end3_), current3_(other.current3_), begin4_(other.begin4_), end4_(other.end4_), current4_(other.current4_), begin5_(other.begin5_), end5_(other.end5_), current5_(other.current5_) { ComputeCurrentValue(); } void ComputeCurrentValue() { if (!AtEnd()) current_value_ = ParamType(*current1_, *current2_, *current3_, *current4_, *current5_); } bool AtEnd() const { // We must report iterator past the end of the range when either of the // component iterators has reached the end of its range. return current1_ == end1_ || current2_ == end2_ || current3_ == end3_ || current4_ == end4_ || current5_ == end5_; } // No implementation - assignment is unsupported. void operator=(const Iterator& other); const ParamGeneratorInterface<ParamType>* const base_; // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. // current[i]_ is the actual traversing iterator. const typename ParamGenerator<T1>::iterator begin1_; const typename ParamGenerator<T1>::iterator end1_; typename ParamGenerator<T1>::iterator current1_; const typename ParamGenerator<T2>::iterator begin2_; const typename ParamGenerator<T2>::iterator end2_; typename ParamGenerator<T2>::iterator current2_; const typename ParamGenerator<T3>::iterator begin3_; const typename ParamGenerator<T3>::iterator end3_; typename ParamGenerator<T3>::iterator current3_; const typename ParamGenerator<T4>::iterator begin4_; const typename ParamGenerator<T4>::iterator end4_; typename ParamGenerator<T4>::iterator current4_; const typename ParamGenerator<T5>::iterator begin5_; const typename ParamGenerator<T5>::iterator end5_; typename ParamGenerator<T5>::iterator current5_; ParamType current_value_; }; // class CartesianProductGenerator5::Iterator // No implementation - assignment is unsupported. void operator=(const CartesianProductGenerator5& other); const ParamGenerator<T1> g1_; const ParamGenerator<T2> g2_; const ParamGenerator<T3> g3_; const ParamGenerator<T4> g4_; const ParamGenerator<T5> g5_; }; // class CartesianProductGenerator5 template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> class CartesianProductGenerator6 : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5, T6> > { public: typedef ::testing::tuple<T1, T2, T3, T4, T5, T6> ParamType; CartesianProductGenerator6(const ParamGenerator<T1>& g1, const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3, const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5, const ParamGenerator<T6>& g6) : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {} virtual ~CartesianProductGenerator6() {} virtual ParamIteratorInterface<ParamType>* Begin() const { return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_, g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin()); } virtual ParamIteratorInterface<ParamType>* End() const { return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(), g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end()); } private: class Iterator : public ParamIteratorInterface<ParamType> { public: Iterator(const ParamGeneratorInterface<ParamType>* base, const ParamGenerator<T1>& g1, const typename ParamGenerator<T1>::iterator& current1, const ParamGenerator<T2>& g2, const typename ParamGenerator<T2>::iterator& current2, const ParamGenerator<T3>& g3, const typename ParamGenerator<T3>::iterator& current3, const ParamGenerator<T4>& g4, const typename ParamGenerator<T4>::iterator& current4, const ParamGenerator<T5>& g5, const typename ParamGenerator<T5>::iterator& current5, const ParamGenerator<T6>& g6, const typename ParamGenerator<T6>::iterator& current6) : base_(base), begin1_(g1.begin()), end1_(g1.end()), current1_(current1), begin2_(g2.begin()), end2_(g2.end()), current2_(current2), begin3_(g3.begin()), end3_(g3.end()), current3_(current3), begin4_(g4.begin()), end4_(g4.end()), current4_(current4), begin5_(g5.begin()), end5_(g5.end()), current5_(current5), begin6_(g6.begin()), end6_(g6.end()), current6_(current6) { ComputeCurrentValue(); } virtual ~Iterator() {} virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const { return base_; } // Advance should not be called on beyond-of-range iterators // so no component iterators must be beyond end of range, either. virtual void Advance() { assert(!AtEnd()); ++current6_; if (current6_ == end6_) { current6_ = begin6_; ++current5_; } if (current5_ == end5_) { current5_ = begin5_; ++current4_; } if (current4_ == end4_) { current4_ = begin4_; ++current3_; } if (current3_ == end3_) { current3_ = begin3_; ++current2_; } if (current2_ == end2_) { current2_ = begin2_; ++current1_; } ComputeCurrentValue(); } virtual ParamIteratorInterface<ParamType>* Clone() const { return new Iterator(*this); } virtual const ParamType* Current() const { return &current_value_; } virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) << "The program attempted to compare iterators " << "from different generators." << std::endl; const Iterator* typed_other = CheckedDowncastToActualType<const Iterator>(&other); // We must report iterators equal if they both point beyond their // respective ranges. That can happen in a variety of fashions, // so we have to consult AtEnd(). return (AtEnd() && typed_other->AtEnd()) || ( current1_ == typed_other->current1_ && current2_ == typed_other->current2_ && current3_ == typed_other->current3_ && current4_ == typed_other->current4_ && current5_ == typed_other->current5_ && current6_ == typed_other->current6_); } private: Iterator(const Iterator& other) : base_(other.base_), begin1_(other.begin1_), end1_(other.end1_), current1_(other.current1_), begin2_(other.begin2_), end2_(other.end2_), current2_(other.current2_), begin3_(other.begin3_), end3_(other.end3_), current3_(other.current3_), begin4_(other.begin4_), end4_(other.end4_), current4_(other.current4_), begin5_(other.begin5_), end5_(other.end5_), current5_(other.current5_), begin6_(other.begin6_), end6_(other.end6_), current6_(other.current6_) { ComputeCurrentValue(); } void ComputeCurrentValue() { if (!AtEnd()) current_value_ = ParamType(*current1_, *current2_, *current3_, *current4_, *current5_, *current6_); } bool AtEnd() const { // We must report iterator past the end of the range when either of the // component iterators has reached the end of its range. return current1_ == end1_ || current2_ == end2_ || current3_ == end3_ || current4_ == end4_ || current5_ == end5_ || current6_ == end6_; } // No implementation - assignment is unsupported. void operator=(const Iterator& other); const ParamGeneratorInterface<ParamType>* const base_; // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. // current[i]_ is the actual traversing iterator. const typename ParamGenerator<T1>::iterator begin1_; const typename ParamGenerator<T1>::iterator end1_; typename ParamGenerator<T1>::iterator current1_; const typename ParamGenerator<T2>::iterator begin2_; const typename ParamGenerator<T2>::iterator end2_; typename ParamGenerator<T2>::iterator current2_; const typename ParamGenerator<T3>::iterator begin3_; const typename ParamGenerator<T3>::iterator end3_; typename ParamGenerator<T3>::iterator current3_; const typename ParamGenerator<T4>::iterator begin4_; const typename ParamGenerator<T4>::iterator end4_; typename ParamGenerator<T4>::iterator current4_; const typename ParamGenerator<T5>::iterator begin5_; const typename ParamGenerator<T5>::iterator end5_; typename ParamGenerator<T5>::iterator current5_; const typename ParamGenerator<T6>::iterator begin6_; const typename ParamGenerator<T6>::iterator end6_; typename ParamGenerator<T6>::iterator current6_; ParamType current_value_; }; // class CartesianProductGenerator6::Iterator // No implementation - assignment is unsupported. void operator=(const CartesianProductGenerator6& other); const ParamGenerator<T1> g1_; const ParamGenerator<T2> g2_; const ParamGenerator<T3> g3_; const ParamGenerator<T4> g4_; const ParamGenerator<T5> g5_; const ParamGenerator<T6> g6_; }; // class CartesianProductGenerator6 template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> class CartesianProductGenerator7 : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7> > { public: typedef ::testing::tuple<T1, T2, T3, T4, T5, T6, T7> ParamType; CartesianProductGenerator7(const ParamGenerator<T1>& g1, const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3, const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5, const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7) : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {} virtual ~CartesianProductGenerator7() {} virtual ParamIteratorInterface<ParamType>* Begin() const { return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_, g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_, g7_.begin()); } virtual ParamIteratorInterface<ParamType>* End() const { return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(), g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end()); } private: class Iterator : public ParamIteratorInterface<ParamType> { public: Iterator(const ParamGeneratorInterface<ParamType>* base, const ParamGenerator<T1>& g1, const typename ParamGenerator<T1>::iterator& current1, const ParamGenerator<T2>& g2, const typename ParamGenerator<T2>::iterator& current2, const ParamGenerator<T3>& g3, const typename ParamGenerator<T3>::iterator& current3, const ParamGenerator<T4>& g4, const typename ParamGenerator<T4>::iterator& current4, const ParamGenerator<T5>& g5, const typename ParamGenerator<T5>::iterator& current5, const ParamGenerator<T6>& g6, const typename ParamGenerator<T6>::iterator& current6, const ParamGenerator<T7>& g7, const typename ParamGenerator<T7>::iterator& current7) : base_(base), begin1_(g1.begin()), end1_(g1.end()), current1_(current1), begin2_(g2.begin()), end2_(g2.end()), current2_(current2), begin3_(g3.begin()), end3_(g3.end()), current3_(current3), begin4_(g4.begin()), end4_(g4.end()), current4_(current4), begin5_(g5.begin()), end5_(g5.end()), current5_(current5), begin6_(g6.begin()), end6_(g6.end()), current6_(current6), begin7_(g7.begin()), end7_(g7.end()), current7_(current7) { ComputeCurrentValue(); } virtual ~Iterator() {} virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const { return base_; } // Advance should not be called on beyond-of-range iterators // so no component iterators must be beyond end of range, either. virtual void Advance() { assert(!AtEnd()); ++current7_; if (current7_ == end7_) { current7_ = begin7_; ++current6_; } if (current6_ == end6_) { current6_ = begin6_; ++current5_; } if (current5_ == end5_) { current5_ = begin5_; ++current4_; } if (current4_ == end4_) { current4_ = begin4_; ++current3_; } if (current3_ == end3_) { current3_ = begin3_; ++current2_; } if (current2_ == end2_) { current2_ = begin2_; ++current1_; } ComputeCurrentValue(); } virtual ParamIteratorInterface<ParamType>* Clone() const { return new Iterator(*this); } virtual const ParamType* Current() const { return &current_value_; } virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) << "The program attempted to compare iterators " << "from different generators." << std::endl; const Iterator* typed_other = CheckedDowncastToActualType<const Iterator>(&other); // We must report iterators equal if they both point beyond their // respective ranges. That can happen in a variety of fashions, // so we have to consult AtEnd(). return (AtEnd() && typed_other->AtEnd()) || ( current1_ == typed_other->current1_ && current2_ == typed_other->current2_ && current3_ == typed_other->current3_ && current4_ == typed_other->current4_ && current5_ == typed_other->current5_ && current6_ == typed_other->current6_ && current7_ == typed_other->current7_); } private: Iterator(const Iterator& other) : base_(other.base_), begin1_(other.begin1_), end1_(other.end1_), current1_(other.current1_), begin2_(other.begin2_), end2_(other.end2_), current2_(other.current2_), begin3_(other.begin3_), end3_(other.end3_), current3_(other.current3_), begin4_(other.begin4_), end4_(other.end4_), current4_(other.current4_), begin5_(other.begin5_), end5_(other.end5_), current5_(other.current5_), begin6_(other.begin6_), end6_(other.end6_), current6_(other.current6_), begin7_(other.begin7_), end7_(other.end7_), current7_(other.current7_) { ComputeCurrentValue(); } void ComputeCurrentValue() { if (!AtEnd()) current_value_ = ParamType(*current1_, *current2_, *current3_, *current4_, *current5_, *current6_, *current7_); } bool AtEnd() const { // We must report iterator past the end of the range when either of the // component iterators has reached the end of its range. return current1_ == end1_ || current2_ == end2_ || current3_ == end3_ || current4_ == end4_ || current5_ == end5_ || current6_ == end6_ || current7_ == end7_; } // No implementation - assignment is unsupported. void operator=(const Iterator& other); const ParamGeneratorInterface<ParamType>* const base_; // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. // current[i]_ is the actual traversing iterator. const typename ParamGenerator<T1>::iterator begin1_; const typename ParamGenerator<T1>::iterator end1_; typename ParamGenerator<T1>::iterator current1_; const typename ParamGenerator<T2>::iterator begin2_; const typename ParamGenerator<T2>::iterator end2_; typename ParamGenerator<T2>::iterator current2_; const typename ParamGenerator<T3>::iterator begin3_; const typename ParamGenerator<T3>::iterator end3_; typename ParamGenerator<T3>::iterator current3_; const typename ParamGenerator<T4>::iterator begin4_; const typename ParamGenerator<T4>::iterator end4_; typename ParamGenerator<T4>::iterator current4_; const typename ParamGenerator<T5>::iterator begin5_; const typename ParamGenerator<T5>::iterator end5_; typename ParamGenerator<T5>::iterator current5_; const typename ParamGenerator<T6>::iterator begin6_; const typename ParamGenerator<T6>::iterator end6_; typename ParamGenerator<T6>::iterator current6_; const typename ParamGenerator<T7>::iterator begin7_; const typename ParamGenerator<T7>::iterator end7_; typename ParamGenerator<T7>::iterator current7_; ParamType current_value_; }; // class CartesianProductGenerator7::Iterator // No implementation - assignment is unsupported. void operator=(const CartesianProductGenerator7& other); const ParamGenerator<T1> g1_; const ParamGenerator<T2> g2_; const ParamGenerator<T3> g3_; const ParamGenerator<T4> g4_; const ParamGenerator<T5> g5_; const ParamGenerator<T6> g6_; const ParamGenerator<T7> g7_; }; // class CartesianProductGenerator7 template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> class CartesianProductGenerator8 : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8> > { public: typedef ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8> ParamType; CartesianProductGenerator8(const ParamGenerator<T1>& g1, const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3, const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5, const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7, const ParamGenerator<T8>& g8) : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8) {} virtual ~CartesianProductGenerator8() {} virtual ParamIteratorInterface<ParamType>* Begin() const { return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_, g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_, g7_.begin(), g8_, g8_.begin()); } virtual ParamIteratorInterface<ParamType>* End() const { return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(), g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_, g8_.end()); } private: class Iterator : public ParamIteratorInterface<ParamType> { public: Iterator(const ParamGeneratorInterface<ParamType>* base, const ParamGenerator<T1>& g1, const typename ParamGenerator<T1>::iterator& current1, const ParamGenerator<T2>& g2, const typename ParamGenerator<T2>::iterator& current2, const ParamGenerator<T3>& g3, const typename ParamGenerator<T3>::iterator& current3, const ParamGenerator<T4>& g4, const typename ParamGenerator<T4>::iterator& current4, const ParamGenerator<T5>& g5, const typename ParamGenerator<T5>::iterator& current5, const ParamGenerator<T6>& g6, const typename ParamGenerator<T6>::iterator& current6, const ParamGenerator<T7>& g7, const typename ParamGenerator<T7>::iterator& current7, const ParamGenerator<T8>& g8, const typename ParamGenerator<T8>::iterator& current8) : base_(base), begin1_(g1.begin()), end1_(g1.end()), current1_(current1), begin2_(g2.begin()), end2_(g2.end()), current2_(current2), begin3_(g3.begin()), end3_(g3.end()), current3_(current3), begin4_(g4.begin()), end4_(g4.end()), current4_(current4), begin5_(g5.begin()), end5_(g5.end()), current5_(current5), begin6_(g6.begin()), end6_(g6.end()), current6_(current6), begin7_(g7.begin()), end7_(g7.end()), current7_(current7), begin8_(g8.begin()), end8_(g8.end()), current8_(current8) { ComputeCurrentValue(); } virtual ~Iterator() {} virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const { return base_; } // Advance should not be called on beyond-of-range iterators // so no component iterators must be beyond end of range, either. virtual void Advance() { assert(!AtEnd()); ++current8_; if (current8_ == end8_) { current8_ = begin8_; ++current7_; } if (current7_ == end7_) { current7_ = begin7_; ++current6_; } if (current6_ == end6_) { current6_ = begin6_; ++current5_; } if (current5_ == end5_) { current5_ = begin5_; ++current4_; } if (current4_ == end4_) { current4_ = begin4_; ++current3_; } if (current3_ == end3_) { current3_ = begin3_; ++current2_; } if (current2_ == end2_) { current2_ = begin2_; ++current1_; } ComputeCurrentValue(); } virtual ParamIteratorInterface<ParamType>* Clone() const { return new Iterator(*this); } virtual const ParamType* Current() const { return &current_value_; } virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) << "The program attempted to compare iterators " << "from different generators." << std::endl; const Iterator* typed_other = CheckedDowncastToActualType<const Iterator>(&other); // We must report iterators equal if they both point beyond their // respective ranges. That can happen in a variety of fashions, // so we have to consult AtEnd(). return (AtEnd() && typed_other->AtEnd()) || ( current1_ == typed_other->current1_ && current2_ == typed_other->current2_ && current3_ == typed_other->current3_ && current4_ == typed_other->current4_ && current5_ == typed_other->current5_ && current6_ == typed_other->current6_ && current7_ == typed_other->current7_ && current8_ == typed_other->current8_); } private: Iterator(const Iterator& other) : base_(other.base_), begin1_(other.begin1_), end1_(other.end1_), current1_(other.current1_), begin2_(other.begin2_), end2_(other.end2_), current2_(other.current2_), begin3_(other.begin3_), end3_(other.end3_), current3_(other.current3_), begin4_(other.begin4_), end4_(other.end4_), current4_(other.current4_), begin5_(other.begin5_), end5_(other.end5_), current5_(other.current5_), begin6_(other.begin6_), end6_(other.end6_), current6_(other.current6_), begin7_(other.begin7_), end7_(other.end7_), current7_(other.current7_), begin8_(other.begin8_), end8_(other.end8_), current8_(other.current8_) { ComputeCurrentValue(); } void ComputeCurrentValue() { if (!AtEnd()) current_value_ = ParamType(*current1_, *current2_, *current3_, *current4_, *current5_, *current6_, *current7_, *current8_); } bool AtEnd() const { // We must report iterator past the end of the range when either of the // component iterators has reached the end of its range. return current1_ == end1_ || current2_ == end2_ || current3_ == end3_ || current4_ == end4_ || current5_ == end5_ || current6_ == end6_ || current7_ == end7_ || current8_ == end8_; } // No implementation - assignment is unsupported. void operator=(const Iterator& other); const ParamGeneratorInterface<ParamType>* const base_; // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. // current[i]_ is the actual traversing iterator. const typename ParamGenerator<T1>::iterator begin1_; const typename ParamGenerator<T1>::iterator end1_; typename ParamGenerator<T1>::iterator current1_; const typename ParamGenerator<T2>::iterator begin2_; const typename ParamGenerator<T2>::iterator end2_; typename ParamGenerator<T2>::iterator current2_; const typename ParamGenerator<T3>::iterator begin3_; const typename ParamGenerator<T3>::iterator end3_; typename ParamGenerator<T3>::iterator current3_; const typename ParamGenerator<T4>::iterator begin4_; const typename ParamGenerator<T4>::iterator end4_; typename ParamGenerator<T4>::iterator current4_; const typename ParamGenerator<T5>::iterator begin5_; const typename ParamGenerator<T5>::iterator end5_; typename ParamGenerator<T5>::iterator current5_; const typename ParamGenerator<T6>::iterator begin6_; const typename ParamGenerator<T6>::iterator end6_; typename ParamGenerator<T6>::iterator current6_; const typename ParamGenerator<T7>::iterator begin7_; const typename ParamGenerator<T7>::iterator end7_; typename ParamGenerator<T7>::iterator current7_; const typename ParamGenerator<T8>::iterator begin8_; const typename ParamGenerator<T8>::iterator end8_; typename ParamGenerator<T8>::iterator current8_; ParamType current_value_; }; // class CartesianProductGenerator8::Iterator // No implementation - assignment is unsupported. void operator=(const CartesianProductGenerator8& other); const ParamGenerator<T1> g1_; const ParamGenerator<T2> g2_; const ParamGenerator<T3> g3_; const ParamGenerator<T4> g4_; const ParamGenerator<T5> g5_; const ParamGenerator<T6> g6_; const ParamGenerator<T7> g7_; const ParamGenerator<T8> g8_; }; // class CartesianProductGenerator8 template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9> class CartesianProductGenerator9 : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> > { public: typedef ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> ParamType; CartesianProductGenerator9(const ParamGenerator<T1>& g1, const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3, const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5, const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7, const ParamGenerator<T8>& g8, const ParamGenerator<T9>& g9) : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8), g9_(g9) {} virtual ~CartesianProductGenerator9() {} virtual ParamIteratorInterface<ParamType>* Begin() const { return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_, g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_, g7_.begin(), g8_, g8_.begin(), g9_, g9_.begin()); } virtual ParamIteratorInterface<ParamType>* End() const { return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(), g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_, g8_.end(), g9_, g9_.end()); } private: class Iterator : public ParamIteratorInterface<ParamType> { public: Iterator(const ParamGeneratorInterface<ParamType>* base, const ParamGenerator<T1>& g1, const typename ParamGenerator<T1>::iterator& current1, const ParamGenerator<T2>& g2, const typename ParamGenerator<T2>::iterator& current2, const ParamGenerator<T3>& g3, const typename ParamGenerator<T3>::iterator& current3, const ParamGenerator<T4>& g4, const typename ParamGenerator<T4>::iterator& current4, const ParamGenerator<T5>& g5, const typename ParamGenerator<T5>::iterator& current5, const ParamGenerator<T6>& g6, const typename ParamGenerator<T6>::iterator& current6, const ParamGenerator<T7>& g7, const typename ParamGenerator<T7>::iterator& current7, const ParamGenerator<T8>& g8, const typename ParamGenerator<T8>::iterator& current8, const ParamGenerator<T9>& g9, const typename ParamGenerator<T9>::iterator& current9) : base_(base), begin1_(g1.begin()), end1_(g1.end()), current1_(current1), begin2_(g2.begin()), end2_(g2.end()), current2_(current2), begin3_(g3.begin()), end3_(g3.end()), current3_(current3), begin4_(g4.begin()), end4_(g4.end()), current4_(current4), begin5_(g5.begin()), end5_(g5.end()), current5_(current5), begin6_(g6.begin()), end6_(g6.end()), current6_(current6), begin7_(g7.begin()), end7_(g7.end()), current7_(current7), begin8_(g8.begin()), end8_(g8.end()), current8_(current8), begin9_(g9.begin()), end9_(g9.end()), current9_(current9) { ComputeCurrentValue(); } virtual ~Iterator() {} virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const { return base_; } // Advance should not be called on beyond-of-range iterators // so no component iterators must be beyond end of range, either. virtual void Advance() { assert(!AtEnd()); ++current9_; if (current9_ == end9_) { current9_ = begin9_; ++current8_; } if (current8_ == end8_) { current8_ = begin8_; ++current7_; } if (current7_ == end7_) { current7_ = begin7_; ++current6_; } if (current6_ == end6_) { current6_ = begin6_; ++current5_; } if (current5_ == end5_) { current5_ = begin5_; ++current4_; } if (current4_ == end4_) { current4_ = begin4_; ++current3_; } if (current3_ == end3_) { current3_ = begin3_; ++current2_; } if (current2_ == end2_) { current2_ = begin2_; ++current1_; } ComputeCurrentValue(); } virtual ParamIteratorInterface<ParamType>* Clone() const { return new Iterator(*this); } virtual const ParamType* Current() const { return &current_value_; } virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) << "The program attempted to compare iterators " << "from different generators." << std::endl; const Iterator* typed_other = CheckedDowncastToActualType<const Iterator>(&other); // We must report iterators equal if they both point beyond their // respective ranges. That can happen in a variety of fashions, // so we have to consult AtEnd(). return (AtEnd() && typed_other->AtEnd()) || ( current1_ == typed_other->current1_ && current2_ == typed_other->current2_ && current3_ == typed_other->current3_ && current4_ == typed_other->current4_ && current5_ == typed_other->current5_ && current6_ == typed_other->current6_ && current7_ == typed_other->current7_ && current8_ == typed_other->current8_ && current9_ == typed_other->current9_); } private: Iterator(const Iterator& other) : base_(other.base_), begin1_(other.begin1_), end1_(other.end1_), current1_(other.current1_), begin2_(other.begin2_), end2_(other.end2_), current2_(other.current2_), begin3_(other.begin3_), end3_(other.end3_), current3_(other.current3_), begin4_(other.begin4_), end4_(other.end4_), current4_(other.current4_), begin5_(other.begin5_), end5_(other.end5_), current5_(other.current5_), begin6_(other.begin6_), end6_(other.end6_), current6_(other.current6_), begin7_(other.begin7_), end7_(other.end7_), current7_(other.current7_), begin8_(other.begin8_), end8_(other.end8_), current8_(other.current8_), begin9_(other.begin9_), end9_(other.end9_), current9_(other.current9_) { ComputeCurrentValue(); } void ComputeCurrentValue() { if (!AtEnd()) current_value_ = ParamType(*current1_, *current2_, *current3_, *current4_, *current5_, *current6_, *current7_, *current8_, *current9_); } bool AtEnd() const { // We must report iterator past the end of the range when either of the // component iterators has reached the end of its range. return current1_ == end1_ || current2_ == end2_ || current3_ == end3_ || current4_ == end4_ || current5_ == end5_ || current6_ == end6_ || current7_ == end7_ || current8_ == end8_ || current9_ == end9_; } // No implementation - assignment is unsupported. void operator=(const Iterator& other); const ParamGeneratorInterface<ParamType>* const base_; // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. // current[i]_ is the actual traversing iterator. const typename ParamGenerator<T1>::iterator begin1_; const typename ParamGenerator<T1>::iterator end1_; typename ParamGenerator<T1>::iterator current1_; const typename ParamGenerator<T2>::iterator begin2_; const typename ParamGenerator<T2>::iterator end2_; typename ParamGenerator<T2>::iterator current2_; const typename ParamGenerator<T3>::iterator begin3_; const typename ParamGenerator<T3>::iterator end3_; typename ParamGenerator<T3>::iterator current3_; const typename ParamGenerator<T4>::iterator begin4_; const typename ParamGenerator<T4>::iterator end4_; typename ParamGenerator<T4>::iterator current4_; const typename ParamGenerator<T5>::iterator begin5_; const typename ParamGenerator<T5>::iterator end5_; typename ParamGenerator<T5>::iterator current5_; const typename ParamGenerator<T6>::iterator begin6_; const typename ParamGenerator<T6>::iterator end6_; typename ParamGenerator<T6>::iterator current6_; const typename ParamGenerator<T7>::iterator begin7_; const typename ParamGenerator<T7>::iterator end7_; typename ParamGenerator<T7>::iterator current7_; const typename ParamGenerator<T8>::iterator begin8_; const typename ParamGenerator<T8>::iterator end8_; typename ParamGenerator<T8>::iterator current8_; const typename ParamGenerator<T9>::iterator begin9_; const typename ParamGenerator<T9>::iterator end9_; typename ParamGenerator<T9>::iterator current9_; ParamType current_value_; }; // class CartesianProductGenerator9::Iterator // No implementation - assignment is unsupported. void operator=(const CartesianProductGenerator9& other); const ParamGenerator<T1> g1_; const ParamGenerator<T2> g2_; const ParamGenerator<T3> g3_; const ParamGenerator<T4> g4_; const ParamGenerator<T5> g5_; const ParamGenerator<T6> g6_; const ParamGenerator<T7> g7_; const ParamGenerator<T8> g8_; const ParamGenerator<T9> g9_; }; // class CartesianProductGenerator9 template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10> class CartesianProductGenerator10 : public ParamGeneratorInterface< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> > { public: typedef ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> ParamType; CartesianProductGenerator10(const ParamGenerator<T1>& g1, const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3, const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5, const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7, const ParamGenerator<T8>& g8, const ParamGenerator<T9>& g9, const ParamGenerator<T10>& g10) : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8), g9_(g9), g10_(g10) {} virtual ~CartesianProductGenerator10() {} virtual ParamIteratorInterface<ParamType>* Begin() const { return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_, g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_, g7_.begin(), g8_, g8_.begin(), g9_, g9_.begin(), g10_, g10_.begin()); } virtual ParamIteratorInterface<ParamType>* End() const { return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(), g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_, g8_.end(), g9_, g9_.end(), g10_, g10_.end()); } private: class Iterator : public ParamIteratorInterface<ParamType> { public: Iterator(const ParamGeneratorInterface<ParamType>* base, const ParamGenerator<T1>& g1, const typename ParamGenerator<T1>::iterator& current1, const ParamGenerator<T2>& g2, const typename ParamGenerator<T2>::iterator& current2, const ParamGenerator<T3>& g3, const typename ParamGenerator<T3>::iterator& current3, const ParamGenerator<T4>& g4, const typename ParamGenerator<T4>::iterator& current4, const ParamGenerator<T5>& g5, const typename ParamGenerator<T5>::iterator& current5, const ParamGenerator<T6>& g6, const typename ParamGenerator<T6>::iterator& current6, const ParamGenerator<T7>& g7, const typename ParamGenerator<T7>::iterator& current7, const ParamGenerator<T8>& g8, const typename ParamGenerator<T8>::iterator& current8, const ParamGenerator<T9>& g9, const typename ParamGenerator<T9>::iterator& current9, const ParamGenerator<T10>& g10, const typename ParamGenerator<T10>::iterator& current10) : base_(base), begin1_(g1.begin()), end1_(g1.end()), current1_(current1), begin2_(g2.begin()), end2_(g2.end()), current2_(current2), begin3_(g3.begin()), end3_(g3.end()), current3_(current3), begin4_(g4.begin()), end4_(g4.end()), current4_(current4), begin5_(g5.begin()), end5_(g5.end()), current5_(current5), begin6_(g6.begin()), end6_(g6.end()), current6_(current6), begin7_(g7.begin()), end7_(g7.end()), current7_(current7), begin8_(g8.begin()), end8_(g8.end()), current8_(current8), begin9_(g9.begin()), end9_(g9.end()), current9_(current9), begin10_(g10.begin()), end10_(g10.end()), current10_(current10) { ComputeCurrentValue(); } virtual ~Iterator() {} virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const { return base_; } // Advance should not be called on beyond-of-range iterators // so no component iterators must be beyond end of range, either. virtual void Advance() { assert(!AtEnd()); ++current10_; if (current10_ == end10_) { current10_ = begin10_; ++current9_; } if (current9_ == end9_) { current9_ = begin9_; ++current8_; } if (current8_ == end8_) { current8_ = begin8_; ++current7_; } if (current7_ == end7_) { current7_ = begin7_; ++current6_; } if (current6_ == end6_) { current6_ = begin6_; ++current5_; } if (current5_ == end5_) { current5_ = begin5_; ++current4_; } if (current4_ == end4_) { current4_ = begin4_; ++current3_; } if (current3_ == end3_) { current3_ = begin3_; ++current2_; } if (current2_ == end2_) { current2_ = begin2_; ++current1_; } ComputeCurrentValue(); } virtual ParamIteratorInterface<ParamType>* Clone() const { return new Iterator(*this); } virtual const ParamType* Current() const { return &current_value_; } virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) << "The program attempted to compare iterators " << "from different generators." << std::endl; const Iterator* typed_other = CheckedDowncastToActualType<const Iterator>(&other); // We must report iterators equal if they both point beyond their // respective ranges. That can happen in a variety of fashions, // so we have to consult AtEnd(). return (AtEnd() && typed_other->AtEnd()) || ( current1_ == typed_other->current1_ && current2_ == typed_other->current2_ && current3_ == typed_other->current3_ && current4_ == typed_other->current4_ && current5_ == typed_other->current5_ && current6_ == typed_other->current6_ && current7_ == typed_other->current7_ && current8_ == typed_other->current8_ && current9_ == typed_other->current9_ && current10_ == typed_other->current10_); } private: Iterator(const Iterator& other) : base_(other.base_), begin1_(other.begin1_), end1_(other.end1_), current1_(other.current1_), begin2_(other.begin2_), end2_(other.end2_), current2_(other.current2_), begin3_(other.begin3_), end3_(other.end3_), current3_(other.current3_), begin4_(other.begin4_), end4_(other.end4_), current4_(other.current4_), begin5_(other.begin5_), end5_(other.end5_), current5_(other.current5_), begin6_(other.begin6_), end6_(other.end6_), current6_(other.current6_), begin7_(other.begin7_), end7_(other.end7_), current7_(other.current7_), begin8_(other.begin8_), end8_(other.end8_), current8_(other.current8_), begin9_(other.begin9_), end9_(other.end9_), current9_(other.current9_), begin10_(other.begin10_), end10_(other.end10_), current10_(other.current10_) { ComputeCurrentValue(); } void ComputeCurrentValue() { if (!AtEnd()) current_value_ = ParamType(*current1_, *current2_, *current3_, *current4_, *current5_, *current6_, *current7_, *current8_, *current9_, *current10_); } bool AtEnd() const { // We must report iterator past the end of the range when either of the // component iterators has reached the end of its range. return current1_ == end1_ || current2_ == end2_ || current3_ == end3_ || current4_ == end4_ || current5_ == end5_ || current6_ == end6_ || current7_ == end7_ || current8_ == end8_ || current9_ == end9_ || current10_ == end10_; } // No implementation - assignment is unsupported. void operator=(const Iterator& other); const ParamGeneratorInterface<ParamType>* const base_; // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. // current[i]_ is the actual traversing iterator. const typename ParamGenerator<T1>::iterator begin1_; const typename ParamGenerator<T1>::iterator end1_; typename ParamGenerator<T1>::iterator current1_; const typename ParamGenerator<T2>::iterator begin2_; const typename ParamGenerator<T2>::iterator end2_; typename ParamGenerator<T2>::iterator current2_; const typename ParamGenerator<T3>::iterator begin3_; const typename ParamGenerator<T3>::iterator end3_; typename ParamGenerator<T3>::iterator current3_; const typename ParamGenerator<T4>::iterator begin4_; const typename ParamGenerator<T4>::iterator end4_; typename ParamGenerator<T4>::iterator current4_; const typename ParamGenerator<T5>::iterator begin5_; const typename ParamGenerator<T5>::iterator end5_; typename ParamGenerator<T5>::iterator current5_; const typename ParamGenerator<T6>::iterator begin6_; const typename ParamGenerator<T6>::iterator end6_; typename ParamGenerator<T6>::iterator current6_; const typename ParamGenerator<T7>::iterator begin7_; const typename ParamGenerator<T7>::iterator end7_; typename ParamGenerator<T7>::iterator current7_; const typename ParamGenerator<T8>::iterator begin8_; const typename ParamGenerator<T8>::iterator end8_; typename ParamGenerator<T8>::iterator current8_; const typename ParamGenerator<T9>::iterator begin9_; const typename ParamGenerator<T9>::iterator end9_; typename ParamGenerator<T9>::iterator current9_; const typename ParamGenerator<T10>::iterator begin10_; const typename ParamGenerator<T10>::iterator end10_; typename ParamGenerator<T10>::iterator current10_; ParamType current_value_; }; // class CartesianProductGenerator10::Iterator // No implementation - assignment is unsupported. void operator=(const CartesianProductGenerator10& other); const ParamGenerator<T1> g1_; const ParamGenerator<T2> g2_; const ParamGenerator<T3> g3_; const ParamGenerator<T4> g4_; const ParamGenerator<T5> g5_; const ParamGenerator<T6> g6_; const ParamGenerator<T7> g7_; const ParamGenerator<T8> g8_; const ParamGenerator<T9> g9_; const ParamGenerator<T10> g10_; }; // class CartesianProductGenerator10 // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // Helper classes providing Combine() with polymorphic features. They allow // casting CartesianProductGeneratorN<T> to ParamGenerator<U> if T is // convertible to U. // template <class Generator1, class Generator2> class CartesianProductHolder2 { public: CartesianProductHolder2(const Generator1& g1, const Generator2& g2) : g1_(g1), g2_(g2) {} template <typename T1, typename T2> operator ParamGenerator< ::testing::tuple<T1, T2> >() const { return ParamGenerator< ::testing::tuple<T1, T2> >( new CartesianProductGenerator2<T1, T2>( static_cast<ParamGenerator<T1> >(g1_), static_cast<ParamGenerator<T2> >(g2_))); } private: // No implementation - assignment is unsupported. void operator=(const CartesianProductHolder2& other); const Generator1 g1_; const Generator2 g2_; }; // class CartesianProductHolder2 template <class Generator1, class Generator2, class Generator3> class CartesianProductHolder3 { public: CartesianProductHolder3(const Generator1& g1, const Generator2& g2, const Generator3& g3) : g1_(g1), g2_(g2), g3_(g3) {} template <typename T1, typename T2, typename T3> operator ParamGenerator< ::testing::tuple<T1, T2, T3> >() const { return ParamGenerator< ::testing::tuple<T1, T2, T3> >( new CartesianProductGenerator3<T1, T2, T3>( static_cast<ParamGenerator<T1> >(g1_), static_cast<ParamGenerator<T2> >(g2_), static_cast<ParamGenerator<T3> >(g3_))); } private: // No implementation - assignment is unsupported. void operator=(const CartesianProductHolder3& other); const Generator1 g1_; const Generator2 g2_; const Generator3 g3_; }; // class CartesianProductHolder3 template <class Generator1, class Generator2, class Generator3, class Generator4> class CartesianProductHolder4 { public: CartesianProductHolder4(const Generator1& g1, const Generator2& g2, const Generator3& g3, const Generator4& g4) : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {} template <typename T1, typename T2, typename T3, typename T4> operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4> >() const { return ParamGenerator< ::testing::tuple<T1, T2, T3, T4> >( new CartesianProductGenerator4<T1, T2, T3, T4>( static_cast<ParamGenerator<T1> >(g1_), static_cast<ParamGenerator<T2> >(g2_), static_cast<ParamGenerator<T3> >(g3_), static_cast<ParamGenerator<T4> >(g4_))); } private: // No implementation - assignment is unsupported. void operator=(const CartesianProductHolder4& other); const Generator1 g1_; const Generator2 g2_; const Generator3 g3_; const Generator4 g4_; }; // class CartesianProductHolder4 template <class Generator1, class Generator2, class Generator3, class Generator4, class Generator5> class CartesianProductHolder5 { public: CartesianProductHolder5(const Generator1& g1, const Generator2& g2, const Generator3& g3, const Generator4& g4, const Generator5& g5) : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {} template <typename T1, typename T2, typename T3, typename T4, typename T5> operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5> >() const { return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5> >( new CartesianProductGenerator5<T1, T2, T3, T4, T5>( static_cast<ParamGenerator<T1> >(g1_), static_cast<ParamGenerator<T2> >(g2_), static_cast<ParamGenerator<T3> >(g3_), static_cast<ParamGenerator<T4> >(g4_), static_cast<ParamGenerator<T5> >(g5_))); } private: // No implementation - assignment is unsupported. void operator=(const CartesianProductHolder5& other); const Generator1 g1_; const Generator2 g2_; const Generator3 g3_; const Generator4 g4_; const Generator5 g5_; }; // class CartesianProductHolder5 template <class Generator1, class Generator2, class Generator3, class Generator4, class Generator5, class Generator6> class CartesianProductHolder6 { public: CartesianProductHolder6(const Generator1& g1, const Generator2& g2, const Generator3& g3, const Generator4& g4, const Generator5& g5, const Generator6& g6) : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {} template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6> >() const { return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6> >( new CartesianProductGenerator6<T1, T2, T3, T4, T5, T6>( static_cast<ParamGenerator<T1> >(g1_), static_cast<ParamGenerator<T2> >(g2_), static_cast<ParamGenerator<T3> >(g3_), static_cast<ParamGenerator<T4> >(g4_), static_cast<ParamGenerator<T5> >(g5_), static_cast<ParamGenerator<T6> >(g6_))); } private: // No implementation - assignment is unsupported. void operator=(const CartesianProductHolder6& other); const Generator1 g1_; const Generator2 g2_; const Generator3 g3_; const Generator4 g4_; const Generator5 g5_; const Generator6 g6_; }; // class CartesianProductHolder6 template <class Generator1, class Generator2, class Generator3, class Generator4, class Generator5, class Generator6, class Generator7> class CartesianProductHolder7 { public: CartesianProductHolder7(const Generator1& g1, const Generator2& g2, const Generator3& g3, const Generator4& g4, const Generator5& g5, const Generator6& g6, const Generator7& g7) : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {} template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7> >() const { return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7> >( new CartesianProductGenerator7<T1, T2, T3, T4, T5, T6, T7>( static_cast<ParamGenerator<T1> >(g1_), static_cast<ParamGenerator<T2> >(g2_), static_cast<ParamGenerator<T3> >(g3_), static_cast<ParamGenerator<T4> >(g4_), static_cast<ParamGenerator<T5> >(g5_), static_cast<ParamGenerator<T6> >(g6_), static_cast<ParamGenerator<T7> >(g7_))); } private: // No implementation - assignment is unsupported. void operator=(const CartesianProductHolder7& other); const Generator1 g1_; const Generator2 g2_; const Generator3 g3_; const Generator4 g4_; const Generator5 g5_; const Generator6 g6_; const Generator7 g7_; }; // class CartesianProductHolder7 template <class Generator1, class Generator2, class Generator3, class Generator4, class Generator5, class Generator6, class Generator7, class Generator8> class CartesianProductHolder8 { public: CartesianProductHolder8(const Generator1& g1, const Generator2& g2, const Generator3& g3, const Generator4& g4, const Generator5& g5, const Generator6& g6, const Generator7& g7, const Generator8& g8) : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8) {} template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8> >() const { return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8> >( new CartesianProductGenerator8<T1, T2, T3, T4, T5, T6, T7, T8>( static_cast<ParamGenerator<T1> >(g1_), static_cast<ParamGenerator<T2> >(g2_), static_cast<ParamGenerator<T3> >(g3_), static_cast<ParamGenerator<T4> >(g4_), static_cast<ParamGenerator<T5> >(g5_), static_cast<ParamGenerator<T6> >(g6_), static_cast<ParamGenerator<T7> >(g7_), static_cast<ParamGenerator<T8> >(g8_))); } private: // No implementation - assignment is unsupported. void operator=(const CartesianProductHolder8& other); const Generator1 g1_; const Generator2 g2_; const Generator3 g3_; const Generator4 g4_; const Generator5 g5_; const Generator6 g6_; const Generator7 g7_; const Generator8 g8_; }; // class CartesianProductHolder8 template <class Generator1, class Generator2, class Generator3, class Generator4, class Generator5, class Generator6, class Generator7, class Generator8, class Generator9> class CartesianProductHolder9 { public: CartesianProductHolder9(const Generator1& g1, const Generator2& g2, const Generator3& g3, const Generator4& g4, const Generator5& g5, const Generator6& g6, const Generator7& g7, const Generator8& g8, const Generator9& g9) : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8), g9_(g9) {} template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9> operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> >() const { return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> >( new CartesianProductGenerator9<T1, T2, T3, T4, T5, T6, T7, T8, T9>( static_cast<ParamGenerator<T1> >(g1_), static_cast<ParamGenerator<T2> >(g2_), static_cast<ParamGenerator<T3> >(g3_), static_cast<ParamGenerator<T4> >(g4_), static_cast<ParamGenerator<T5> >(g5_), static_cast<ParamGenerator<T6> >(g6_), static_cast<ParamGenerator<T7> >(g7_), static_cast<ParamGenerator<T8> >(g8_), static_cast<ParamGenerator<T9> >(g9_))); } private: // No implementation - assignment is unsupported. void operator=(const CartesianProductHolder9& other); const Generator1 g1_; const Generator2 g2_; const Generator3 g3_; const Generator4 g4_; const Generator5 g5_; const Generator6 g6_; const Generator7 g7_; const Generator8 g8_; const Generator9 g9_; }; // class CartesianProductHolder9 template <class Generator1, class Generator2, class Generator3, class Generator4, class Generator5, class Generator6, class Generator7, class Generator8, class Generator9, class Generator10> class CartesianProductHolder10 { public: CartesianProductHolder10(const Generator1& g1, const Generator2& g2, const Generator3& g3, const Generator4& g4, const Generator5& g5, const Generator6& g6, const Generator7& g7, const Generator8& g8, const Generator9& g9, const Generator10& g10) : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8), g9_(g9), g10_(g10) {} template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10> operator ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> >() const { return ParamGenerator< ::testing::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> >( new CartesianProductGenerator10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>( static_cast<ParamGenerator<T1> >(g1_), static_cast<ParamGenerator<T2> >(g2_), static_cast<ParamGenerator<T3> >(g3_), static_cast<ParamGenerator<T4> >(g4_), static_cast<ParamGenerator<T5> >(g5_), static_cast<ParamGenerator<T6> >(g6_), static_cast<ParamGenerator<T7> >(g7_), static_cast<ParamGenerator<T8> >(g8_), static_cast<ParamGenerator<T9> >(g9_), static_cast<ParamGenerator<T10> >(g10_))); } private: // No implementation - assignment is unsupported. void operator=(const CartesianProductHolder10& other); const Generator1 g1_; const Generator2 g2_; const Generator3 g3_; const Generator4 g4_; const Generator5 g5_; const Generator6 g6_; const Generator7 g7_; const Generator8 g8_; const Generator9 g9_; const Generator10 g10_; }; // class CartesianProductHolder10 # endif // GTEST_HAS_COMBINE } // namespace internal } // namespace testing #endif // GTEST_HAS_PARAM_TEST #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ #if GTEST_HAS_PARAM_TEST namespace testing { // Functions producing parameter generators. // // Google Test uses these generators to produce parameters for value- // parameterized tests. When a parameterized test case is instantiated // with a particular generator, Google Test creates and runs tests // for each element in the sequence produced by the generator. // // In the following sample, tests from test case FooTest are instantiated // each three times with parameter values 3, 5, and 8: // // class FooTest : public TestWithParam<int> { ... }; // // TEST_P(FooTest, TestThis) { // } // TEST_P(FooTest, TestThat) { // } // INSTANTIATE_TEST_CASE_P(TestSequence, FooTest, Values(3, 5, 8)); // // Range() returns generators providing sequences of values in a range. // // Synopsis: // Range(start, end) // - returns a generator producing a sequence of values {start, start+1, // start+2, ..., }. // Range(start, end, step) // - returns a generator producing a sequence of values {start, start+step, // start+step+step, ..., }. // Notes: // * The generated sequences never include end. For example, Range(1, 5) // returns a generator producing a sequence {1, 2, 3, 4}. Range(1, 9, 2) // returns a generator producing {1, 3, 5, 7}. // * start and end must have the same type. That type may be any integral or // floating-point type or a user defined type satisfying these conditions: // * It must be assignable (have operator=() defined). // * It must have operator+() (operator+(int-compatible type) for // two-operand version). // * It must have operator<() defined. // Elements in the resulting sequences will also have that type. // * Condition start < end must be satisfied in order for resulting sequences // to contain any elements. // template <typename T, typename IncrementT> internal::ParamGenerator<T> Range(T start, T end, IncrementT step) { return internal::ParamGenerator<T>( new internal::RangeGenerator<T, IncrementT>(start, end, step)); } template <typename T> internal::ParamGenerator<T> Range(T start, T end) { return Range(start, end, 1); } // ValuesIn() function allows generation of tests with parameters coming from // a container. // // Synopsis: // ValuesIn(const T (&array)[N]) // - returns a generator producing sequences with elements from // a C-style array. // ValuesIn(const Container& container) // - returns a generator producing sequences with elements from // an STL-style container. // ValuesIn(Iterator begin, Iterator end) // - returns a generator producing sequences with elements from // a range [begin, end) defined by a pair of STL-style iterators. These // iterators can also be plain C pointers. // // Please note that ValuesIn copies the values from the containers // passed in and keeps them to generate tests in RUN_ALL_TESTS(). // // Examples: // // This instantiates tests from test case StringTest // each with C-string values of "foo", "bar", and "baz": // // const char* strings[] = {"foo", "bar", "baz"}; // INSTANTIATE_TEST_CASE_P(StringSequence, SrtingTest, ValuesIn(strings)); // // This instantiates tests from test case StlStringTest // each with STL strings with values "a" and "b": // // ::std::vector< ::std::string> GetParameterStrings() { // ::std::vector< ::std::string> v; // v.push_back("a"); // v.push_back("b"); // return v; // } // // INSTANTIATE_TEST_CASE_P(CharSequence, // StlStringTest, // ValuesIn(GetParameterStrings())); // // // This will also instantiate tests from CharTest // each with parameter values 'a' and 'b': // // ::std::list<char> GetParameterChars() { // ::std::list<char> list; // list.push_back('a'); // list.push_back('b'); // return list; // } // ::std::list<char> l = GetParameterChars(); // INSTANTIATE_TEST_CASE_P(CharSequence2, // CharTest, // ValuesIn(l.begin(), l.end())); // template <typename ForwardIterator> internal::ParamGenerator< typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type> ValuesIn(ForwardIterator begin, ForwardIterator end) { typedef typename ::testing::internal::IteratorTraits<ForwardIterator> ::value_type ParamType; return internal::ParamGenerator<ParamType>( new internal::ValuesInIteratorRangeGenerator<ParamType>(begin, end)); } template <typename T, size_t N> internal::ParamGenerator<T> ValuesIn(const T (&array)[N]) { return ValuesIn(array, array + N); } template <class Container> internal::ParamGenerator<typename Container::value_type> ValuesIn( const Container& container) { return ValuesIn(container.begin(), container.end()); } // Values() allows generating tests from explicitly specified list of // parameters. // // Synopsis: // Values(T v1, T v2, ..., T vN) // - returns a generator producing sequences with elements v1, v2, ..., vN. // // For example, this instantiates tests from test case BarTest each // with values "one", "two", and "three": // // INSTANTIATE_TEST_CASE_P(NumSequence, BarTest, Values("one", "two", "three")); // // This instantiates tests from test case BazTest each with values 1, 2, 3.5. // The exact type of values will depend on the type of parameter in BazTest. // // INSTANTIATE_TEST_CASE_P(FloatingNumbers, BazTest, Values(1, 2, 3.5)); // // Currently, Values() supports from 1 to 50 parameters. // template <typename T1> internal::ValueArray1<T1> Values(T1 v1) { return internal::ValueArray1<T1>(v1); } template <typename T1, typename T2> internal::ValueArray2<T1, T2> Values(T1 v1, T2 v2) { return internal::ValueArray2<T1, T2>(v1, v2); } template <typename T1, typename T2, typename T3> internal::ValueArray3<T1, T2, T3> Values(T1 v1, T2 v2, T3 v3) { return internal::ValueArray3<T1, T2, T3>(v1, v2, v3); } template <typename T1, typename T2, typename T3, typename T4> internal::ValueArray4<T1, T2, T3, T4> Values(T1 v1, T2 v2, T3 v3, T4 v4) { return internal::ValueArray4<T1, T2, T3, T4>(v1, v2, v3, v4); } template <typename T1, typename T2, typename T3, typename T4, typename T5> internal::ValueArray5<T1, T2, T3, T4, T5> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5) { return internal::ValueArray5<T1, T2, T3, T4, T5>(v1, v2, v3, v4, v5); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> internal::ValueArray6<T1, T2, T3, T4, T5, T6> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6) { return internal::ValueArray6<T1, T2, T3, T4, T5, T6>(v1, v2, v3, v4, v5, v6); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> internal::ValueArray7<T1, T2, T3, T4, T5, T6, T7> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7) { return internal::ValueArray7<T1, T2, T3, T4, T5, T6, T7>(v1, v2, v3, v4, v5, v6, v7); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> internal::ValueArray8<T1, T2, T3, T4, T5, T6, T7, T8> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8) { return internal::ValueArray8<T1, T2, T3, T4, T5, T6, T7, T8>(v1, v2, v3, v4, v5, v6, v7, v8); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9> internal::ValueArray9<T1, T2, T3, T4, T5, T6, T7, T8, T9> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9) { return internal::ValueArray9<T1, T2, T3, T4, T5, T6, T7, T8, T9>(v1, v2, v3, v4, v5, v6, v7, v8, v9); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10> internal::ValueArray10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10) { return internal::ValueArray10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11> internal::ValueArray11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11) { return internal::ValueArray11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12> internal::ValueArray12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12) { return internal::ValueArray12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13> internal::ValueArray13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13) { return internal::ValueArray13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14> internal::ValueArray14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14) { return internal::ValueArray14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15> internal::ValueArray15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15) { return internal::ValueArray15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16> internal::ValueArray16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16) { return internal::ValueArray16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17> internal::ValueArray17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17) { return internal::ValueArray17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18> internal::ValueArray18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18) { return internal::ValueArray18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19> internal::ValueArray19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19) { return internal::ValueArray19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20> internal::ValueArray20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20) { return internal::ValueArray20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21> internal::ValueArray21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21) { return internal::ValueArray21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22> internal::ValueArray22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22) { return internal::ValueArray22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23> internal::ValueArray23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23) { return internal::ValueArray23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24> internal::ValueArray24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24) { return internal::ValueArray24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25> internal::ValueArray25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25) { return internal::ValueArray25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26> internal::ValueArray26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26) { return internal::ValueArray26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27> internal::ValueArray27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27) { return internal::ValueArray27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28> internal::ValueArray28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28) { return internal::ValueArray28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29> internal::ValueArray29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29) { return internal::ValueArray29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30> internal::ValueArray30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30) { return internal::ValueArray30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31> internal::ValueArray31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31) { return internal::ValueArray31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32> internal::ValueArray32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32) { return internal::ValueArray32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33> internal::ValueArray33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33) { return internal::ValueArray33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34> internal::ValueArray34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34) { return internal::ValueArray34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35> internal::ValueArray35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35) { return internal::ValueArray35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36> internal::ValueArray36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36) { return internal::ValueArray36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37> internal::ValueArray37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37) { return internal::ValueArray37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38> internal::ValueArray38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38) { return internal::ValueArray38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39> internal::ValueArray39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39) { return internal::ValueArray39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40> internal::ValueArray40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40) { return internal::ValueArray40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41> internal::ValueArray41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41) { return internal::ValueArray41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42> internal::ValueArray42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42) { return internal::ValueArray42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42, typename T43> internal::ValueArray43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43) { return internal::ValueArray43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42, typename T43, typename T44> internal::ValueArray44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44) { return internal::ValueArray44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42, typename T43, typename T44, typename T45> internal::ValueArray45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45) { return internal::ValueArray45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42, typename T43, typename T44, typename T45, typename T46> internal::ValueArray46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46) { return internal::ValueArray46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42, typename T43, typename T44, typename T45, typename T46, typename T47> internal::ValueArray47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47) { return internal::ValueArray47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42, typename T43, typename T44, typename T45, typename T46, typename T47, typename T48> internal::ValueArray48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47, T48> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48) { return internal::ValueArray48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47, T48>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42, typename T43, typename T44, typename T45, typename T46, typename T47, typename T48, typename T49> internal::ValueArray49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47, T48, T49> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48, T49 v49) { return internal::ValueArray49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47, T48, T49>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49); } template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16, typename T17, typename T18, typename T19, typename T20, typename T21, typename T22, typename T23, typename T24, typename T25, typename T26, typename T27, typename T28, typename T29, typename T30, typename T31, typename T32, typename T33, typename T34, typename T35, typename T36, typename T37, typename T38, typename T39, typename T40, typename T41, typename T42, typename T43, typename T44, typename T45, typename T46, typename T47, typename T48, typename T49, typename T50> internal::ValueArray50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47, T48, T49, T50> Values(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16, T17 v17, T18 v18, T19 v19, T20 v20, T21 v21, T22 v22, T23 v23, T24 v24, T25 v25, T26 v26, T27 v27, T28 v28, T29 v29, T30 v30, T31 v31, T32 v32, T33 v33, T34 v34, T35 v35, T36 v36, T37 v37, T38 v38, T39 v39, T40 v40, T41 v41, T42 v42, T43 v43, T44 v44, T45 v45, T46 v46, T47 v47, T48 v48, T49 v49, T50 v50) { return internal::ValueArray50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47, T48, T49, T50>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50); } // Bool() allows generating tests with parameters in a set of (false, true). // // Synopsis: // Bool() // - returns a generator producing sequences with elements {false, true}. // // It is useful when testing code that depends on Boolean flags. Combinations // of multiple flags can be tested when several Bool()'s are combined using // Combine() function. // // In the following example all tests in the test case FlagDependentTest // will be instantiated twice with parameters false and true. // // class FlagDependentTest : public testing::TestWithParam<bool> { // virtual void SetUp() { // external_flag = GetParam(); // } // } // INSTANTIATE_TEST_CASE_P(BoolSequence, FlagDependentTest, Bool()); // inline internal::ParamGenerator<bool> Bool() { return Values(false, true); } # if GTEST_HAS_COMBINE // Combine() allows the user to combine two or more sequences to produce // values of a Cartesian product of those sequences' elements. // // Synopsis: // Combine(gen1, gen2, ..., genN) // - returns a generator producing sequences with elements coming from // the Cartesian product of elements from the sequences generated by // gen1, gen2, ..., genN. The sequence elements will have a type of // tuple<T1, T2, ..., TN> where T1, T2, ..., TN are the types // of elements from sequences produces by gen1, gen2, ..., genN. // // Combine can have up to 10 arguments. This number is currently limited // by the maximum number of elements in the tuple implementation used by Google // Test. // // Example: // // This will instantiate tests in test case AnimalTest each one with // the parameter values tuple("cat", BLACK), tuple("cat", WHITE), // tuple("dog", BLACK), and tuple("dog", WHITE): // // enum Color { BLACK, GRAY, WHITE }; // class AnimalTest // : public testing::TestWithParam<tuple<const char*, Color> > {...}; // // TEST_P(AnimalTest, AnimalLooksNice) {...} // // INSTANTIATE_TEST_CASE_P(AnimalVariations, AnimalTest, // Combine(Values("cat", "dog"), // Values(BLACK, WHITE))); // // This will instantiate tests in FlagDependentTest with all variations of two // Boolean flags: // // class FlagDependentTest // : public testing::TestWithParam<tuple<bool, bool> > { // virtual void SetUp() { // // Assigns external_flag_1 and external_flag_2 values from the tuple. // tie(external_flag_1, external_flag_2) = GetParam(); // } // }; // // TEST_P(FlagDependentTest, TestFeature1) { // // Test your code using external_flag_1 and external_flag_2 here. // } // INSTANTIATE_TEST_CASE_P(TwoBoolSequence, FlagDependentTest, // Combine(Bool(), Bool())); // template <typename Generator1, typename Generator2> internal::CartesianProductHolder2<Generator1, Generator2> Combine( const Generator1& g1, const Generator2& g2) { return internal::CartesianProductHolder2<Generator1, Generator2>( g1, g2); } template <typename Generator1, typename Generator2, typename Generator3> internal::CartesianProductHolder3<Generator1, Generator2, Generator3> Combine( const Generator1& g1, const Generator2& g2, const Generator3& g3) { return internal::CartesianProductHolder3<Generator1, Generator2, Generator3>( g1, g2, g3); } template <typename Generator1, typename Generator2, typename Generator3, typename Generator4> internal::CartesianProductHolder4<Generator1, Generator2, Generator3, Generator4> Combine( const Generator1& g1, const Generator2& g2, const Generator3& g3, const Generator4& g4) { return internal::CartesianProductHolder4<Generator1, Generator2, Generator3, Generator4>( g1, g2, g3, g4); } template <typename Generator1, typename Generator2, typename Generator3, typename Generator4, typename Generator5> internal::CartesianProductHolder5<Generator1, Generator2, Generator3, Generator4, Generator5> Combine( const Generator1& g1, const Generator2& g2, const Generator3& g3, const Generator4& g4, const Generator5& g5) { return internal::CartesianProductHolder5<Generator1, Generator2, Generator3, Generator4, Generator5>( g1, g2, g3, g4, g5); } template <typename Generator1, typename Generator2, typename Generator3, typename Generator4, typename Generator5, typename Generator6> internal::CartesianProductHolder6<Generator1, Generator2, Generator3, Generator4, Generator5, Generator6> Combine( const Generator1& g1, const Generator2& g2, const Generator3& g3, const Generator4& g4, const Generator5& g5, const Generator6& g6) { return internal::CartesianProductHolder6<Generator1, Generator2, Generator3, Generator4, Generator5, Generator6>( g1, g2, g3, g4, g5, g6); } template <typename Generator1, typename Generator2, typename Generator3, typename Generator4, typename Generator5, typename Generator6, typename Generator7> internal::CartesianProductHolder7<Generator1, Generator2, Generator3, Generator4, Generator5, Generator6, Generator7> Combine( const Generator1& g1, const Generator2& g2, const Generator3& g3, const Generator4& g4, const Generator5& g5, const Generator6& g6, const Generator7& g7) { return internal::CartesianProductHolder7<Generator1, Generator2, Generator3, Generator4, Generator5, Generator6, Generator7>( g1, g2, g3, g4, g5, g6, g7); } template <typename Generator1, typename Generator2, typename Generator3, typename Generator4, typename Generator5, typename Generator6, typename Generator7, typename Generator8> internal::CartesianProductHolder8<Generator1, Generator2, Generator3, Generator4, Generator5, Generator6, Generator7, Generator8> Combine( const Generator1& g1, const Generator2& g2, const Generator3& g3, const Generator4& g4, const Generator5& g5, const Generator6& g6, const Generator7& g7, const Generator8& g8) { return internal::CartesianProductHolder8<Generator1, Generator2, Generator3, Generator4, Generator5, Generator6, Generator7, Generator8>( g1, g2, g3, g4, g5, g6, g7, g8); } template <typename Generator1, typename Generator2, typename Generator3, typename Generator4, typename Generator5, typename Generator6, typename Generator7, typename Generator8, typename Generator9> internal::CartesianProductHolder9<Generator1, Generator2, Generator3, Generator4, Generator5, Generator6, Generator7, Generator8, Generator9> Combine( const Generator1& g1, const Generator2& g2, const Generator3& g3, const Generator4& g4, const Generator5& g5, const Generator6& g6, const Generator7& g7, const Generator8& g8, const Generator9& g9) { return internal::CartesianProductHolder9<Generator1, Generator2, Generator3, Generator4, Generator5, Generator6, Generator7, Generator8, Generator9>( g1, g2, g3, g4, g5, g6, g7, g8, g9); } template <typename Generator1, typename Generator2, typename Generator3, typename Generator4, typename Generator5, typename Generator6, typename Generator7, typename Generator8, typename Generator9, typename Generator10> internal::CartesianProductHolder10<Generator1, Generator2, Generator3, Generator4, Generator5, Generator6, Generator7, Generator8, Generator9, Generator10> Combine( const Generator1& g1, const Generator2& g2, const Generator3& g3, const Generator4& g4, const Generator5& g5, const Generator6& g6, const Generator7& g7, const Generator8& g8, const Generator9& g9, const Generator10& g10) { return internal::CartesianProductHolder10<Generator1, Generator2, Generator3, Generator4, Generator5, Generator6, Generator7, Generator8, Generator9, Generator10>( g1, g2, g3, g4, g5, g6, g7, g8, g9, g10); } # endif // GTEST_HAS_COMBINE # define TEST_P(test_case_name, test_name) \ class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \ : public test_case_name { \ public: \ GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {} \ virtual void TestBody(); \ private: \ static int AddToRegistry() { \ ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \ GetTestCasePatternHolder<test_case_name>(\ #test_case_name, \ ::testing::internal::CodeLocation(\ __FILE__, __LINE__))->AddTestPattern(\ #test_case_name, \ #test_name, \ new ::testing::internal::TestMetaFactory< \ GTEST_TEST_CLASS_NAME_(\ test_case_name, test_name)>()); \ return 0; \ } \ static int gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_; \ GTEST_DISALLOW_COPY_AND_ASSIGN_(\ GTEST_TEST_CLASS_NAME_(test_case_name, test_name)); \ }; \ int GTEST_TEST_CLASS_NAME_(test_case_name, \ test_name)::gtest_registering_dummy_ = \ GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \ void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody() // The optional last argument to INSTANTIATE_TEST_CASE_P allows the user // to specify a function or functor that generates custom test name suffixes // based on the test parameters. The function should accept one argument of // type testing::TestParamInfo<class ParamType>, and return std::string. // // testing::PrintToStringParamName is a builtin test suffix generator that // returns the value of testing::PrintToString(GetParam()). It does not work // for std::string or C strings. // // Note: test names must be non-empty, unique, and may only contain ASCII // alphanumeric characters or underscore. # define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, ...) \ ::testing::internal::ParamGenerator<test_case_name::ParamType> \ gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \ ::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \ const ::testing::TestParamInfo<test_case_name::ParamType>& info) { \ return ::testing::internal::GetParamNameGen<test_case_name::ParamType> \ (__VA_ARGS__)(info); \ } \ int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \ ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \ GetTestCasePatternHolder<test_case_name>(\ #test_case_name, \ ::testing::internal::CodeLocation(\ __FILE__, __LINE__))->AddTestCaseInstantiation(\ #prefix, \ &gtest_##prefix##test_case_name##_EvalGenerator_, \ &gtest_##prefix##test_case_name##_EvalGenerateName_, \ __FILE__, __LINE__) } // namespace testing #endif // GTEST_HAS_PARAM_TEST #endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ // Copyright 2006, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Author: [email protected] (Zhanyong Wan) // // Google C++ Testing Framework definitions useful in production code. #ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_ #define GTEST_INCLUDE_GTEST_GTEST_PROD_H_ // When you need to test the private or protected members of a class, // use the FRIEND_TEST macro to declare your tests as friends of the // class. For example: // // class MyClass { // private: // void MyMethod(); // FRIEND_TEST(MyClassTest, MyMethod); // }; // // class MyClassTest : public testing::Test { // // ... // }; // // TEST_F(MyClassTest, MyMethod) { // // Can call MyClass::MyMethod() here. // } #define FRIEND_TEST(test_case_name, test_name)\ friend class test_case_name##_##test_name##_Test #endif // GTEST_INCLUDE_GTEST_GTEST_PROD_H_ // Copyright 2008, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Author: [email protected] (Markus Heule) // #ifndef GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_ #define GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_ #include <iosfwd> #include <vector> namespace testing { // A copyable object representing the result of a test part (i.e. an // assertion or an explicit FAIL(), ADD_FAILURE(), or SUCCESS()). // // Don't inherit from TestPartResult as its destructor is not virtual. class GTEST_API_ TestPartResult { public: // The possible outcomes of a test part (i.e. an assertion or an // explicit SUCCEED(), FAIL(), or ADD_FAILURE()). enum Type { kSuccess, // Succeeded. kNonFatalFailure, // Failed but the test can continue. kFatalFailure // Failed and the test should be terminated. }; // C'tor. TestPartResult does NOT have a default constructor. // Always use this constructor (with parameters) to create a // TestPartResult object. TestPartResult(Type a_type, const char* a_file_name, int a_line_number, const char* a_message) : type_(a_type), file_name_(a_file_name == NULL ? "" : a_file_name), line_number_(a_line_number), summary_(ExtractSummary(a_message)), message_(a_message) { } // Gets the outcome of the test part. Type type() const { return type_; } // Gets the name of the source file where the test part took place, or // NULL if it's unknown. const char* file_name() const { return file_name_.empty() ? NULL : file_name_.c_str(); } // Gets the line in the source file where the test part took place, // or -1 if it's unknown. int line_number() const { return line_number_; } // Gets the summary of the failure message. const char* summary() const { return summary_.c_str(); } // Gets the message associated with the test part. const char* message() const { return message_.c_str(); } // Returns true iff the test part passed. bool passed() const { return type_ == kSuccess; } // Returns true iff the test part failed. bool failed() const { return type_ != kSuccess; } // Returns true iff the test part non-fatally failed. bool nonfatally_failed() const { return type_ == kNonFatalFailure; } // Returns true iff the test part fatally failed. bool fatally_failed() const { return type_ == kFatalFailure; } private: Type type_; // Gets the summary of the failure message by omitting the stack // trace in it. static std::string ExtractSummary(const char* message); // The name of the source file where the test part took place, or // "" if the source file is unknown. std::string file_name_; // The line in the source file where the test part took place, or -1 // if the line number is unknown. int line_number_; std::string summary_; // The test failure summary. std::string message_; // The test failure message. }; // Prints a TestPartResult object. std::ostream& operator<<(std::ostream& os, const TestPartResult& result); // An array of TestPartResult objects. // // Don't inherit from TestPartResultArray as its destructor is not // virtual. class GTEST_API_ TestPartResultArray { public: TestPartResultArray() {} // Appends the given TestPartResult to the array. void Append(const TestPartResult& result); // Returns the TestPartResult at the given index (0-based). const TestPartResult& GetTestPartResult(int index) const; // Returns the number of TestPartResult objects in the array. int size() const; private: std::vector<TestPartResult> array_; GTEST_DISALLOW_COPY_AND_ASSIGN_(TestPartResultArray); }; // This interface knows how to report a test part result. class TestPartResultReporterInterface { public: virtual ~TestPartResultReporterInterface() {} virtual void ReportTestPartResult(const TestPartResult& result) = 0; }; namespace internal { // This helper class is used by {ASSERT|EXPECT}_NO_FATAL_FAILURE to check if a // statement generates new fatal failures. To do so it registers itself as the // current test part result reporter. Besides checking if fatal failures were // reported, it only delegates the reporting to the former result reporter. // The original result reporter is restored in the destructor. // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. class GTEST_API_ HasNewFatalFailureHelper : public TestPartResultReporterInterface { public: HasNewFatalFailureHelper(); virtual ~HasNewFatalFailureHelper(); virtual void ReportTestPartResult(const TestPartResult& result); bool has_new_fatal_failure() const { return has_new_fatal_failure_; } private: bool has_new_fatal_failure_; TestPartResultReporterInterface* original_reporter_; GTEST_DISALLOW_COPY_AND_ASSIGN_(HasNewFatalFailureHelper); }; } // namespace internal } // namespace testing #endif // GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_ // Copyright 2008 Google Inc. // All Rights Reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Author: [email protected] (Zhanyong Wan) #ifndef GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_ #define GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_ // This header implements typed tests and type-parameterized tests. // Typed (aka type-driven) tests repeat the same test for types in a // list. You must know which types you want to test with when writing // typed tests. Here's how you do it: #if 0 // First, define a fixture class template. It should be parameterized // by a type. Remember to derive it from testing::Test. template <typename T> class FooTest : public testing::Test { public: ... typedef std::list<T> List; static T shared_; T value_; }; // Next, associate a list of types with the test case, which will be // repeated for each type in the list. The typedef is necessary for // the macro to parse correctly. typedef testing::Types<char, int, unsigned int> MyTypes; TYPED_TEST_CASE(FooTest, MyTypes); // If the type list contains only one type, you can write that type // directly without Types<...>: // TYPED_TEST_CASE(FooTest, int); // Then, use TYPED_TEST() instead of TEST_F() to define as many typed // tests for this test case as you want. TYPED_TEST(FooTest, DoesBlah) { // Inside a test, refer to TypeParam to get the type parameter. // Since we are inside a derived class template, C++ requires use to // visit the members of FooTest via 'this'. TypeParam n = this->value_; // To visit static members of the fixture, add the TestFixture:: // prefix. n += TestFixture::shared_; // To refer to typedefs in the fixture, add the "typename // TestFixture::" prefix. typename TestFixture::List values; values.push_back(n); ... } TYPED_TEST(FooTest, HasPropertyA) { ... } #endif // 0 // Type-parameterized tests are abstract test patterns parameterized // by a type. Compared with typed tests, type-parameterized tests // allow you to define the test pattern without knowing what the type // parameters are. The defined pattern can be instantiated with // different types any number of times, in any number of translation // units. // // If you are designing an interface or concept, you can define a // suite of type-parameterized tests to verify properties that any // valid implementation of the interface/concept should have. Then, // each implementation can easily instantiate the test suite to verify // that it conforms to the requirements, without having to write // similar tests repeatedly. Here's an example: #if 0 // First, define a fixture class template. It should be parameterized // by a type. Remember to derive it from testing::Test. template <typename T> class FooTest : public testing::Test { ... }; // Next, declare that you will define a type-parameterized test case // (the _P suffix is for "parameterized" or "pattern", whichever you // prefer): TYPED_TEST_CASE_P(FooTest); // Then, use TYPED_TEST_P() to define as many type-parameterized tests // for this type-parameterized test case as you want. TYPED_TEST_P(FooTest, DoesBlah) { // Inside a test, refer to TypeParam to get the type parameter. TypeParam n = 0; ... } TYPED_TEST_P(FooTest, HasPropertyA) { ... } // Now the tricky part: you need to register all test patterns before // you can instantiate them. The first argument of the macro is the // test case name; the rest are the names of the tests in this test // case. REGISTER_TYPED_TEST_CASE_P(FooTest, DoesBlah, HasPropertyA); // Finally, you are free to instantiate the pattern with the types you // want. If you put the above code in a header file, you can #include // it in multiple C++ source files and instantiate it multiple times. // // To distinguish different instances of the pattern, the first // argument to the INSTANTIATE_* macro is a prefix that will be added // to the actual test case name. Remember to pick unique prefixes for // different instances. typedef testing::Types<char, int, unsigned int> MyTypes; INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes); // If the type list contains only one type, you can write that type // directly without Types<...>: // INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, int); #endif // 0 // Implements typed tests. #if GTEST_HAS_TYPED_TEST // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // Expands to the name of the typedef for the type parameters of the // given test case. # define GTEST_TYPE_PARAMS_(TestCaseName) gtest_type_params_##TestCaseName##_ // The 'Types' template argument below must have spaces around it // since some compilers may choke on '>>' when passing a template // instance (e.g. Types<int>) # define TYPED_TEST_CASE(CaseName, Types) \ typedef ::testing::internal::TypeList< Types >::type \ GTEST_TYPE_PARAMS_(CaseName) # define TYPED_TEST(CaseName, TestName) \ template <typename gtest_TypeParam_> \ class GTEST_TEST_CLASS_NAME_(CaseName, TestName) \ : public CaseName<gtest_TypeParam_> { \ private: \ typedef CaseName<gtest_TypeParam_> TestFixture; \ typedef gtest_TypeParam_ TypeParam; \ virtual void TestBody(); \ }; \ bool gtest_##CaseName##_##TestName##_registered_ GTEST_ATTRIBUTE_UNUSED_ = \ ::testing::internal::TypeParameterizedTest< \ CaseName, \ ::testing::internal::TemplateSel< \ GTEST_TEST_CLASS_NAME_(CaseName, TestName)>, \ GTEST_TYPE_PARAMS_(CaseName)>::Register(\ "", ::testing::internal::CodeLocation(__FILE__, __LINE__), \ #CaseName, #TestName, 0); \ template <typename gtest_TypeParam_> \ void GTEST_TEST_CLASS_NAME_(CaseName, TestName)<gtest_TypeParam_>::TestBody() #endif // GTEST_HAS_TYPED_TEST // Implements type-parameterized tests. #if GTEST_HAS_TYPED_TEST_P // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // Expands to the namespace name that the type-parameterized tests for // the given type-parameterized test case are defined in. The exact // name of the namespace is subject to change without notice. # define GTEST_CASE_NAMESPACE_(TestCaseName) \ gtest_case_##TestCaseName##_ // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // Expands to the name of the variable used to remember the names of // the defined tests in the given test case. # define GTEST_TYPED_TEST_CASE_P_STATE_(TestCaseName) \ gtest_typed_test_case_p_state_##TestCaseName##_ // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE DIRECTLY. // // Expands to the name of the variable used to remember the names of // the registered tests in the given test case. # define GTEST_REGISTERED_TEST_NAMES_(TestCaseName) \ gtest_registered_test_names_##TestCaseName##_ // The variables defined in the type-parameterized test macros are // static as typically these macros are used in a .h file that can be // #included in multiple translation units linked together. # define TYPED_TEST_CASE_P(CaseName) \ static ::testing::internal::TypedTestCasePState \ GTEST_TYPED_TEST_CASE_P_STATE_(CaseName) # define TYPED_TEST_P(CaseName, TestName) \ namespace GTEST_CASE_NAMESPACE_(CaseName) { \ template <typename gtest_TypeParam_> \ class TestName : public CaseName<gtest_TypeParam_> { \ private: \ typedef CaseName<gtest_TypeParam_> TestFixture; \ typedef gtest_TypeParam_ TypeParam; \ virtual void TestBody(); \ }; \ static bool gtest_##TestName##_defined_ GTEST_ATTRIBUTE_UNUSED_ = \ GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).AddTestName(\ __FILE__, __LINE__, #CaseName, #TestName); \ } \ template <typename gtest_TypeParam_> \ void GTEST_CASE_NAMESPACE_(CaseName)::TestName<gtest_TypeParam_>::TestBody() # define REGISTER_TYPED_TEST_CASE_P(CaseName, ...) \ namespace GTEST_CASE_NAMESPACE_(CaseName) { \ typedef ::testing::internal::Templates<__VA_ARGS__>::type gtest_AllTests_; \ } \ static const char* const GTEST_REGISTERED_TEST_NAMES_(CaseName) = \ GTEST_TYPED_TEST_CASE_P_STATE_(CaseName).VerifyRegisteredTestNames(\ __FILE__, __LINE__, #__VA_ARGS__) // The 'Types' template argument below must have spaces around it // since some compilers may choke on '>>' when passing a template // instance (e.g. Types<int>) # define INSTANTIATE_TYPED_TEST_CASE_P(Prefix, CaseName, Types) \ bool gtest_##Prefix##_##CaseName GTEST_ATTRIBUTE_UNUSED_ = \ ::testing::internal::TypeParameterizedTestCase<CaseName, \ GTEST_CASE_NAMESPACE_(CaseName)::gtest_AllTests_, \ ::testing::internal::TypeList< Types >::type>::Register(\ #Prefix, \ ::testing::internal::CodeLocation(__FILE__, __LINE__), \ &GTEST_TYPED_TEST_CASE_P_STATE_(CaseName), \ #CaseName, GTEST_REGISTERED_TEST_NAMES_(CaseName)) #endif // GTEST_HAS_TYPED_TEST_P #endif // GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_ // Depending on the platform, different string classes are available. // On Linux, in addition to ::std::string, Google also makes use of // class ::string, which has the same interface as ::std::string, but // has a different implementation. // // You can define GTEST_HAS_GLOBAL_STRING to 1 to indicate that // ::string is available AND is a distinct type to ::std::string, or // define it to 0 to indicate otherwise. // // If ::std::string and ::string are the same class on your platform // due to aliasing, you should define GTEST_HAS_GLOBAL_STRING to 0. // // If you do not define GTEST_HAS_GLOBAL_STRING, it is defined // heuristically. namespace testing { // Declares the flags. // This flag temporary enables the disabled tests. GTEST_DECLARE_bool_(also_run_disabled_tests); // This flag brings the debugger on an assertion failure. GTEST_DECLARE_bool_(break_on_failure); // This flag controls whether Google Test catches all test-thrown exceptions // and logs them as failures. GTEST_DECLARE_bool_(catch_exceptions); // This flag enables using colors in terminal output. Available values are // "yes" to enable colors, "no" (disable colors), or "auto" (the default) // to let Google Test decide. GTEST_DECLARE_string_(color); // This flag sets up the filter to select by name using a glob pattern // the tests to run. If the filter is not given all tests are executed. GTEST_DECLARE_string_(filter); // This flag causes the Google Test to list tests. None of the tests listed // are actually run if the flag is provided. GTEST_DECLARE_bool_(list_tests); // This flag controls whether Google Test emits a detailed XML report to a file // in addition to its normal textual output. GTEST_DECLARE_string_(output); // This flags control whether Google Test prints the elapsed time for each // test. GTEST_DECLARE_bool_(print_time); // This flag specifies the random number seed. GTEST_DECLARE_int32_(random_seed); // This flag sets how many times the tests are repeated. The default value // is 1. If the value is -1 the tests are repeating forever. GTEST_DECLARE_int32_(repeat); // This flag controls whether Google Test includes Google Test internal // stack frames in failure stack traces. GTEST_DECLARE_bool_(show_internal_stack_frames); // When this flag is specified, tests' order is randomized on every iteration. GTEST_DECLARE_bool_(shuffle); // This flag specifies the maximum number of stack frames to be // printed in a failure message. GTEST_DECLARE_int32_(stack_trace_depth); // When this flag is specified, a failed assertion will throw an // exception if exceptions are enabled, or exit the program with a // non-zero code otherwise. GTEST_DECLARE_bool_(throw_on_failure); // When this flag is set with a "host:port" string, on supported // platforms test results are streamed to the specified port on // the specified host machine. GTEST_DECLARE_string_(stream_result_to); // The upper limit for valid stack trace depths. const int kMaxStackTraceDepth = 100; namespace internal { class AssertHelper; class DefaultGlobalTestPartResultReporter; class ExecDeathTest; class NoExecDeathTest; class FinalSuccessChecker; class GTestFlagSaver; class StreamingListenerTest; class TestResultAccessor; class TestEventListenersAccessor; class TestEventRepeater; class UnitTestRecordPropertyTestHelper; class WindowsDeathTest; class UnitTestImpl* GetUnitTestImpl(); void ReportFailureInUnknownLocation(TestPartResult::Type result_type, const std::string& message); } // namespace internal // The friend relationship of some of these classes is cyclic. // If we don't forward declare them the compiler might confuse the classes // in friendship clauses with same named classes on the scope. class Test; class TestCase; class TestInfo; class UnitTest; // A class for indicating whether an assertion was successful. When // the assertion wasn't successful, the AssertionResult object // remembers a non-empty message that describes how it failed. // // To create an instance of this class, use one of the factory functions // (AssertionSuccess() and AssertionFailure()). // // This class is useful for two purposes: // 1. Defining predicate functions to be used with Boolean test assertions // EXPECT_TRUE/EXPECT_FALSE and their ASSERT_ counterparts // 2. Defining predicate-format functions to be // used with predicate assertions (ASSERT_PRED_FORMAT*, etc). // // For example, if you define IsEven predicate: // // testing::AssertionResult IsEven(int n) { // if ((n % 2) == 0) // return testing::AssertionSuccess(); // else // return testing::AssertionFailure() << n << " is odd"; // } // // Then the failed expectation EXPECT_TRUE(IsEven(Fib(5))) // will print the message // // Value of: IsEven(Fib(5)) // Actual: false (5 is odd) // Expected: true // // instead of a more opaque // // Value of: IsEven(Fib(5)) // Actual: false // Expected: true // // in case IsEven is a simple Boolean predicate. // // If you expect your predicate to be reused and want to support informative // messages in EXPECT_FALSE and ASSERT_FALSE (negative assertions show up // about half as often as positive ones in our tests), supply messages for // both success and failure cases: // // testing::AssertionResult IsEven(int n) { // if ((n % 2) == 0) // return testing::AssertionSuccess() << n << " is even"; // else // return testing::AssertionFailure() << n << " is odd"; // } // // Then a statement EXPECT_FALSE(IsEven(Fib(6))) will print // // Value of: IsEven(Fib(6)) // Actual: true (8 is even) // Expected: false // // NB: Predicates that support negative Boolean assertions have reduced // performance in positive ones so be careful not to use them in tests // that have lots (tens of thousands) of positive Boolean assertions. // // To use this class with EXPECT_PRED_FORMAT assertions such as: // // // Verifies that Foo() returns an even number. // EXPECT_PRED_FORMAT1(IsEven, Foo()); // // you need to define: // // testing::AssertionResult IsEven(const char* expr, int n) { // if ((n % 2) == 0) // return testing::AssertionSuccess(); // else // return testing::AssertionFailure() // << "Expected: " << expr << " is even\n Actual: it's " << n; // } // // If Foo() returns 5, you will see the following message: // // Expected: Foo() is even // Actual: it's 5 // class GTEST_API_ AssertionResult { public: // Copy constructor. // Used in EXPECT_TRUE/FALSE(assertion_result). AssertionResult(const AssertionResult& other); GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 /* forcing value to bool */) // Used in the EXPECT_TRUE/FALSE(bool_expression). // // T must be contextually convertible to bool. // // The second parameter prevents this overload from being considered if // the argument is implicitly convertible to AssertionResult. In that case // we want AssertionResult's copy constructor to be used. template <typename T> explicit AssertionResult( const T& success, typename internal::EnableIf< !internal::ImplicitlyConvertible<T, AssertionResult>::value>::type* /*enabler*/ = NULL) : success_(success) {} GTEST_DISABLE_MSC_WARNINGS_POP_() // Assignment operator. AssertionResult& operator=(AssertionResult other) { swap(other); return *this; } // Returns true iff the assertion succeeded. operator bool() const { return success_; } // NOLINT // Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE. AssertionResult operator!() const; // Returns the text streamed into this AssertionResult. Test assertions // use it when they fail (i.e., the predicate's outcome doesn't match the // assertion's expectation). When nothing has been streamed into the // object, returns an empty string. const char* message() const { return message_.get() != NULL ? message_->c_str() : ""; } // TODO([email protected]): Remove this after making sure no clients use it. // Deprecated; please use message() instead. const char* failure_message() const { return message(); } // Streams a custom failure message into this object. template <typename T> AssertionResult& operator<<(const T& value) { AppendMessage(Message() << value); return *this; } // Allows streaming basic output manipulators such as endl or flush into // this object. AssertionResult& operator<<( ::std::ostream& (*basic_manipulator)(::std::ostream& stream)) { AppendMessage(Message() << basic_manipulator); return *this; } private: // Appends the contents of message to message_. void AppendMessage(const Message& a_message) { if (message_.get() == NULL) message_.reset(new ::std::string); message_->append(a_message.GetString().c_str()); } // Swap the contents of this AssertionResult with other. void swap(AssertionResult& other); // Stores result of the assertion predicate. bool success_; // Stores the message describing the condition in case the expectation // construct is not satisfied with the predicate's outcome. // Referenced via a pointer to avoid taking too much stack frame space // with test assertions. internal::scoped_ptr< ::std::string> message_; }; // Makes a successful assertion result. GTEST_API_ AssertionResult AssertionSuccess(); // Makes a failed assertion result. GTEST_API_ AssertionResult AssertionFailure(); // Makes a failed assertion result with the given failure message. // Deprecated; use AssertionFailure() << msg. GTEST_API_ AssertionResult AssertionFailure(const Message& msg); // The abstract class that all tests inherit from. // // In Google Test, a unit test program contains one or many TestCases, and // each TestCase contains one or many Tests. // // When you define a test using the TEST macro, you don't need to // explicitly derive from Test - the TEST macro automatically does // this for you. // // The only time you derive from Test is when defining a test fixture // to be used a TEST_F. For example: // // class FooTest : public testing::Test { // protected: // void SetUp() override { ... } // void TearDown() override { ... } // ... // }; // // TEST_F(FooTest, Bar) { ... } // TEST_F(FooTest, Baz) { ... } // // Test is not copyable. class GTEST_API_ Test { public: friend class TestInfo; // Defines types for pointers to functions that set up and tear down // a test case. typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc; typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc; // The d'tor is virtual as we intend to inherit from Test. virtual ~Test(); // Sets up the stuff shared by all tests in this test case. // // Google Test will call Foo::SetUpTestCase() before running the first // test in test case Foo. Hence a sub-class can define its own // SetUpTestCase() method to shadow the one defined in the super // class. static void SetUpTestCase() {} // Tears down the stuff shared by all tests in this test case. // // Google Test will call Foo::TearDownTestCase() after running the last // test in test case Foo. Hence a sub-class can define its own // TearDownTestCase() method to shadow the one defined in the super // class. static void TearDownTestCase() {} // Returns true iff the current test has a fatal failure. static bool HasFatalFailure(); // Returns true iff the current test has a non-fatal failure. static bool HasNonfatalFailure(); // Returns true iff the current test has a (either fatal or // non-fatal) failure. static bool HasFailure() { return HasFatalFailure() || HasNonfatalFailure(); } // Logs a property for the current test, test case, or for the entire // invocation of the test program when used outside of the context of a // test case. Only the last value for a given key is remembered. These // are public static so they can be called from utility functions that are // not members of the test fixture. Calls to RecordProperty made during // lifespan of the test (from the moment its constructor starts to the // moment its destructor finishes) will be output in XML as attributes of // the <testcase> element. Properties recorded from fixture's // SetUpTestCase or TearDownTestCase are logged as attributes of the // corresponding <testsuite> element. Calls to RecordProperty made in the // global context (before or after invocation of RUN_ALL_TESTS and from // SetUp/TearDown method of Environment objects registered with Google // Test) will be output as attributes of the <testsuites> element. static void RecordProperty(const std::string& key, const std::string& value); static void RecordProperty(const std::string& key, int value); protected: // Creates a Test object. Test(); // Sets up the test fixture. virtual void SetUp(); // Tears down the test fixture. virtual void TearDown(); private: // Returns true iff the current test has the same fixture class as // the first test in the current test case. static bool HasSameFixtureClass(); // Runs the test after the test fixture has been set up. // // A sub-class must implement this to define the test logic. // // DO NOT OVERRIDE THIS FUNCTION DIRECTLY IN A USER PROGRAM. // Instead, use the TEST or TEST_F macro. virtual void TestBody() = 0; // Sets up, executes, and tears down the test. void Run(); // Deletes self. We deliberately pick an unusual name for this // internal method to avoid clashing with names used in user TESTs. void DeleteSelf_() { delete this; } const internal::scoped_ptr< GTEST_FLAG_SAVER_ > gtest_flag_saver_; // Often a user misspells SetUp() as Setup() and spends a long time // wondering why it is never called by Google Test. The declaration of // the following method is solely for catching such an error at // compile time: // // - The return type is deliberately chosen to be not void, so it // will be a conflict if void Setup() is declared in the user's // test fixture. // // - This method is private, so it will be another compiler error // if the method is called from the user's test fixture. // // DO NOT OVERRIDE THIS FUNCTION. // // If you see an error about overriding the following function or // about it being private, you have mis-spelled SetUp() as Setup(). struct Setup_should_be_spelled_SetUp {}; virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; } // We disallow copying Tests. GTEST_DISALLOW_COPY_AND_ASSIGN_(Test); }; typedef internal::TimeInMillis TimeInMillis; // A copyable object representing a user specified test property which can be // output as a key/value string pair. // // Don't inherit from TestProperty as its destructor is not virtual. class TestProperty { public: // C'tor. TestProperty does NOT have a default constructor. // Always use this constructor (with parameters) to create a // TestProperty object. TestProperty(const std::string& a_key, const std::string& a_value) : key_(a_key), value_(a_value) { } // Gets the user supplied key. const char* key() const { return key_.c_str(); } // Gets the user supplied value. const char* value() const { return value_.c_str(); } // Sets a new value, overriding the one supplied in the constructor. void SetValue(const std::string& new_value) { value_ = new_value; } private: // The key supplied by the user. std::string key_; // The value supplied by the user. std::string value_; }; // The result of a single Test. This includes a list of // TestPartResults, a list of TestProperties, a count of how many // death tests there are in the Test, and how much time it took to run // the Test. // // TestResult is not copyable. class GTEST_API_ TestResult { public: // Creates an empty TestResult. TestResult(); // D'tor. Do not inherit from TestResult. ~TestResult(); // Gets the number of all test parts. This is the sum of the number // of successful test parts and the number of failed test parts. int total_part_count() const; // Returns the number of the test properties. int test_property_count() const; // Returns true iff the test passed (i.e. no test part failed). bool Passed() const { return !Failed(); } // Returns true iff the test failed. bool Failed() const; // Returns true iff the test fatally failed. bool HasFatalFailure() const; // Returns true iff the test has a non-fatal failure. bool HasNonfatalFailure() const; // Returns the elapsed time, in milliseconds. TimeInMillis elapsed_time() const { return elapsed_time_; } // Returns the i-th test part result among all the results. i can range // from 0 to test_property_count() - 1. If i is not in that range, aborts // the program. const TestPartResult& GetTestPartResult(int i) const; // Returns the i-th test property. i can range from 0 to // test_property_count() - 1. If i is not in that range, aborts the // program. const TestProperty& GetTestProperty(int i) const; private: friend class TestInfo; friend class TestCase; friend class UnitTest; friend class internal::DefaultGlobalTestPartResultReporter; friend class internal::ExecDeathTest; friend class internal::TestResultAccessor; friend class internal::UnitTestImpl; friend class internal::WindowsDeathTest; // Gets the vector of TestPartResults. const std::vector<TestPartResult>& test_part_results() const { return test_part_results_; } // Gets the vector of TestProperties. const std::vector<TestProperty>& test_properties() const { return test_properties_; } // Sets the elapsed time. void set_elapsed_time(TimeInMillis elapsed) { elapsed_time_ = elapsed; } // Adds a test property to the list. The property is validated and may add // a non-fatal failure if invalid (e.g., if it conflicts with reserved // key names). If a property is already recorded for the same key, the // value will be updated, rather than storing multiple values for the same // key. xml_element specifies the element for which the property is being // recorded and is used for validation. void RecordProperty(const std::string& xml_element, const TestProperty& test_property); // Adds a failure if the key is a reserved attribute of Google Test // testcase tags. Returns true if the property is valid. // TODO(russr): Validate attribute names are legal and human readable. static bool ValidateTestProperty(const std::string& xml_element, const TestProperty& test_property); // Adds a test part result to the list. void AddTestPartResult(const TestPartResult& test_part_result); // Returns the death test count. int death_test_count() const { return death_test_count_; } // Increments the death test count, returning the new count. int increment_death_test_count() { return ++death_test_count_; } // Clears the test part results. void ClearTestPartResults(); // Clears the object. void Clear(); // Protects mutable state of the property vector and of owned // properties, whose values may be updated. internal::Mutex test_properites_mutex_; // The vector of TestPartResults std::vector<TestPartResult> test_part_results_; // The vector of TestProperties std::vector<TestProperty> test_properties_; // Running count of death tests. int death_test_count_; // The elapsed time, in milliseconds. TimeInMillis elapsed_time_; // We disallow copying TestResult. GTEST_DISALLOW_COPY_AND_ASSIGN_(TestResult); }; // class TestResult // A TestInfo object stores the following information about a test: // // Test case name // Test name // Whether the test should be run // A function pointer that creates the test object when invoked // Test result // // The constructor of TestInfo registers itself with the UnitTest // singleton such that the RUN_ALL_TESTS() macro knows which tests to // run. class GTEST_API_ TestInfo { public: // Destructs a TestInfo object. This function is not virtual, so // don't inherit from TestInfo. ~TestInfo(); // Returns the test case name. const char* test_case_name() const { return test_case_name_.c_str(); } // Returns the test name. const char* name() const { return name_.c_str(); } // Returns the name of the parameter type, or NULL if this is not a typed // or a type-parameterized test. const char* type_param() const { if (type_param_.get() != NULL) return type_param_->c_str(); return NULL; } // Returns the text representation of the value parameter, or NULL if this // is not a value-parameterized test. const char* value_param() const { if (value_param_.get() != NULL) return value_param_->c_str(); return NULL; } // Returns the file name where this test is defined. const char* file() const { return location_.file.c_str(); } // Returns the line where this test is defined. int line() const { return location_.line; } // Returns true if this test should run, that is if the test is not // disabled (or it is disabled but the also_run_disabled_tests flag has // been specified) and its full name matches the user-specified filter. // // Google Test allows the user to filter the tests by their full names. // The full name of a test Bar in test case Foo is defined as // "Foo.Bar". Only the tests that match the filter will run. // // A filter is a colon-separated list of glob (not regex) patterns, // optionally followed by a '-' and a colon-separated list of // negative patterns (tests to exclude). A test is run if it // matches one of the positive patterns and does not match any of // the negative patterns. // // For example, *A*:Foo.* is a filter that matches any string that // contains the character 'A' or starts with "Foo.". bool should_run() const { return should_run_; } // Returns true iff this test will appear in the XML report. bool is_reportable() const { // For now, the XML report includes all tests matching the filter. // In the future, we may trim tests that are excluded because of // sharding. return matches_filter_; } // Returns the result of the test. const TestResult* result() const { return &result_; } private: #if GTEST_HAS_DEATH_TEST friend class internal::DefaultDeathTestFactory; #endif // GTEST_HAS_DEATH_TEST friend class Test; friend class TestCase; friend class internal::UnitTestImpl; friend class internal::StreamingListenerTest; friend TestInfo* internal::MakeAndRegisterTestInfo( const char* test_case_name, const char* name, const char* type_param, const char* value_param, internal::CodeLocation code_location, internal::TypeId fixture_class_id, Test::SetUpTestCaseFunc set_up_tc, Test::TearDownTestCaseFunc tear_down_tc, internal::TestFactoryBase* factory); // Constructs a TestInfo object. The newly constructed instance assumes // ownership of the factory object. TestInfo(const std::string& test_case_name, const std::string& name, const char* a_type_param, // NULL if not a type-parameterized test const char* a_value_param, // NULL if not a value-parameterized test internal::CodeLocation a_code_location, internal::TypeId fixture_class_id, internal::TestFactoryBase* factory); // Increments the number of death tests encountered in this test so // far. int increment_death_test_count() { return result_.increment_death_test_count(); } // Creates the test object, runs it, records its result, and then // deletes it. void Run(); static void ClearTestResult(TestInfo* test_info) { test_info->result_.Clear(); } // These fields are immutable properties of the test. const std::string test_case_name_; // Test case name const std::string name_; // Test name // Name of the parameter type, or NULL if this is not a typed or a // type-parameterized test. const internal::scoped_ptr<const ::std::string> type_param_; // Text representation of the value parameter, or NULL if this is not a // value-parameterized test. const internal::scoped_ptr<const ::std::string> value_param_; internal::CodeLocation location_; const internal::TypeId fixture_class_id_; // ID of the test fixture class bool should_run_; // True iff this test should run bool is_disabled_; // True iff this test is disabled bool matches_filter_; // True if this test matches the // user-specified filter. internal::TestFactoryBase* const factory_; // The factory that creates // the test object // This field is mutable and needs to be reset before running the // test for the second time. TestResult result_; GTEST_DISALLOW_COPY_AND_ASSIGN_(TestInfo); }; // A test case, which consists of a vector of TestInfos. // // TestCase is not copyable. class GTEST_API_ TestCase { public: // Creates a TestCase with the given name. // // TestCase does NOT have a default constructor. Always use this // constructor to create a TestCase object. // // Arguments: // // name: name of the test case // a_type_param: the name of the test's type parameter, or NULL if // this is not a type-parameterized test. // set_up_tc: pointer to the function that sets up the test case // tear_down_tc: pointer to the function that tears down the test case TestCase(const char* name, const char* a_type_param, Test::SetUpTestCaseFunc set_up_tc, Test::TearDownTestCaseFunc tear_down_tc); // Destructor of TestCase. virtual ~TestCase(); // Gets the name of the TestCase. const char* name() const { return name_.c_str(); } // Returns the name of the parameter type, or NULL if this is not a // type-parameterized test case. const char* type_param() const { if (type_param_.get() != NULL) return type_param_->c_str(); return NULL; } // Returns true if any test in this test case should run. bool should_run() const { return should_run_; } // Gets the number of successful tests in this test case. int successful_test_count() const; // Gets the number of failed tests in this test case. int failed_test_count() const; // Gets the number of disabled tests that will be reported in the XML report. int reportable_disabled_test_count() const; // Gets the number of disabled tests in this test case. int disabled_test_count() const; // Gets the number of tests to be printed in the XML report. int reportable_test_count() const; // Get the number of tests in this test case that should run. int test_to_run_count() const; // Gets the number of all tests in this test case. int total_test_count() const; // Returns true iff the test case passed. bool Passed() const { return !Failed(); } // Returns true iff the test case failed. bool Failed() const { return failed_test_count() > 0; } // Returns the elapsed time, in milliseconds. TimeInMillis elapsed_time() const { return elapsed_time_; } // Returns the i-th test among all the tests. i can range from 0 to // total_test_count() - 1. If i is not in that range, returns NULL. const TestInfo* GetTestInfo(int i) const; // Returns the TestResult that holds test properties recorded during // execution of SetUpTestCase and TearDownTestCase. const TestResult& ad_hoc_test_result() const { return ad_hoc_test_result_; } private: friend class Test; friend class internal::UnitTestImpl; // Gets the (mutable) vector of TestInfos in this TestCase. std::vector<TestInfo*>& test_info_list() { return test_info_list_; } // Gets the (immutable) vector of TestInfos in this TestCase. const std::vector<TestInfo*>& test_info_list() const { return test_info_list_; } // Returns the i-th test among all the tests. i can range from 0 to // total_test_count() - 1. If i is not in that range, returns NULL. TestInfo* GetMutableTestInfo(int i); // Sets the should_run member. void set_should_run(bool should) { should_run_ = should; } // Adds a TestInfo to this test case. Will delete the TestInfo upon // destruction of the TestCase object. void AddTestInfo(TestInfo * test_info); // Clears the results of all tests in this test case. void ClearResult(); // Clears the results of all tests in the given test case. static void ClearTestCaseResult(TestCase* test_case) { test_case->ClearResult(); } // Runs every test in this TestCase. void Run(); // Runs SetUpTestCase() for this TestCase. This wrapper is needed // for catching exceptions thrown from SetUpTestCase(). void RunSetUpTestCase() { (*set_up_tc_)(); } // Runs TearDownTestCase() for this TestCase. This wrapper is // needed for catching exceptions thrown from TearDownTestCase(). void RunTearDownTestCase() { (*tear_down_tc_)(); } // Returns true iff test passed. static bool TestPassed(const TestInfo* test_info) { return test_info->should_run() && test_info->result()->Passed(); } // Returns true iff test failed. static bool TestFailed(const TestInfo* test_info) { return test_info->should_run() && test_info->result()->Failed(); } // Returns true iff the test is disabled and will be reported in the XML // report. static bool TestReportableDisabled(const TestInfo* test_info) { return test_info->is_reportable() && test_info->is_disabled_; } // Returns true iff test is disabled. static bool TestDisabled(const TestInfo* test_info) { return test_info->is_disabled_; } // Returns true iff this test will appear in the XML report. static bool TestReportable(const TestInfo* test_info) { return test_info->is_reportable(); } // Returns true if the given test should run. static bool ShouldRunTest(const TestInfo* test_info) { return test_info->should_run(); } // Shuffles the tests in this test case. void ShuffleTests(internal::Random* random); // Restores the test order to before the first shuffle. void UnshuffleTests(); // Name of the test case. std::string name_; // Name of the parameter type, or NULL if this is not a typed or a // type-parameterized test. const internal::scoped_ptr<const ::std::string> type_param_; // The vector of TestInfos in their original order. It owns the // elements in the vector. std::vector<TestInfo*> test_info_list_; // Provides a level of indirection for the test list to allow easy // shuffling and restoring the test order. The i-th element in this // vector is the index of the i-th test in the shuffled test list. std::vector<int> test_indices_; // Pointer to the function that sets up the test case. Test::SetUpTestCaseFunc set_up_tc_; // Pointer to the function that tears down the test case. Test::TearDownTestCaseFunc tear_down_tc_; // True iff any test in this test case should run. bool should_run_; // Elapsed time, in milliseconds. TimeInMillis elapsed_time_; // Holds test properties recorded during execution of SetUpTestCase and // TearDownTestCase. TestResult ad_hoc_test_result_; // We disallow copying TestCases. GTEST_DISALLOW_COPY_AND_ASSIGN_(TestCase); }; // An Environment object is capable of setting up and tearing down an // environment. You should subclass this to define your own // environment(s). // // An Environment object does the set-up and tear-down in virtual // methods SetUp() and TearDown() instead of the constructor and the // destructor, as: // // 1. You cannot safely throw from a destructor. This is a problem // as in some cases Google Test is used where exceptions are enabled, and // we may want to implement ASSERT_* using exceptions where they are // available. // 2. You cannot use ASSERT_* directly in a constructor or // destructor. class Environment { public: // The d'tor is virtual as we need to subclass Environment. virtual ~Environment() {} // Override this to define how to set up the environment. virtual void SetUp() {} // Override this to define how to tear down the environment. virtual void TearDown() {} private: // If you see an error about overriding the following function or // about it being private, you have mis-spelled SetUp() as Setup(). struct Setup_should_be_spelled_SetUp {}; virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; } }; // The interface for tracing execution of tests. The methods are organized in // the order the corresponding events are fired. class TestEventListener { public: virtual ~TestEventListener() {} // Fired before any test activity starts. virtual void OnTestProgramStart(const UnitTest& unit_test) = 0; // Fired before each iteration of tests starts. There may be more than // one iteration if GTEST_FLAG(repeat) is set. iteration is the iteration // index, starting from 0. virtual void OnTestIterationStart(const UnitTest& unit_test, int iteration) = 0; // Fired before environment set-up for each iteration of tests starts. virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test) = 0; // Fired after environment set-up for each iteration of tests ends. virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test) = 0; // Fired before the test case starts. virtual void OnTestCaseStart(const TestCase& test_case) = 0; // Fired before the test starts. virtual void OnTestStart(const TestInfo& test_info) = 0; // Fired after a failed assertion or a SUCCEED() invocation. virtual void OnTestPartResult(const TestPartResult& test_part_result) = 0; // Fired after the test ends. virtual void OnTestEnd(const TestInfo& test_info) = 0; // Fired after the test case ends. virtual void OnTestCaseEnd(const TestCase& test_case) = 0; // Fired before environment tear-down for each iteration of tests starts. virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test) = 0; // Fired after environment tear-down for each iteration of tests ends. virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test) = 0; // Fired after each iteration of tests finishes. virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration) = 0; // Fired after all test activities have ended. virtual void OnTestProgramEnd(const UnitTest& unit_test) = 0; }; // The convenience class for users who need to override just one or two // methods and are not concerned that a possible change to a signature of // the methods they override will not be caught during the build. For // comments about each method please see the definition of TestEventListener // above. class EmptyTestEventListener : public TestEventListener { public: virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {} virtual void OnTestIterationStart(const UnitTest& /*unit_test*/, int /*iteration*/) {} virtual void OnEnvironmentsSetUpStart(const UnitTest& /*unit_test*/) {} virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) {} virtual void OnTestCaseStart(const TestCase& /*test_case*/) {} virtual void OnTestStart(const TestInfo& /*test_info*/) {} virtual void OnTestPartResult(const TestPartResult& /*test_part_result*/) {} virtual void OnTestEnd(const TestInfo& /*test_info*/) {} virtual void OnTestCaseEnd(const TestCase& /*test_case*/) {} virtual void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) {} virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) {} virtual void OnTestIterationEnd(const UnitTest& /*unit_test*/, int /*iteration*/) {} virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {} }; // TestEventListeners lets users add listeners to track events in Google Test. class GTEST_API_ TestEventListeners { public: TestEventListeners(); ~TestEventListeners(); // Appends an event listener to the end of the list. Google Test assumes // the ownership of the listener (i.e. it will delete the listener when // the test program finishes). void Append(TestEventListener* listener); // Removes the given event listener from the list and returns it. It then // becomes the caller's responsibility to delete the listener. Returns // NULL if the listener is not found in the list. TestEventListener* Release(TestEventListener* listener); // Returns the standard listener responsible for the default console // output. Can be removed from the listeners list to shut down default // console output. Note that removing this object from the listener list // with Release transfers its ownership to the caller and makes this // function return NULL the next time. TestEventListener* default_result_printer() const { return default_result_printer_; } // Returns the standard listener responsible for the default XML output // controlled by the --gtest_output=xml flag. Can be removed from the // listeners list by users who want to shut down the default XML output // controlled by this flag and substitute it with custom one. Note that // removing this object from the listener list with Release transfers its // ownership to the caller and makes this function return NULL the next // time. TestEventListener* default_xml_generator() const { return default_xml_generator_; } private: friend class TestCase; friend class TestInfo; friend class internal::DefaultGlobalTestPartResultReporter; friend class internal::NoExecDeathTest; friend class internal::TestEventListenersAccessor; friend class internal::UnitTestImpl; // Returns repeater that broadcasts the TestEventListener events to all // subscribers. TestEventListener* repeater(); // Sets the default_result_printer attribute to the provided listener. // The listener is also added to the listener list and previous // default_result_printer is removed from it and deleted. The listener can // also be NULL in which case it will not be added to the list. Does // nothing if the previous and the current listener objects are the same. void SetDefaultResultPrinter(TestEventListener* listener); // Sets the default_xml_generator attribute to the provided listener. The // listener is also added to the listener list and previous // default_xml_generator is removed from it and deleted. The listener can // also be NULL in which case it will not be added to the list. Does // nothing if the previous and the current listener objects are the same. void SetDefaultXmlGenerator(TestEventListener* listener); // Controls whether events will be forwarded by the repeater to the // listeners in the list. bool EventForwardingEnabled() const; void SuppressEventForwarding(); // The actual list of listeners. internal::TestEventRepeater* repeater_; // Listener responsible for the standard result output. TestEventListener* default_result_printer_; // Listener responsible for the creation of the XML output file. TestEventListener* default_xml_generator_; // We disallow copying TestEventListeners. GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventListeners); }; // A UnitTest consists of a vector of TestCases. // // This is a singleton class. The only instance of UnitTest is // created when UnitTest::GetInstance() is first called. This // instance is never deleted. // // UnitTest is not copyable. // // This class is thread-safe as long as the methods are called // according to their specification. class GTEST_API_ UnitTest { public: // Gets the singleton UnitTest object. The first time this method // is called, a UnitTest object is constructed and returned. // Consecutive calls will return the same object. static UnitTest* GetInstance(); // Runs all tests in this UnitTest object and prints the result. // Returns 0 if successful, or 1 otherwise. // // This method can only be called from the main thread. // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. int Run() GTEST_MUST_USE_RESULT_; // Returns the working directory when the first TEST() or TEST_F() // was executed. The UnitTest object owns the string. const char* original_working_dir() const; // Returns the TestCase object for the test that's currently running, // or NULL if no test is running. const TestCase* current_test_case() const GTEST_LOCK_EXCLUDED_(mutex_); // Returns the TestInfo object for the test that's currently running, // or NULL if no test is running. const TestInfo* current_test_info() const GTEST_LOCK_EXCLUDED_(mutex_); // Returns the random seed used at the start of the current test run. int random_seed() const; #if GTEST_HAS_PARAM_TEST // Returns the ParameterizedTestCaseRegistry object used to keep track of // value-parameterized tests and instantiate and register them. // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. internal::ParameterizedTestCaseRegistry& parameterized_test_registry() GTEST_LOCK_EXCLUDED_(mutex_); #endif // GTEST_HAS_PARAM_TEST // Gets the number of successful test cases. int successful_test_case_count() const; // Gets the number of failed test cases. int failed_test_case_count() const; // Gets the number of all test cases. int total_test_case_count() const; // Gets the number of all test cases that contain at least one test // that should run. int test_case_to_run_count() const; // Gets the number of successful tests. int successful_test_count() const; // Gets the number of failed tests. int failed_test_count() const; // Gets the number of disabled tests that will be reported in the XML report. int reportable_disabled_test_count() const; // Gets the number of disabled tests. int disabled_test_count() const; // Gets the number of tests to be printed in the XML report. int reportable_test_count() const; // Gets the number of all tests. int total_test_count() const; // Gets the number of tests that should run. int test_to_run_count() const; // Gets the time of the test program start, in ms from the start of the // UNIX epoch. TimeInMillis start_timestamp() const; // Gets the elapsed time, in milliseconds. TimeInMillis elapsed_time() const; // Returns true iff the unit test passed (i.e. all test cases passed). bool Passed() const; // Returns true iff the unit test failed (i.e. some test case failed // or something outside of all tests failed). bool Failed() const; // Gets the i-th test case among all the test cases. i can range from 0 to // total_test_case_count() - 1. If i is not in that range, returns NULL. const TestCase* GetTestCase(int i) const; // Returns the TestResult containing information on test failures and // properties logged outside of individual test cases. const TestResult& ad_hoc_test_result() const; // Returns the list of event listeners that can be used to track events // inside Google Test. TestEventListeners& listeners(); private: // Registers and returns a global test environment. When a test // program is run, all global test environments will be set-up in // the order they were registered. After all tests in the program // have finished, all global test environments will be torn-down in // the *reverse* order they were registered. // // The UnitTest object takes ownership of the given environment. // // This method can only be called from the main thread. Environment* AddEnvironment(Environment* env); // Adds a TestPartResult to the current TestResult object. All // Google Test assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc) // eventually call this to report their results. The user code // should use the assertion macros instead of calling this directly. void AddTestPartResult(TestPartResult::Type result_type, const char* file_name, int line_number, const std::string& message, const std::string& os_stack_trace) GTEST_LOCK_EXCLUDED_(mutex_); // Adds a TestProperty to the current TestResult object when invoked from // inside a test, to current TestCase's ad_hoc_test_result_ when invoked // from SetUpTestCase or TearDownTestCase, or to the global property set // when invoked elsewhere. If the result already contains a property with // the same key, the value will be updated. void RecordProperty(const std::string& key, const std::string& value); // Gets the i-th test case among all the test cases. i can range from 0 to // total_test_case_count() - 1. If i is not in that range, returns NULL. TestCase* GetMutableTestCase(int i); // Accessors for the implementation object. internal::UnitTestImpl* impl() { return impl_; } const internal::UnitTestImpl* impl() const { return impl_; } // These classes and funcions are friends as they need to access private // members of UnitTest. friend class Test; friend class internal::AssertHelper; friend class internal::ScopedTrace; friend class internal::StreamingListenerTest; friend class internal::UnitTestRecordPropertyTestHelper; friend Environment* AddGlobalTestEnvironment(Environment* env); friend internal::UnitTestImpl* internal::GetUnitTestImpl(); friend void internal::ReportFailureInUnknownLocation( TestPartResult::Type result_type, const std::string& message); // Creates an empty UnitTest. UnitTest(); // D'tor virtual ~UnitTest(); // Pushes a trace defined by SCOPED_TRACE() on to the per-thread // Google Test trace stack. void PushGTestTrace(const internal::TraceInfo& trace) GTEST_LOCK_EXCLUDED_(mutex_); // Pops a trace from the per-thread Google Test trace stack. void PopGTestTrace() GTEST_LOCK_EXCLUDED_(mutex_); // Protects mutable state in *impl_. This is mutable as some const // methods need to lock it too. mutable internal::Mutex mutex_; // Opaque implementation object. This field is never changed once // the object is constructed. We don't mark it as const here, as // doing so will cause a warning in the constructor of UnitTest. // Mutable state in *impl_ is protected by mutex_. internal::UnitTestImpl* impl_; // We disallow copying UnitTest. GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTest); }; // A convenient wrapper for adding an environment for the test // program. // // You should call this before RUN_ALL_TESTS() is called, probably in // main(). If you use gtest_main, you need to call this before main() // starts for it to take effect. For example, you can define a global // variable like this: // // testing::Environment* const foo_env = // testing::AddGlobalTestEnvironment(new FooEnvironment); // // However, we strongly recommend you to write your own main() and // call AddGlobalTestEnvironment() there, as relying on initialization // of global variables makes the code harder to read and may cause // problems when you register multiple environments from different // translation units and the environments have dependencies among them // (remember that the compiler doesn't guarantee the order in which // global variables from different translation units are initialized). inline Environment* AddGlobalTestEnvironment(Environment* env) { return UnitTest::GetInstance()->AddEnvironment(env); } // Initializes Google Test. This must be called before calling // RUN_ALL_TESTS(). In particular, it parses a command line for the // flags that Google Test recognizes. Whenever a Google Test flag is // seen, it is removed from argv, and *argc is decremented. // // No value is returned. Instead, the Google Test flag variables are // updated. // // Calling the function for the second time has no user-visible effect. GTEST_API_ void InitGoogleTest(int* argc, char** argv); // This overloaded version can be used in Windows programs compiled in // UNICODE mode. GTEST_API_ void InitGoogleTest(int* argc, wchar_t** argv); namespace internal { // Separate the error generating code from the code path to reduce the stack // frame size of CmpHelperEQ. This helps reduce the overhead of some sanitizers // when calling EXPECT_* in a tight loop. template <typename T1, typename T2> AssertionResult CmpHelperEQFailure(const char* lhs_expression, const char* rhs_expression, const T1& lhs, const T2& rhs) { return EqFailure(lhs_expression, rhs_expression, FormatForComparisonFailureMessage(lhs, rhs), FormatForComparisonFailureMessage(rhs, lhs), false); } // The helper function for {ASSERT|EXPECT}_EQ. template <typename T1, typename T2> AssertionResult CmpHelperEQ(const char* lhs_expression, const char* rhs_expression, const T1& lhs, const T2& rhs) { GTEST_DISABLE_MSC_WARNINGS_PUSH_(4389 /* signed/unsigned mismatch */) if (lhs == rhs) { return AssertionSuccess(); } GTEST_DISABLE_MSC_WARNINGS_POP_() return CmpHelperEQFailure(lhs_expression, rhs_expression, lhs, rhs); } // With this overloaded version, we allow anonymous enums to be used // in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous enums // can be implicitly cast to BiggestInt. GTEST_API_ AssertionResult CmpHelperEQ(const char* lhs_expression, const char* rhs_expression, BiggestInt lhs, BiggestInt rhs); // The helper class for {ASSERT|EXPECT}_EQ. The template argument // lhs_is_null_literal is true iff the first argument to ASSERT_EQ() // is a null pointer literal. The following default implementation is // for lhs_is_null_literal being false. template <bool lhs_is_null_literal> class EqHelper { public: // This templatized version is for the general case. template <typename T1, typename T2> static AssertionResult Compare(const char* lhs_expression, const char* rhs_expression, const T1& lhs, const T2& rhs) { return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs); } // With this overloaded version, we allow anonymous enums to be used // in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous // enums can be implicitly cast to BiggestInt. // // Even though its body looks the same as the above version, we // cannot merge the two, as it will make anonymous enums unhappy. static AssertionResult Compare(const char* lhs_expression, const char* rhs_expression, BiggestInt lhs, BiggestInt rhs) { return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs); } }; // This specialization is used when the first argument to ASSERT_EQ() // is a null pointer literal, like NULL, false, or 0. template <> class EqHelper<true> { public: // We define two overloaded versions of Compare(). The first // version will be picked when the second argument to ASSERT_EQ() is // NOT a pointer, e.g. ASSERT_EQ(0, AnIntFunction()) or // EXPECT_EQ(false, a_bool). template <typename T1, typename T2> static AssertionResult Compare( const char* lhs_expression, const char* rhs_expression, const T1& lhs, const T2& rhs, // The following line prevents this overload from being considered if T2 // is not a pointer type. We need this because ASSERT_EQ(NULL, my_ptr) // expands to Compare("", "", NULL, my_ptr), which requires a conversion // to match the Secret* in the other overload, which would otherwise make // this template match better. typename EnableIf<!is_pointer<T2>::value>::type* = 0) { return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs); } // This version will be picked when the second argument to ASSERT_EQ() is a // pointer, e.g. ASSERT_EQ(NULL, a_pointer). template <typename T> static AssertionResult Compare( const char* lhs_expression, const char* rhs_expression, // We used to have a second template parameter instead of Secret*. That // template parameter would deduce to 'long', making this a better match // than the first overload even without the first overload's EnableIf. // Unfortunately, gcc with -Wconversion-null warns when "passing NULL to // non-pointer argument" (even a deduced integral argument), so the old // implementation caused warnings in user code. Secret* /* lhs (NULL) */, T* rhs) { // We already know that 'lhs' is a null pointer. return CmpHelperEQ(lhs_expression, rhs_expression, static_cast<T*>(NULL), rhs); } }; // Separate the error generating code from the code path to reduce the stack // frame size of CmpHelperOP. This helps reduce the overhead of some sanitizers // when calling EXPECT_OP in a tight loop. template <typename T1, typename T2> AssertionResult CmpHelperOpFailure(const char* expr1, const char* expr2, const T1& val1, const T2& val2, const char* op) { return AssertionFailure() << "Expected: (" << expr1 << ") " << op << " (" << expr2 << "), actual: " << FormatForComparisonFailureMessage(val1, val2) << " vs " << FormatForComparisonFailureMessage(val2, val1); } // A macro for implementing the helper functions needed to implement // ASSERT_?? and EXPECT_??. It is here just to avoid copy-and-paste // of similar code. // // For each templatized helper function, we also define an overloaded // version for BiggestInt in order to reduce code bloat and allow // anonymous enums to be used with {ASSERT|EXPECT}_?? when compiled // with gcc 4. // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. #define GTEST_IMPL_CMP_HELPER_(op_name, op)\ template <typename T1, typename T2>\ AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \ const T1& val1, const T2& val2) {\ if (val1 op val2) {\ return AssertionSuccess();\ } else {\ return CmpHelperOpFailure(expr1, expr2, val1, val2, #op);\ }\ }\ GTEST_API_ AssertionResult CmpHelper##op_name(\ const char* expr1, const char* expr2, BiggestInt val1, BiggestInt val2) // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. // Implements the helper function for {ASSERT|EXPECT}_NE GTEST_IMPL_CMP_HELPER_(NE, !=); // Implements the helper function for {ASSERT|EXPECT}_LE GTEST_IMPL_CMP_HELPER_(LE, <=); // Implements the helper function for {ASSERT|EXPECT}_LT GTEST_IMPL_CMP_HELPER_(LT, <); // Implements the helper function for {ASSERT|EXPECT}_GE GTEST_IMPL_CMP_HELPER_(GE, >=); // Implements the helper function for {ASSERT|EXPECT}_GT GTEST_IMPL_CMP_HELPER_(GT, >); #undef GTEST_IMPL_CMP_HELPER_ // The helper function for {ASSERT|EXPECT}_STREQ. // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. GTEST_API_ AssertionResult CmpHelperSTREQ(const char* s1_expression, const char* s2_expression, const char* s1, const char* s2); // The helper function for {ASSERT|EXPECT}_STRCASEEQ. // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. GTEST_API_ AssertionResult CmpHelperSTRCASEEQ(const char* s1_expression, const char* s2_expression, const char* s1, const char* s2); // The helper function for {ASSERT|EXPECT}_STRNE. // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression, const char* s2_expression, const char* s1, const char* s2); // The helper function for {ASSERT|EXPECT}_STRCASENE. // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. GTEST_API_ AssertionResult CmpHelperSTRCASENE(const char* s1_expression, const char* s2_expression, const char* s1, const char* s2); // Helper function for *_STREQ on wide strings. // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. GTEST_API_ AssertionResult CmpHelperSTREQ(const char* s1_expression, const char* s2_expression, const wchar_t* s1, const wchar_t* s2); // Helper function for *_STRNE on wide strings. // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression, const char* s2_expression, const wchar_t* s1, const wchar_t* s2); } // namespace internal // IsSubstring() and IsNotSubstring() are intended to be used as the // first argument to {EXPECT,ASSERT}_PRED_FORMAT2(), not by // themselves. They check whether needle is a substring of haystack // (NULL is considered a substring of itself only), and return an // appropriate error message when they fail. // // The {needle,haystack}_expr arguments are the stringified // expressions that generated the two real arguments. GTEST_API_ AssertionResult IsSubstring( const char* needle_expr, const char* haystack_expr, const char* needle, const char* haystack); GTEST_API_ AssertionResult IsSubstring( const char* needle_expr, const char* haystack_expr, const wchar_t* needle, const wchar_t* haystack); GTEST_API_ AssertionResult IsNotSubstring( const char* needle_expr, const char* haystack_expr, const char* needle, const char* haystack); GTEST_API_ AssertionResult IsNotSubstring( const char* needle_expr, const char* haystack_expr, const wchar_t* needle, const wchar_t* haystack); GTEST_API_ AssertionResult IsSubstring( const char* needle_expr, const char* haystack_expr, const ::std::string& needle, const ::std::string& haystack); GTEST_API_ AssertionResult IsNotSubstring( const char* needle_expr, const char* haystack_expr, const ::std::string& needle, const ::std::string& haystack); #if GTEST_HAS_STD_WSTRING GTEST_API_ AssertionResult IsSubstring( const char* needle_expr, const char* haystack_expr, const ::std::wstring& needle, const ::std::wstring& haystack); GTEST_API_ AssertionResult IsNotSubstring( const char* needle_expr, const char* haystack_expr, const ::std::wstring& needle, const ::std::wstring& haystack); #endif // GTEST_HAS_STD_WSTRING namespace internal { // Helper template function for comparing floating-points. // // Template parameter: // // RawType: the raw floating-point type (either float or double) // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. template <typename RawType> AssertionResult CmpHelperFloatingPointEQ(const char* lhs_expression, const char* rhs_expression, RawType lhs_value, RawType rhs_value) { const FloatingPoint<RawType> lhs(lhs_value), rhs(rhs_value); if (lhs.AlmostEquals(rhs)) { return AssertionSuccess(); } ::std::stringstream lhs_ss; lhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2) << lhs_value; ::std::stringstream rhs_ss; rhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2) << rhs_value; return EqFailure(lhs_expression, rhs_expression, StringStreamToString(&lhs_ss), StringStreamToString(&rhs_ss), false); } // Helper function for implementing ASSERT_NEAR. // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. GTEST_API_ AssertionResult DoubleNearPredFormat(const char* expr1, const char* expr2, const char* abs_error_expr, double val1, double val2, double abs_error); // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // A class that enables one to stream messages to assertion macros class GTEST_API_ AssertHelper { public: // Constructor. AssertHelper(TestPartResult::Type type, const char* file, int line, const char* message); ~AssertHelper(); // Message assignment is a semantic trick to enable assertion // streaming; see the GTEST_MESSAGE_ macro below. void operator=(const Message& message) const; private: // We put our data in a struct so that the size of the AssertHelper class can // be as small as possible. This is important because gcc is incapable of // re-using stack space even for temporary variables, so every EXPECT_EQ // reserves stack space for another AssertHelper. struct AssertHelperData { AssertHelperData(TestPartResult::Type t, const char* srcfile, int line_num, const char* msg) : type(t), file(srcfile), line(line_num), message(msg) { } TestPartResult::Type const type; const char* const file; int const line; std::string const message; private: GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelperData); }; AssertHelperData* const data_; GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelper); }; } // namespace internal #if GTEST_HAS_PARAM_TEST // The pure interface class that all value-parameterized tests inherit from. // A value-parameterized class must inherit from both ::testing::Test and // ::testing::WithParamInterface. In most cases that just means inheriting // from ::testing::TestWithParam, but more complicated test hierarchies // may need to inherit from Test and WithParamInterface at different levels. // // This interface has support for accessing the test parameter value via // the GetParam() method. // // Use it with one of the parameter generator defining functions, like Range(), // Values(), ValuesIn(), Bool(), and Combine(). // // class FooTest : public ::testing::TestWithParam<int> { // protected: // FooTest() { // // Can use GetParam() here. // } // virtual ~FooTest() { // // Can use GetParam() here. // } // virtual void SetUp() { // // Can use GetParam() here. // } // virtual void TearDown { // // Can use GetParam() here. // } // }; // TEST_P(FooTest, DoesBar) { // // Can use GetParam() method here. // Foo foo; // ASSERT_TRUE(foo.DoesBar(GetParam())); // } // INSTANTIATE_TEST_CASE_P(OneToTenRange, FooTest, ::testing::Range(1, 10)); template <typename T> class WithParamInterface { public: typedef T ParamType; virtual ~WithParamInterface() {} // The current parameter value. Is also available in the test fixture's // constructor. This member function is non-static, even though it only // references static data, to reduce the opportunity for incorrect uses // like writing 'WithParamInterface<bool>::GetParam()' for a test that // uses a fixture whose parameter type is int. const ParamType& GetParam() const { GTEST_CHECK_(parameter_ != NULL) << "GetParam() can only be called inside a value-parameterized test " << "-- did you intend to write TEST_P instead of TEST_F?"; return *parameter_; } private: // Sets parameter value. The caller is responsible for making sure the value // remains alive and unchanged throughout the current test. static void SetParam(const ParamType* parameter) { parameter_ = parameter; } // Static value used for accessing parameter during a test lifetime. static const ParamType* parameter_; // TestClass must be a subclass of WithParamInterface<T> and Test. template <class TestClass> friend class internal::ParameterizedTestFactory; }; template <typename T> const T* WithParamInterface<T>::parameter_ = NULL; // Most value-parameterized classes can ignore the existence of // WithParamInterface, and can just inherit from ::testing::TestWithParam. template <typename T> class TestWithParam : public Test, public WithParamInterface<T> { }; #endif // GTEST_HAS_PARAM_TEST // Macros for indicating success/failure in test code. // ADD_FAILURE unconditionally adds a failure to the current test. // SUCCEED generates a success - it doesn't automatically make the // current test successful, as a test is only successful when it has // no failure. // // EXPECT_* verifies that a certain condition is satisfied. If not, // it behaves like ADD_FAILURE. In particular: // // EXPECT_TRUE verifies that a Boolean condition is true. // EXPECT_FALSE verifies that a Boolean condition is false. // // FAIL and ASSERT_* are similar to ADD_FAILURE and EXPECT_*, except // that they will also abort the current function on failure. People // usually want the fail-fast behavior of FAIL and ASSERT_*, but those // writing data-driven tests often find themselves using ADD_FAILURE // and EXPECT_* more. // Generates a nonfatal failure with a generic message. #define ADD_FAILURE() GTEST_NONFATAL_FAILURE_("Failed") // Generates a nonfatal failure at the given source file location with // a generic message. #define ADD_FAILURE_AT(file, line) \ GTEST_MESSAGE_AT_(file, line, "Failed", \ ::testing::TestPartResult::kNonFatalFailure) // Generates a fatal failure with a generic message. #define GTEST_FAIL() GTEST_FATAL_FAILURE_("Failed") // Define this macro to 1 to omit the definition of FAIL(), which is a // generic name and clashes with some other libraries. #if !GTEST_DONT_DEFINE_FAIL # define FAIL() GTEST_FAIL() #endif // Generates a success with a generic message. #define GTEST_SUCCEED() GTEST_SUCCESS_("Succeeded") // Define this macro to 1 to omit the definition of SUCCEED(), which // is a generic name and clashes with some other libraries. #if !GTEST_DONT_DEFINE_SUCCEED # define SUCCEED() GTEST_SUCCEED() #endif // Macros for testing exceptions. // // * {ASSERT|EXPECT}_THROW(statement, expected_exception): // Tests that the statement throws the expected exception. // * {ASSERT|EXPECT}_NO_THROW(statement): // Tests that the statement doesn't throw any exception. // * {ASSERT|EXPECT}_ANY_THROW(statement): // Tests that the statement throws an exception. #define EXPECT_THROW(statement, expected_exception) \ GTEST_TEST_THROW_(statement, expected_exception, GTEST_NONFATAL_FAILURE_) #define EXPECT_NO_THROW(statement) \ GTEST_TEST_NO_THROW_(statement, GTEST_NONFATAL_FAILURE_) #define EXPECT_ANY_THROW(statement) \ GTEST_TEST_ANY_THROW_(statement, GTEST_NONFATAL_FAILURE_) #define ASSERT_THROW(statement, expected_exception) \ GTEST_TEST_THROW_(statement, expected_exception, GTEST_FATAL_FAILURE_) #define ASSERT_NO_THROW(statement) \ GTEST_TEST_NO_THROW_(statement, GTEST_FATAL_FAILURE_) #define ASSERT_ANY_THROW(statement) \ GTEST_TEST_ANY_THROW_(statement, GTEST_FATAL_FAILURE_) // Boolean assertions. Condition can be either a Boolean expression or an // AssertionResult. For more information on how to use AssertionResult with // these macros see comments on that class. #define EXPECT_TRUE(condition) \ GTEST_TEST_BOOLEAN_((condition), #condition, false, true, \ GTEST_NONFATAL_FAILURE_) #define EXPECT_FALSE(condition) \ GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \ GTEST_NONFATAL_FAILURE_) #define ASSERT_TRUE(condition) \ GTEST_TEST_BOOLEAN_((condition), #condition, false, true, \ GTEST_FATAL_FAILURE_) #define ASSERT_FALSE(condition) \ GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \ GTEST_FATAL_FAILURE_) // Includes the auto-generated header that implements a family of // generic predicate assertion macros. // Copyright 2006, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // This file is AUTOMATICALLY GENERATED on 10/31/2011 by command // 'gen_gtest_pred_impl.py 5'. DO NOT EDIT BY HAND! // // Implements a family of generic predicate assertion macros. #ifndef GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_ #define GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_ // Makes sure this header is not included before gtest.h. #ifndef GTEST_INCLUDE_GTEST_GTEST_H_ # error Do not include gtest_pred_impl.h directly. Include gtest.h instead. #endif // GTEST_INCLUDE_GTEST_GTEST_H_ // This header implements a family of generic predicate assertion // macros: // // ASSERT_PRED_FORMAT1(pred_format, v1) // ASSERT_PRED_FORMAT2(pred_format, v1, v2) // ... // // where pred_format is a function or functor that takes n (in the // case of ASSERT_PRED_FORMATn) values and their source expression // text, and returns a testing::AssertionResult. See the definition // of ASSERT_EQ in gtest.h for an example. // // If you don't care about formatting, you can use the more // restrictive version: // // ASSERT_PRED1(pred, v1) // ASSERT_PRED2(pred, v1, v2) // ... // // where pred is an n-ary function or functor that returns bool, // and the values v1, v2, ..., must support the << operator for // streaming to std::ostream. // // We also define the EXPECT_* variations. // // For now we only support predicates whose arity is at most 5. // Please email [email protected] if you need // support for higher arities. // GTEST_ASSERT_ is the basic statement to which all of the assertions // in this file reduce. Don't use this in your code. #define GTEST_ASSERT_(expression, on_failure) \ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ if (const ::testing::AssertionResult gtest_ar = (expression)) \ ; \ else \ on_failure(gtest_ar.failure_message()) // Helper function for implementing {EXPECT|ASSERT}_PRED1. Don't use // this in your code. template <typename Pred, typename T1> AssertionResult AssertPred1Helper(const char* pred_text, const char* e1, Pred pred, const T1& v1) { if (pred(v1)) return AssertionSuccess(); return AssertionFailure() << pred_text << "(" << e1 << ") evaluates to false, where" << "\n" << e1 << " evaluates to " << v1; } // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT1. // Don't use this in your code. #define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure)\ GTEST_ASSERT_(pred_format(#v1, v1), \ on_failure) // Internal macro for implementing {EXPECT|ASSERT}_PRED1. Don't use // this in your code. #define GTEST_PRED1_(pred, v1, on_failure)\ GTEST_ASSERT_(::testing::AssertPred1Helper(#pred, \ #v1, \ pred, \ v1), on_failure) // Unary predicate assertion macros. #define EXPECT_PRED_FORMAT1(pred_format, v1) \ GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_NONFATAL_FAILURE_) #define EXPECT_PRED1(pred, v1) \ GTEST_PRED1_(pred, v1, GTEST_NONFATAL_FAILURE_) #define ASSERT_PRED_FORMAT1(pred_format, v1) \ GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_FATAL_FAILURE_) #define ASSERT_PRED1(pred, v1) \ GTEST_PRED1_(pred, v1, GTEST_FATAL_FAILURE_) // Helper function for implementing {EXPECT|ASSERT}_PRED2. Don't use // this in your code. template <typename Pred, typename T1, typename T2> AssertionResult AssertPred2Helper(const char* pred_text, const char* e1, const char* e2, Pred pred, const T1& v1, const T2& v2) { if (pred(v1, v2)) return AssertionSuccess(); return AssertionFailure() << pred_text << "(" << e1 << ", " << e2 << ") evaluates to false, where" << "\n" << e1 << " evaluates to " << v1 << "\n" << e2 << " evaluates to " << v2; } // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT2. // Don't use this in your code. #define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure)\ GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \ on_failure) // Internal macro for implementing {EXPECT|ASSERT}_PRED2. Don't use // this in your code. #define GTEST_PRED2_(pred, v1, v2, on_failure)\ GTEST_ASSERT_(::testing::AssertPred2Helper(#pred, \ #v1, \ #v2, \ pred, \ v1, \ v2), on_failure) // Binary predicate assertion macros. #define EXPECT_PRED_FORMAT2(pred_format, v1, v2) \ GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_) #define EXPECT_PRED2(pred, v1, v2) \ GTEST_PRED2_(pred, v1, v2, GTEST_NONFATAL_FAILURE_) #define ASSERT_PRED_FORMAT2(pred_format, v1, v2) \ GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_) #define ASSERT_PRED2(pred, v1, v2) \ GTEST_PRED2_(pred, v1, v2, GTEST_FATAL_FAILURE_) // Helper function for implementing {EXPECT|ASSERT}_PRED3. Don't use // this in your code. template <typename Pred, typename T1, typename T2, typename T3> AssertionResult AssertPred3Helper(const char* pred_text, const char* e1, const char* e2, const char* e3, Pred pred, const T1& v1, const T2& v2, const T3& v3) { if (pred(v1, v2, v3)) return AssertionSuccess(); return AssertionFailure() << pred_text << "(" << e1 << ", " << e2 << ", " << e3 << ") evaluates to false, where" << "\n" << e1 << " evaluates to " << v1 << "\n" << e2 << " evaluates to " << v2 << "\n" << e3 << " evaluates to " << v3; } // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT3. // Don't use this in your code. #define GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, on_failure)\ GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3), \ on_failure) // Internal macro for implementing {EXPECT|ASSERT}_PRED3. Don't use // this in your code. #define GTEST_PRED3_(pred, v1, v2, v3, on_failure)\ GTEST_ASSERT_(::testing::AssertPred3Helper(#pred, \ #v1, \ #v2, \ #v3, \ pred, \ v1, \ v2, \ v3), on_failure) // Ternary predicate assertion macros. #define EXPECT_PRED_FORMAT3(pred_format, v1, v2, v3) \ GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_NONFATAL_FAILURE_) #define EXPECT_PRED3(pred, v1, v2, v3) \ GTEST_PRED3_(pred, v1, v2, v3, GTEST_NONFATAL_FAILURE_) #define ASSERT_PRED_FORMAT3(pred_format, v1, v2, v3) \ GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_FATAL_FAILURE_) #define ASSERT_PRED3(pred, v1, v2, v3) \ GTEST_PRED3_(pred, v1, v2, v3, GTEST_FATAL_FAILURE_) // Helper function for implementing {EXPECT|ASSERT}_PRED4. Don't use // this in your code. template <typename Pred, typename T1, typename T2, typename T3, typename T4> AssertionResult AssertPred4Helper(const char* pred_text, const char* e1, const char* e2, const char* e3, const char* e4, Pred pred, const T1& v1, const T2& v2, const T3& v3, const T4& v4) { if (pred(v1, v2, v3, v4)) return AssertionSuccess(); return AssertionFailure() << pred_text << "(" << e1 << ", " << e2 << ", " << e3 << ", " << e4 << ") evaluates to false, where" << "\n" << e1 << " evaluates to " << v1 << "\n" << e2 << " evaluates to " << v2 << "\n" << e3 << " evaluates to " << v3 << "\n" << e4 << " evaluates to " << v4; } // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT4. // Don't use this in your code. #define GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, on_failure)\ GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4), \ on_failure) // Internal macro for implementing {EXPECT|ASSERT}_PRED4. Don't use // this in your code. #define GTEST_PRED4_(pred, v1, v2, v3, v4, on_failure)\ GTEST_ASSERT_(::testing::AssertPred4Helper(#pred, \ #v1, \ #v2, \ #v3, \ #v4, \ pred, \ v1, \ v2, \ v3, \ v4), on_failure) // 4-ary predicate assertion macros. #define EXPECT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \ GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_) #define EXPECT_PRED4(pred, v1, v2, v3, v4) \ GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_) #define ASSERT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \ GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_FATAL_FAILURE_) #define ASSERT_PRED4(pred, v1, v2, v3, v4) \ GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_FATAL_FAILURE_) // Helper function for implementing {EXPECT|ASSERT}_PRED5. Don't use // this in your code. template <typename Pred, typename T1, typename T2, typename T3, typename T4, typename T5> AssertionResult AssertPred5Helper(const char* pred_text, const char* e1, const char* e2, const char* e3, const char* e4, const char* e5, Pred pred, const T1& v1, const T2& v2, const T3& v3, const T4& v4, const T5& v5) { if (pred(v1, v2, v3, v4, v5)) return AssertionSuccess(); return AssertionFailure() << pred_text << "(" << e1 << ", " << e2 << ", " << e3 << ", " << e4 << ", " << e5 << ") evaluates to false, where" << "\n" << e1 << " evaluates to " << v1 << "\n" << e2 << " evaluates to " << v2 << "\n" << e3 << " evaluates to " << v3 << "\n" << e4 << " evaluates to " << v4 << "\n" << e5 << " evaluates to " << v5; } // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT5. // Don't use this in your code. #define GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, on_failure)\ GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5), \ on_failure) // Internal macro for implementing {EXPECT|ASSERT}_PRED5. Don't use // this in your code. #define GTEST_PRED5_(pred, v1, v2, v3, v4, v5, on_failure)\ GTEST_ASSERT_(::testing::AssertPred5Helper(#pred, \ #v1, \ #v2, \ #v3, \ #v4, \ #v5, \ pred, \ v1, \ v2, \ v3, \ v4, \ v5), on_failure) // 5-ary predicate assertion macros. #define EXPECT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \ GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_) #define EXPECT_PRED5(pred, v1, v2, v3, v4, v5) \ GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_) #define ASSERT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \ GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_) #define ASSERT_PRED5(pred, v1, v2, v3, v4, v5) \ GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_) #endif // GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_ // Macros for testing equalities and inequalities. // // * {ASSERT|EXPECT}_EQ(v1, v2): Tests that v1 == v2 // * {ASSERT|EXPECT}_NE(v1, v2): Tests that v1 != v2 // * {ASSERT|EXPECT}_LT(v1, v2): Tests that v1 < v2 // * {ASSERT|EXPECT}_LE(v1, v2): Tests that v1 <= v2 // * {ASSERT|EXPECT}_GT(v1, v2): Tests that v1 > v2 // * {ASSERT|EXPECT}_GE(v1, v2): Tests that v1 >= v2 // // When they are not, Google Test prints both the tested expressions and // their actual values. The values must be compatible built-in types, // or you will get a compiler error. By "compatible" we mean that the // values can be compared by the respective operator. // // Note: // // 1. It is possible to make a user-defined type work with // {ASSERT|EXPECT}_??(), but that requires overloading the // comparison operators and is thus discouraged by the Google C++ // Usage Guide. Therefore, you are advised to use the // {ASSERT|EXPECT}_TRUE() macro to assert that two objects are // equal. // // 2. The {ASSERT|EXPECT}_??() macros do pointer comparisons on // pointers (in particular, C strings). Therefore, if you use it // with two C strings, you are testing how their locations in memory // are related, not how their content is related. To compare two C // strings by content, use {ASSERT|EXPECT}_STR*(). // // 3. {ASSERT|EXPECT}_EQ(v1, v2) is preferred to // {ASSERT|EXPECT}_TRUE(v1 == v2), as the former tells you // what the actual value is when it fails, and similarly for the // other comparisons. // // 4. Do not depend on the order in which {ASSERT|EXPECT}_??() // evaluate their arguments, which is undefined. // // 5. These macros evaluate their arguments exactly once. // // Examples: // // EXPECT_NE(5, Foo()); // EXPECT_EQ(NULL, a_pointer); // ASSERT_LT(i, array_size); // ASSERT_GT(records.size(), 0) << "There is no record left."; #define EXPECT_EQ(val1, val2) \ EXPECT_PRED_FORMAT2(::testing::internal:: \ EqHelper<GTEST_IS_NULL_LITERAL_(val1)>::Compare, \ val1, val2) #define EXPECT_NE(val1, val2) \ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2) #define EXPECT_LE(val1, val2) \ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2) #define EXPECT_LT(val1, val2) \ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2) #define EXPECT_GE(val1, val2) \ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2) #define EXPECT_GT(val1, val2) \ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2) #define GTEST_ASSERT_EQ(val1, val2) \ ASSERT_PRED_FORMAT2(::testing::internal:: \ EqHelper<GTEST_IS_NULL_LITERAL_(val1)>::Compare, \ val1, val2) #define GTEST_ASSERT_NE(val1, val2) \ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2) #define GTEST_ASSERT_LE(val1, val2) \ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2) #define GTEST_ASSERT_LT(val1, val2) \ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2) #define GTEST_ASSERT_GE(val1, val2) \ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2) #define GTEST_ASSERT_GT(val1, val2) \ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2) // Define macro GTEST_DONT_DEFINE_ASSERT_XY to 1 to omit the definition of // ASSERT_XY(), which clashes with some users' own code. #if !GTEST_DONT_DEFINE_ASSERT_EQ # define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2) #endif #if !GTEST_DONT_DEFINE_ASSERT_NE # define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2) #endif #if !GTEST_DONT_DEFINE_ASSERT_LE # define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2) #endif #if !GTEST_DONT_DEFINE_ASSERT_LT # define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2) #endif #if !GTEST_DONT_DEFINE_ASSERT_GE # define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2) #endif #if !GTEST_DONT_DEFINE_ASSERT_GT # define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2) #endif // C-string Comparisons. All tests treat NULL and any non-NULL string // as different. Two NULLs are equal. // // * {ASSERT|EXPECT}_STREQ(s1, s2): Tests that s1 == s2 // * {ASSERT|EXPECT}_STRNE(s1, s2): Tests that s1 != s2 // * {ASSERT|EXPECT}_STRCASEEQ(s1, s2): Tests that s1 == s2, ignoring case // * {ASSERT|EXPECT}_STRCASENE(s1, s2): Tests that s1 != s2, ignoring case // // For wide or narrow string objects, you can use the // {ASSERT|EXPECT}_??() macros. // // Don't depend on the order in which the arguments are evaluated, // which is undefined. // // These macros evaluate their arguments exactly once. #define EXPECT_STREQ(s1, s2) \ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, s1, s2) #define EXPECT_STRNE(s1, s2) \ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2) #define EXPECT_STRCASEEQ(s1, s2) \ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2) #define EXPECT_STRCASENE(s1, s2)\ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2) #define ASSERT_STREQ(s1, s2) \ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, s1, s2) #define ASSERT_STRNE(s1, s2) \ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2) #define ASSERT_STRCASEEQ(s1, s2) \ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2) #define ASSERT_STRCASENE(s1, s2)\ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2) // Macros for comparing floating-point numbers. // // * {ASSERT|EXPECT}_FLOAT_EQ(val1, val2): // Tests that two float values are almost equal. // * {ASSERT|EXPECT}_DOUBLE_EQ(val1, val2): // Tests that two double values are almost equal. // * {ASSERT|EXPECT}_NEAR(v1, v2, abs_error): // Tests that v1 and v2 are within the given distance to each other. // // Google Test uses ULP-based comparison to automatically pick a default // error bound that is appropriate for the operands. See the // FloatingPoint template class in gtest-internal.h if you are // interested in the implementation details. #define EXPECT_FLOAT_EQ(val1, val2)\ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \ val1, val2) #define EXPECT_DOUBLE_EQ(val1, val2)\ EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \ val1, val2) #define ASSERT_FLOAT_EQ(val1, val2)\ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \ val1, val2) #define ASSERT_DOUBLE_EQ(val1, val2)\ ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \ val1, val2) #define EXPECT_NEAR(val1, val2, abs_error)\ EXPECT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \ val1, val2, abs_error) #define ASSERT_NEAR(val1, val2, abs_error)\ ASSERT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \ val1, val2, abs_error) // These predicate format functions work on floating-point values, and // can be used in {ASSERT|EXPECT}_PRED_FORMAT2*(), e.g. // // EXPECT_PRED_FORMAT2(testing::DoubleLE, Foo(), 5.0); // Asserts that val1 is less than, or almost equal to, val2. Fails // otherwise. In particular, it fails if either val1 or val2 is NaN. GTEST_API_ AssertionResult FloatLE(const char* expr1, const char* expr2, float val1, float val2); GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2, double val1, double val2); #if GTEST_OS_WINDOWS // Macros that test for HRESULT failure and success, these are only useful // on Windows, and rely on Windows SDK macros and APIs to compile. // // * {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}(expr) // // When expr unexpectedly fails or succeeds, Google Test prints the // expected result and the actual result with both a human-readable // string representation of the error, if available, as well as the // hex result code. # define EXPECT_HRESULT_SUCCEEDED(expr) \ EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr)) # define ASSERT_HRESULT_SUCCEEDED(expr) \ ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr)) # define EXPECT_HRESULT_FAILED(expr) \ EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr)) # define ASSERT_HRESULT_FAILED(expr) \ ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr)) #endif // GTEST_OS_WINDOWS // Macros that execute statement and check that it doesn't generate new fatal // failures in the current thread. // // * {ASSERT|EXPECT}_NO_FATAL_FAILURE(statement); // // Examples: // // EXPECT_NO_FATAL_FAILURE(Process()); // ASSERT_NO_FATAL_FAILURE(Process()) << "Process() failed"; // #define ASSERT_NO_FATAL_FAILURE(statement) \ GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_FATAL_FAILURE_) #define EXPECT_NO_FATAL_FAILURE(statement) \ GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_NONFATAL_FAILURE_) // Causes a trace (including the source file path, the current line // number, and the given message) to be included in every test failure // message generated by code in the current scope. The effect is // undone when the control leaves the current scope. // // The message argument can be anything streamable to std::ostream. // // In the implementation, we include the current line number as part // of the dummy variable name, thus allowing multiple SCOPED_TRACE()s // to appear in the same block - as long as they are on different // lines. #define SCOPED_TRACE(message) \ ::testing::internal::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\ __FILE__, __LINE__, ::testing::Message() << (message)) // Compile-time assertion for type equality. // StaticAssertTypeEq<type1, type2>() compiles iff type1 and type2 are // the same type. The value it returns is not interesting. // // Instead of making StaticAssertTypeEq a class template, we make it a // function template that invokes a helper class template. This // prevents a user from misusing StaticAssertTypeEq<T1, T2> by // defining objects of that type. // // CAVEAT: // // When used inside a method of a class template, // StaticAssertTypeEq<T1, T2>() is effective ONLY IF the method is // instantiated. For example, given: // // template <typename T> class Foo { // public: // void Bar() { testing::StaticAssertTypeEq<int, T>(); } // }; // // the code: // // void Test1() { Foo<bool> foo; } // // will NOT generate a compiler error, as Foo<bool>::Bar() is never // actually instantiated. Instead, you need: // // void Test2() { Foo<bool> foo; foo.Bar(); } // // to cause a compiler error. template <typename T1, typename T2> bool StaticAssertTypeEq() { (void)internal::StaticAssertTypeEqHelper<T1, T2>(); return true; } // Defines a test. // // The first parameter is the name of the test case, and the second // parameter is the name of the test within the test case. // // The convention is to end the test case name with "Test". For // example, a test case for the Foo class can be named FooTest. // // Test code should appear between braces after an invocation of // this macro. Example: // // TEST(FooTest, InitializesCorrectly) { // Foo foo; // EXPECT_TRUE(foo.StatusIsOK()); // } // Note that we call GetTestTypeId() instead of GetTypeId< // ::testing::Test>() here to get the type ID of testing::Test. This // is to work around a suspected linker bug when using Google Test as // a framework on Mac OS X. The bug causes GetTypeId< // ::testing::Test>() to return different values depending on whether // the call is from the Google Test framework itself or from user test // code. GetTestTypeId() is guaranteed to always return the same // value, as it always calls GetTypeId<>() from the Google Test // framework. #define GTEST_TEST(test_case_name, test_name)\ GTEST_TEST_(test_case_name, test_name, \ ::testing::Test, ::testing::internal::GetTestTypeId()) // Define this macro to 1 to omit the definition of TEST(), which // is a generic name and clashes with some other libraries. #if !GTEST_DONT_DEFINE_TEST # define TEST(test_case_name, test_name) GTEST_TEST(test_case_name, test_name) #endif // Defines a test that uses a test fixture. // // The first parameter is the name of the test fixture class, which // also doubles as the test case name. The second parameter is the // name of the test within the test case. // // A test fixture class must be declared earlier. The user should put // his test code between braces after using this macro. Example: // // class FooTest : public testing::Test { // protected: // virtual void SetUp() { b_.AddElement(3); } // // Foo a_; // Foo b_; // }; // // TEST_F(FooTest, InitializesCorrectly) { // EXPECT_TRUE(a_.StatusIsOK()); // } // // TEST_F(FooTest, ReturnsElementCountCorrectly) { // EXPECT_EQ(0, a_.size()); // EXPECT_EQ(1, b_.size()); // } #define TEST_F(test_fixture, test_name)\ GTEST_TEST_(test_fixture, test_name, test_fixture, \ ::testing::internal::GetTypeId<test_fixture>()) } // namespace testing // Use this function in main() to run all tests. It returns 0 if all // tests are successful, or 1 otherwise. // // RUN_ALL_TESTS() should be invoked after the command line has been // parsed by InitGoogleTest(). // // This function was formerly a macro; thus, it is in the global // namespace and has an all-caps name. int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_; inline int RUN_ALL_TESTS() { return ::testing::UnitTest::GetInstance()->Run(); } #endif // GTEST_INCLUDE_GTEST_GTEST_H_
0
repos/ryu
repos/ryu/ryu/f2s.c
// Copyright 2018 Ulf Adams // // The contents of this file may be used under the terms of the Apache License, // Version 2.0. // // (See accompanying file LICENSE-Apache or copy at // http://www.apache.org/licenses/LICENSE-2.0) // // Alternatively, the contents of this file may be used under the terms of // the Boost Software License, Version 1.0. // (See accompanying file LICENSE-Boost or copy at // https://www.boost.org/LICENSE_1_0.txt) // // Unless required by applicable law or agreed to in writing, this software // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. // Runtime compiler options: // -DRYU_DEBUG Generate verbose debugging output to stdout. #include "ryu/ryu.h" #include <assert.h> #include <stdbool.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include <limits.h> #ifdef RYU_DEBUG #include <stdio.h> #endif #include "ryu/common.h" #include "ryu/f2s_intrinsics.h" #include "ryu/digit_table.h" #define FLOAT_MANTISSA_BITS 23 #define FLOAT_EXPONENT_BITS 8 #define FLOAT_BIAS 127 // A floating decimal representing m * 10^e. typedef struct floating_decimal_32 { uint32_t mantissa; // Decimal exponent's range is -45 to 38 // inclusive, and can fit in a short if needed. int32_t exponent; } floating_decimal_32; static inline floating_decimal_32 f2d(const uint32_t ieeeMantissa, const uint32_t ieeeExponent) { int32_t e2; uint32_t m2; if (ieeeExponent == 0) { // We subtract 2 so that the bounds computation has 2 additional bits. e2 = 1 - FLOAT_BIAS - FLOAT_MANTISSA_BITS - 2; m2 = ieeeMantissa; } else { e2 = (int32_t) ieeeExponent - FLOAT_BIAS - FLOAT_MANTISSA_BITS - 2; m2 = (1u << FLOAT_MANTISSA_BITS) | ieeeMantissa; } const bool even = (m2 & 1) == 0; const bool acceptBounds = even; #ifdef RYU_DEBUG printf("-> %u * 2^%d\n", m2, e2 + 2); #endif // Step 2: Determine the interval of valid decimal representations. const uint32_t mv = 4 * m2; const uint32_t mp = 4 * m2 + 2; // Implicit bool -> int conversion. True is 1, false is 0. const uint32_t mmShift = ieeeMantissa != 0 || ieeeExponent <= 1; const uint32_t mm = 4 * m2 - 1 - mmShift; // Step 3: Convert to a decimal power base using 64-bit arithmetic. uint32_t vr, vp, vm; int32_t e10; bool vmIsTrailingZeros = false; bool vrIsTrailingZeros = false; uint8_t lastRemovedDigit = 0; if (e2 >= 0) { const uint32_t q = log10Pow2(e2); e10 = (int32_t) q; const int32_t k = FLOAT_POW5_INV_BITCOUNT + pow5bits((int32_t) q) - 1; const int32_t i = -e2 + (int32_t) q + k; vr = mulPow5InvDivPow2(mv, q, i); vp = mulPow5InvDivPow2(mp, q, i); vm = mulPow5InvDivPow2(mm, q, i); #ifdef RYU_DEBUG printf("%u * 2^%d / 10^%u\n", mv, e2, q); printf("V+=%u\nV =%u\nV-=%u\n", vp, vr, vm); #endif if (q != 0 && (vp - 1) / 10 <= vm / 10) { // We need to know one removed digit even if we are not going to loop below. We could use // q = X - 1 above, except that would require 33 bits for the result, and we've found that // 32-bit arithmetic is faster even on 64-bit machines. const int32_t l = FLOAT_POW5_INV_BITCOUNT + pow5bits((int32_t) (q - 1)) - 1; lastRemovedDigit = (uint8_t) (mulPow5InvDivPow2(mv, q - 1, -e2 + (int32_t) q - 1 + l) % 10); } if (q <= 9) { // The largest power of 5 that fits in 24 bits is 5^10, but q <= 9 seems to be safe as well. // Only one of mp, mv, and mm can be a multiple of 5, if any. if (mv % 5 == 0) { vrIsTrailingZeros = multipleOfPowerOf5_32(mv, q); } else if (acceptBounds) { vmIsTrailingZeros = multipleOfPowerOf5_32(mm, q); } else { vp -= multipleOfPowerOf5_32(mp, q); } } } else { const uint32_t q = log10Pow5(-e2); e10 = (int32_t) q + e2; const int32_t i = -e2 - (int32_t) q; const int32_t k = pow5bits(i) - FLOAT_POW5_BITCOUNT; int32_t j = (int32_t) q - k; vr = mulPow5divPow2(mv, (uint32_t) i, j); vp = mulPow5divPow2(mp, (uint32_t) i, j); vm = mulPow5divPow2(mm, (uint32_t) i, j); #ifdef RYU_DEBUG printf("%u * 5^%d / 10^%u\n", mv, -e2, q); printf("%u %d %d %d\n", q, i, k, j); printf("V+=%u\nV =%u\nV-=%u\n", vp, vr, vm); #endif if (q != 0 && (vp - 1) / 10 <= vm / 10) { j = (int32_t) q - 1 - (pow5bits(i + 1) - FLOAT_POW5_BITCOUNT); lastRemovedDigit = (uint8_t) (mulPow5divPow2(mv, (uint32_t) (i + 1), j) % 10); } if (q <= 1) { // {vr,vp,vm} is trailing zeros if {mv,mp,mm} has at least q trailing 0 bits. // mv = 4 * m2, so it always has at least two trailing 0 bits. vrIsTrailingZeros = true; if (acceptBounds) { // mm = mv - 1 - mmShift, so it has 1 trailing 0 bit iff mmShift == 1. vmIsTrailingZeros = mmShift == 1; } else { // mp = mv + 2, so it always has at least one trailing 0 bit. --vp; } } else if (q < 31) { // TODO(ulfjack): Use a tighter bound here. vrIsTrailingZeros = multipleOfPowerOf2_32(mv, q - 1); #ifdef RYU_DEBUG printf("vr is trailing zeros=%s\n", vrIsTrailingZeros ? "true" : "false"); #endif } } #ifdef RYU_DEBUG printf("e10=%d\n", e10); printf("V+=%u\nV =%u\nV-=%u\n", vp, vr, vm); printf("vm is trailing zeros=%s\n", vmIsTrailingZeros ? "true" : "false"); printf("vr is trailing zeros=%s\n", vrIsTrailingZeros ? "true" : "false"); #endif // Step 4: Find the shortest decimal representation in the interval of valid representations. int32_t removed = 0; uint32_t output; if (vmIsTrailingZeros || vrIsTrailingZeros) { // General case, which happens rarely (~4.0%). while (vp / 10 > vm / 10) { #ifdef __clang__ // https://bugs.llvm.org/show_bug.cgi?id=23106 // The compiler does not realize that vm % 10 can be computed from vm / 10 // as vm - (vm / 10) * 10. vmIsTrailingZeros &= vm - (vm / 10) * 10 == 0; #else vmIsTrailingZeros &= vm % 10 == 0; #endif vrIsTrailingZeros &= lastRemovedDigit == 0; lastRemovedDigit = (uint8_t) (vr % 10); vr /= 10; vp /= 10; vm /= 10; ++removed; } #ifdef RYU_DEBUG printf("V+=%u\nV =%u\nV-=%u\n", vp, vr, vm); printf("d-10=%s\n", vmIsTrailingZeros ? "true" : "false"); #endif if (vmIsTrailingZeros) { while (vm % 10 == 0) { vrIsTrailingZeros &= lastRemovedDigit == 0; lastRemovedDigit = (uint8_t) (vr % 10); vr /= 10; vp /= 10; vm /= 10; ++removed; } } #ifdef RYU_DEBUG printf("%u %d\n", vr, lastRemovedDigit); printf("vr is trailing zeros=%s\n", vrIsTrailingZeros ? "true" : "false"); #endif if (vrIsTrailingZeros && lastRemovedDigit == 5 && vr % 2 == 0) { // Round even if the exact number is .....50..0. lastRemovedDigit = 4; } // We need to take vr + 1 if vr is outside bounds or we need to round up. output = vr + ((vr == vm && (!acceptBounds || !vmIsTrailingZeros)) || lastRemovedDigit >= 5); } else { // Specialized for the common case (~96.0%). Percentages below are relative to this. // Loop iterations below (approximately): // 0: 13.6%, 1: 70.7%, 2: 14.1%, 3: 1.39%, 4: 0.14%, 5+: 0.01% while (vp / 10 > vm / 10) { lastRemovedDigit = (uint8_t) (vr % 10); vr /= 10; vp /= 10; vm /= 10; ++removed; } #ifdef RYU_DEBUG printf("%u %d\n", vr, lastRemovedDigit); printf("vr is trailing zeros=%s\n", vrIsTrailingZeros ? "true" : "false"); #endif // We need to take vr + 1 if vr is outside bounds or we need to round up. output = vr + (vr == vm || lastRemovedDigit >= 5); } const int32_t exp = e10 + removed; #ifdef RYU_DEBUG printf("V+=%u\nV =%u\nV-=%u\n", vp, vr, vm); printf("O=%u\n", output); printf("EXP=%d\n", exp); #endif floating_decimal_32 fd; fd.exponent = exp; fd.mantissa = output; return fd; } static inline int to_chars(const floating_decimal_32 v, const bool sign, char* const result) { // Step 5: Print the decimal representation. int index = 0; if (sign) { result[index++] = '-'; } uint32_t output = v.mantissa; const uint32_t olength = decimalLength9(output); #ifdef RYU_DEBUG printf("DIGITS=%u\n", v.mantissa); printf("OLEN=%u\n", olength); printf("EXP=%u\n", v.exponent + olength); #endif // Print the decimal digits. // The following code is equivalent to: // for (uint32_t i = 0; i < olength - 1; ++i) { // const uint32_t c = output % 10; output /= 10; // result[index + olength - i] = (char) ('0' + c); // } // result[index] = '0' + output % 10; uint32_t i = 0; while (output >= 10000) { #ifdef __clang__ // https://bugs.llvm.org/show_bug.cgi?id=38217 const uint32_t c = output - 10000 * (output / 10000); #else const uint32_t c = output % 10000; #endif output /= 10000; const uint32_t c0 = (c % 100) << 1; const uint32_t c1 = (c / 100) << 1; memcpy(result + index + olength - i - 1, DIGIT_TABLE + c0, 2); memcpy(result + index + olength - i - 3, DIGIT_TABLE + c1, 2); i += 4; } if (output >= 100) { const uint32_t c = (output % 100) << 1; output /= 100; memcpy(result + index + olength - i - 1, DIGIT_TABLE + c, 2); i += 2; } if (output >= 10) { const uint32_t c = output << 1; // We can't use memcpy here: the decimal dot goes between these two digits. result[index + olength - i] = DIGIT_TABLE[c + 1]; result[index] = DIGIT_TABLE[c]; } else { result[index] = (char) ('0' + output); } // Print decimal point if needed. if (olength > 1) { result[index + 1] = '.'; index += olength + 1; } else { ++index; } // Print the exponent. result[index++] = 'E'; int32_t exp = v.exponent + (int32_t) olength - 1; if (exp < 0) { result[index++] = '-'; exp = -exp; } if (exp >= 10) { memcpy(result + index, DIGIT_TABLE + 2 * exp, 2); index += 2; } else { result[index++] = (char) ('0' + exp); } return index; } int f2s_buffered_n(float f, char* result) { // Step 1: Decode the floating-point number, and unify normalized and subnormal cases. const uint32_t bits = float_to_bits(f); #ifdef RYU_DEBUG printf("IN="); for (int32_t bit = 31; bit >= 0; --bit) { printf("%u", (bits >> bit) & 1); } printf("\n"); #endif // Decode bits into sign, mantissa, and exponent. const bool ieeeSign = ((bits >> (FLOAT_MANTISSA_BITS + FLOAT_EXPONENT_BITS)) & 1) != 0; const uint32_t ieeeMantissa = bits & ((1u << FLOAT_MANTISSA_BITS) - 1); const uint32_t ieeeExponent = (bits >> FLOAT_MANTISSA_BITS) & ((1u << FLOAT_EXPONENT_BITS) - 1); // Case distinction; exit early for the easy cases. if (ieeeExponent == ((1u << FLOAT_EXPONENT_BITS) - 1u) || (ieeeExponent == 0 && ieeeMantissa == 0)) { return copy_special_str(result, ieeeSign, ieeeExponent, ieeeMantissa); } const floating_decimal_32 v = f2d(ieeeMantissa, ieeeExponent); return to_chars(v, ieeeSign, result); } void f2s_buffered(float f, char* result) { const int index = f2s_buffered_n(f, result); // Terminate the string. result[index] = '\0'; } char* f2s(float f) { char* const result = (char*) malloc(16); f2s_buffered(f, result); return result; }
0
repos/ryu
repos/ryu/ryu/generic_128.c
// Copyright 2018 Ulf Adams // // The contents of this file may be used under the terms of the Apache License, // Version 2.0. // // (See accompanying file LICENSE-Apache or copy at // http://www.apache.org/licenses/LICENSE-2.0) // // Alternatively, the contents of this file may be used under the terms of // the Boost Software License, Version 1.0. // (See accompanying file LICENSE-Boost or copy at // https://www.boost.org/LICENSE_1_0.txt) // // Unless required by applicable law or agreed to in writing, this software // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. // Runtime compiler options: // -DRYU_DEBUG Generate verbose debugging output to stdout. #include "ryu/ryu_generic_128.h" #include <assert.h> #include <stdbool.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "ryu/generic_128.h" #ifdef RYU_DEBUG #include <inttypes.h> #include <stdio.h> static char* s(uint128_t v) { int len = decimalLength(v); char* b = (char*) malloc((len + 1) * sizeof(char)); for (int i = 0; i < len; i++) { const uint32_t c = (uint32_t) (v % 10); v /= 10; b[len - 1 - i] = (char) ('0' + c); } b[len] = 0; return b; } #endif #define ONE ((uint128_t) 1) #define FLOAT_MANTISSA_BITS 23 #define FLOAT_EXPONENT_BITS 8 struct floating_decimal_128 float_to_fd128(float f) { uint32_t bits = 0; memcpy(&bits, &f, sizeof(float)); return generic_binary_to_decimal(bits, FLOAT_MANTISSA_BITS, FLOAT_EXPONENT_BITS, false); } #define DOUBLE_MANTISSA_BITS 52 #define DOUBLE_EXPONENT_BITS 11 struct floating_decimal_128 double_to_fd128(double d) { uint64_t bits = 0; memcpy(&bits, &d, sizeof(double)); return generic_binary_to_decimal(bits, DOUBLE_MANTISSA_BITS, DOUBLE_EXPONENT_BITS, false); } #define LONG_DOUBLE_MANTISSA_BITS 64 #define LONG_DOUBLE_EXPONENT_BITS 15 struct floating_decimal_128 long_double_to_fd128(long double d) { uint128_t bits = 0; memcpy(&bits, &d, sizeof(long double)); #ifdef RYU_DEBUG // For some odd reason, this ends up with noise in the top 48 bits. We can // clear out those bits with the following line; this is not required, the // conversion routine should ignore those bits, but the debug output can be // confusing if they aren't 0s. bits &= (ONE << 80) - 1; #endif return generic_binary_to_decimal(bits, LONG_DOUBLE_MANTISSA_BITS, LONG_DOUBLE_EXPONENT_BITS, true); } struct floating_decimal_128 generic_binary_to_decimal( const uint128_t bits, const uint32_t mantissaBits, const uint32_t exponentBits, const bool explicitLeadingBit) { #ifdef RYU_DEBUG printf("IN="); for (int32_t bit = 127; bit >= 0; --bit) { printf("%u", (uint32_t) ((bits >> bit) & 1)); } printf("\n"); #endif const uint32_t bias = (1u << (exponentBits - 1)) - 1; const bool ieeeSign = ((bits >> (mantissaBits + exponentBits)) & 1) != 0; const uint128_t ieeeMantissa = bits & ((ONE << mantissaBits) - 1); const uint32_t ieeeExponent = (uint32_t) ((bits >> mantissaBits) & ((ONE << exponentBits) - 1u)); if (ieeeExponent == 0 && ieeeMantissa == 0) { struct floating_decimal_128 fd; fd.mantissa = 0; fd.exponent = 0; fd.sign = ieeeSign; return fd; } if (ieeeExponent == ((1u << exponentBits) - 1u)) { struct floating_decimal_128 fd; fd.mantissa = explicitLeadingBit ? ieeeMantissa & ((ONE << (mantissaBits - 1)) - 1) : ieeeMantissa; fd.exponent = FD128_EXCEPTIONAL_EXPONENT; fd.sign = ieeeSign; return fd; } int32_t e2; uint128_t m2; // We subtract 2 in all cases so that the bounds computation has 2 additional bits. if (explicitLeadingBit) { // mantissaBits includes the explicit leading bit, so we need to correct for that here. if (ieeeExponent == 0) { e2 = 1 - bias - mantissaBits + 1 - 2; } else { e2 = ieeeExponent - bias - mantissaBits + 1 - 2; } m2 = ieeeMantissa; } else { if (ieeeExponent == 0) { e2 = 1 - bias - mantissaBits - 2; m2 = ieeeMantissa; } else { e2 = ieeeExponent - bias - mantissaBits - 2; m2 = (ONE << mantissaBits) | ieeeMantissa; } } const bool even = (m2 & 1) == 0; const bool acceptBounds = even; #ifdef RYU_DEBUG printf("-> %s %s * 2^%d\n", ieeeSign ? "-" : "+", s(m2), e2 + 2); #endif // Step 2: Determine the interval of legal decimal representations. const uint128_t mv = 4 * m2; // Implicit bool -> int conversion. True is 1, false is 0. const uint32_t mmShift = (ieeeMantissa != (explicitLeadingBit ? ONE << (mantissaBits - 1) : 0)) || (ieeeExponent == 0); // Step 3: Convert to a decimal power base using 128-bit arithmetic. uint128_t vr, vp, vm; int32_t e10; bool vmIsTrailingZeros = false; bool vrIsTrailingZeros = false; if (e2 >= 0) { // I tried special-casing q == 0, but there was no effect on performance. // This expression is slightly faster than max(0, log10Pow2(e2) - 1). const uint32_t q = log10Pow2(e2) - (e2 > 3); e10 = q; const int32_t k = FLOAT_128_POW5_INV_BITCOUNT + pow5bits(q) - 1; const int32_t i = -e2 + q + k; uint64_t pow5[4]; generic_computeInvPow5(q, pow5); vr = mulShift(4 * m2, pow5, i); vp = mulShift(4 * m2 + 2, pow5, i); vm = mulShift(4 * m2 - 1 - mmShift, pow5, i); #ifdef RYU_DEBUG printf("%s * 2^%d / 10^%d\n", s(mv), e2, q); printf("V+=%s\nV =%s\nV-=%s\n", s(vp), s(vr), s(vm)); #endif // floor(log_5(2^128)) = 55, this is very conservative if (q <= 55) { // Only one of mp, mv, and mm can be a multiple of 5, if any. if (mv % 5 == 0) { vrIsTrailingZeros = multipleOfPowerOf5(mv, q - 1); } else if (acceptBounds) { // Same as min(e2 + (~mm & 1), pow5Factor(mm)) >= q // <=> e2 + (~mm & 1) >= q && pow5Factor(mm) >= q // <=> true && pow5Factor(mm) >= q, since e2 >= q. vmIsTrailingZeros = multipleOfPowerOf5(mv - 1 - mmShift, q); } else { // Same as min(e2 + 1, pow5Factor(mp)) >= q. vp -= multipleOfPowerOf5(mv + 2, q); } } } else { // This expression is slightly faster than max(0, log10Pow5(-e2) - 1). const uint32_t q = log10Pow5(-e2) - (-e2 > 1); e10 = q + e2; const int32_t i = -e2 - q; const int32_t k = pow5bits(i) - FLOAT_128_POW5_BITCOUNT; const int32_t j = q - k; uint64_t pow5[4]; generic_computePow5(i, pow5); vr = mulShift(4 * m2, pow5, j); vp = mulShift(4 * m2 + 2, pow5, j); vm = mulShift(4 * m2 - 1 - mmShift, pow5, j); #ifdef RYU_DEBUG printf("%s * 5^%d / 10^%d\n", s(mv), -e2, q); printf("%d %d %d %d\n", q, i, k, j); printf("V+=%s\nV =%s\nV-=%s\n", s(vp), s(vr), s(vm)); #endif if (q <= 1) { // {vr,vp,vm} is trailing zeros if {mv,mp,mm} has at least q trailing 0 bits. // mv = 4 m2, so it always has at least two trailing 0 bits. vrIsTrailingZeros = true; if (acceptBounds) { // mm = mv - 1 - mmShift, so it has 1 trailing 0 bit iff mmShift == 1. vmIsTrailingZeros = mmShift == 1; } else { // mp = mv + 2, so it always has at least one trailing 0 bit. --vp; } } else if (q < 127) { // TODO(ulfjack): Use a tighter bound here. // We need to compute min(ntz(mv), pow5Factor(mv) - e2) >= q-1 // <=> ntz(mv) >= q-1 && pow5Factor(mv) - e2 >= q-1 // <=> ntz(mv) >= q-1 (e2 is negative and -e2 >= q) // <=> (mv & ((1 << (q-1)) - 1)) == 0 // We also need to make sure that the left shift does not overflow. vrIsTrailingZeros = multipleOfPowerOf2(mv, q - 1); #ifdef RYU_DEBUG printf("vr is trailing zeros=%s\n", vrIsTrailingZeros ? "true" : "false"); #endif } } #ifdef RYU_DEBUG printf("e10=%d\n", e10); printf("V+=%s\nV =%s\nV-=%s\n", s(vp), s(vr), s(vm)); printf("vm is trailing zeros=%s\n", vmIsTrailingZeros ? "true" : "false"); printf("vr is trailing zeros=%s\n", vrIsTrailingZeros ? "true" : "false"); #endif // Step 4: Find the shortest decimal representation in the interval of legal representations. uint32_t removed = 0; uint8_t lastRemovedDigit = 0; uint128_t output; while (vp / 10 > vm / 10) { vmIsTrailingZeros &= vm % 10 == 0; vrIsTrailingZeros &= lastRemovedDigit == 0; lastRemovedDigit = (uint8_t) (vr % 10); vr /= 10; vp /= 10; vm /= 10; ++removed; } #ifdef RYU_DEBUG printf("V+=%s\nV =%s\nV-=%s\n", s(vp), s(vr), s(vm)); printf("d-10=%s\n", vmIsTrailingZeros ? "true" : "false"); #endif if (vmIsTrailingZeros) { while (vm % 10 == 0) { vrIsTrailingZeros &= lastRemovedDigit == 0; lastRemovedDigit = (uint8_t) (vr % 10); vr /= 10; vp /= 10; vm /= 10; ++removed; } } #ifdef RYU_DEBUG printf("%s %d\n", s(vr), lastRemovedDigit); printf("vr is trailing zeros=%s\n", vrIsTrailingZeros ? "true" : "false"); #endif if (vrIsTrailingZeros && (lastRemovedDigit == 5) && (vr % 2 == 0)) { // Round even if the exact numbers is .....50..0. lastRemovedDigit = 4; } // We need to take vr+1 if vr is outside bounds or we need to round up. output = vr + ((vr == vm && (!acceptBounds || !vmIsTrailingZeros)) || (lastRemovedDigit >= 5)); const int32_t exp = e10 + removed; #ifdef RYU_DEBUG printf("V+=%s\nV =%s\nV-=%s\n", s(vp), s(vr), s(vm)); printf("O=%s\n", s(output)); printf("EXP=%d\n", exp); #endif struct floating_decimal_128 fd; fd.mantissa = output; fd.exponent = exp; fd.sign = ieeeSign; return fd; } static inline int copy_special_str(char * const result, const struct floating_decimal_128 fd) { if (fd.mantissa) { memcpy(result, "NaN", 3); return 3; } if (fd.sign) { result[0] = '-'; } memcpy(result + fd.sign, "Infinity", 8); return fd.sign + 8; } int generic_to_chars(const struct floating_decimal_128 v, char* const result) { if (v.exponent == FD128_EXCEPTIONAL_EXPONENT) { return copy_special_str(result, v); } // Step 5: Print the decimal representation. int index = 0; if (v.sign) { result[index++] = '-'; } uint128_t output = v.mantissa; const uint32_t olength = decimalLength(output); #ifdef RYU_DEBUG printf("DIGITS=%s\n", s(v.mantissa)); printf("OLEN=%u\n", olength); printf("EXP=%u\n", v.exponent + olength); #endif for (uint32_t i = 0; i < olength - 1; ++i) { const uint32_t c = (uint32_t) (output % 10); output /= 10; result[index + olength - i] = (char) ('0' + c); } result[index] = '0' + (uint32_t) (output % 10); // output should be < 10 by now. // Print decimal point if needed. if (olength > 1) { result[index + 1] = '.'; index += olength + 1; } else { ++index; } // Print the exponent. result[index++] = 'E'; int32_t exp = v.exponent + olength - 1; if (exp < 0) { result[index++] = '-'; exp = -exp; } uint32_t elength = decimalLength(exp); for (uint32_t i = 0; i < elength; ++i) { const uint32_t c = exp % 10; exp /= 10; result[index + elength - 1 - i] = (char) ('0' + c); } index += elength; return index; }
0
repos/ryu
repos/ryu/ryu/d2s.c
// Copyright 2018 Ulf Adams // // The contents of this file may be used under the terms of the Apache License, // Version 2.0. // // (See accompanying file LICENSE-Apache or copy at // http://www.apache.org/licenses/LICENSE-2.0) // // Alternatively, the contents of this file may be used under the terms of // the Boost Software License, Version 1.0. // (See accompanying file LICENSE-Boost or copy at // https://www.boost.org/LICENSE_1_0.txt) // // Unless required by applicable law or agreed to in writing, this software // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. // Runtime compiler options: // -DRYU_DEBUG Generate verbose debugging output to stdout. // // -DRYU_ONLY_64_BIT_OPS Avoid using uint128_t or 64-bit intrinsics. Slower, // depending on your compiler. // // -DRYU_OPTIMIZE_SIZE Use smaller lookup tables. Instead of storing every // required power of 5, only store every 26th entry, and compute // intermediate values with a multiplication. This reduces the lookup table // size by about 10x (only one case, and only double) at the cost of some // performance. Currently requires MSVC intrinsics. #include "ryu/ryu.h" #include <assert.h> #include <stdbool.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #ifdef RYU_DEBUG #include <inttypes.h> #include <stdio.h> #endif #include "ryu/common.h" #include "ryu/digit_table.h" #include "ryu/d2s_intrinsics.h" // Include either the small or the full lookup tables depending on the mode. #if defined(RYU_OPTIMIZE_SIZE) #include "ryu/d2s_small_table.h" #else #include "ryu/d2s_full_table.h" #endif #define DOUBLE_MANTISSA_BITS 52 #define DOUBLE_EXPONENT_BITS 11 #define DOUBLE_BIAS 1023 static inline uint32_t decimalLength17(const uint64_t v) { // This is slightly faster than a loop. // The average output length is 16.38 digits, so we check high-to-low. // Function precondition: v is not an 18, 19, or 20-digit number. // (17 digits are sufficient for round-tripping.) assert(v < 100000000000000000L); if (v >= 10000000000000000L) { return 17; } if (v >= 1000000000000000L) { return 16; } if (v >= 100000000000000L) { return 15; } if (v >= 10000000000000L) { return 14; } if (v >= 1000000000000L) { return 13; } if (v >= 100000000000L) { return 12; } if (v >= 10000000000L) { return 11; } if (v >= 1000000000L) { return 10; } if (v >= 100000000L) { return 9; } if (v >= 10000000L) { return 8; } if (v >= 1000000L) { return 7; } if (v >= 100000L) { return 6; } if (v >= 10000L) { return 5; } if (v >= 1000L) { return 4; } if (v >= 100L) { return 3; } if (v >= 10L) { return 2; } return 1; } // A floating decimal representing m * 10^e. typedef struct floating_decimal_64 { uint64_t mantissa; // Decimal exponent's range is -324 to 308 // inclusive, and can fit in a short if needed. int32_t exponent; } floating_decimal_64; static inline floating_decimal_64 d2d(const uint64_t ieeeMantissa, const uint32_t ieeeExponent) { int32_t e2; uint64_t m2; if (ieeeExponent == 0) { // We subtract 2 so that the bounds computation has 2 additional bits. e2 = 1 - DOUBLE_BIAS - DOUBLE_MANTISSA_BITS - 2; m2 = ieeeMantissa; } else { e2 = (int32_t) ieeeExponent - DOUBLE_BIAS - DOUBLE_MANTISSA_BITS - 2; m2 = (1ull << DOUBLE_MANTISSA_BITS) | ieeeMantissa; } const bool even = (m2 & 1) == 0; const bool acceptBounds = even; #ifdef RYU_DEBUG printf("-> %" PRIu64 " * 2^%d\n", m2, e2 + 2); #endif // Step 2: Determine the interval of valid decimal representations. const uint64_t mv = 4 * m2; // Implicit bool -> int conversion. True is 1, false is 0. const uint32_t mmShift = ieeeMantissa != 0 || ieeeExponent <= 1; // We would compute mp and mm like this: // uint64_t mp = 4 * m2 + 2; // uint64_t mm = mv - 1 - mmShift; // Step 3: Convert to a decimal power base using 128-bit arithmetic. uint64_t vr, vp, vm; int32_t e10; bool vmIsTrailingZeros = false; bool vrIsTrailingZeros = false; if (e2 >= 0) { // I tried special-casing q == 0, but there was no effect on performance. // This expression is slightly faster than max(0, log10Pow2(e2) - 1). const uint32_t q = log10Pow2(e2) - (e2 > 3); e10 = (int32_t) q; const int32_t k = DOUBLE_POW5_INV_BITCOUNT + pow5bits((int32_t) q) - 1; const int32_t i = -e2 + (int32_t) q + k; #if defined(RYU_OPTIMIZE_SIZE) uint64_t pow5[2]; double_computeInvPow5(q, pow5); vr = mulShiftAll64(m2, pow5, i, &vp, &vm, mmShift); #else vr = mulShiftAll64(m2, DOUBLE_POW5_INV_SPLIT[q], i, &vp, &vm, mmShift); #endif #ifdef RYU_DEBUG printf("%" PRIu64 " * 2^%d / 10^%u\n", mv, e2, q); printf("V+=%" PRIu64 "\nV =%" PRIu64 "\nV-=%" PRIu64 "\n", vp, vr, vm); #endif if (q <= 21) { // This should use q <= 22, but I think 21 is also safe. Smaller values // may still be safe, but it's more difficult to reason about them. // Only one of mp, mv, and mm can be a multiple of 5, if any. const uint32_t mvMod5 = ((uint32_t) mv) - 5 * ((uint32_t) div5(mv)); if (mvMod5 == 0) { vrIsTrailingZeros = multipleOfPowerOf5(mv, q); } else if (acceptBounds) { // Same as min(e2 + (~mm & 1), pow5Factor(mm)) >= q // <=> e2 + (~mm & 1) >= q && pow5Factor(mm) >= q // <=> true && pow5Factor(mm) >= q, since e2 >= q. vmIsTrailingZeros = multipleOfPowerOf5(mv - 1 - mmShift, q); } else { // Same as min(e2 + 1, pow5Factor(mp)) >= q. vp -= multipleOfPowerOf5(mv + 2, q); } } } else { // This expression is slightly faster than max(0, log10Pow5(-e2) - 1). const uint32_t q = log10Pow5(-e2) - (-e2 > 1); e10 = (int32_t) q + e2; const int32_t i = -e2 - (int32_t) q; const int32_t k = pow5bits(i) - DOUBLE_POW5_BITCOUNT; const int32_t j = (int32_t) q - k; #if defined(RYU_OPTIMIZE_SIZE) uint64_t pow5[2]; double_computePow5(i, pow5); vr = mulShiftAll64(m2, pow5, j, &vp, &vm, mmShift); #else vr = mulShiftAll64(m2, DOUBLE_POW5_SPLIT[i], j, &vp, &vm, mmShift); #endif #ifdef RYU_DEBUG printf("%" PRIu64 " * 5^%d / 10^%u\n", mv, -e2, q); printf("%u %d %d %d\n", q, i, k, j); printf("V+=%" PRIu64 "\nV =%" PRIu64 "\nV-=%" PRIu64 "\n", vp, vr, vm); #endif if (q <= 1) { // {vr,vp,vm} is trailing zeros if {mv,mp,mm} has at least q trailing 0 bits. // mv = 4 * m2, so it always has at least two trailing 0 bits. vrIsTrailingZeros = true; if (acceptBounds) { // mm = mv - 1 - mmShift, so it has 1 trailing 0 bit iff mmShift == 1. vmIsTrailingZeros = mmShift == 1; } else { // mp = mv + 2, so it always has at least one trailing 0 bit. --vp; } } else if (q < 63) { // TODO(ulfjack): Use a tighter bound here. // We want to know if the full product has at least q trailing zeros. // We need to compute min(p2(mv), p5(mv) - e2) >= q // <=> p2(mv) >= q && p5(mv) - e2 >= q // <=> p2(mv) >= q (because -e2 >= q) vrIsTrailingZeros = multipleOfPowerOf2(mv, q); #ifdef RYU_DEBUG printf("vr is trailing zeros=%s\n", vrIsTrailingZeros ? "true" : "false"); #endif } } #ifdef RYU_DEBUG printf("e10=%d\n", e10); printf("V+=%" PRIu64 "\nV =%" PRIu64 "\nV-=%" PRIu64 "\n", vp, vr, vm); printf("vm is trailing zeros=%s\n", vmIsTrailingZeros ? "true" : "false"); printf("vr is trailing zeros=%s\n", vrIsTrailingZeros ? "true" : "false"); #endif // Step 4: Find the shortest decimal representation in the interval of valid representations. int32_t removed = 0; uint8_t lastRemovedDigit = 0; uint64_t output; // On average, we remove ~2 digits. if (vmIsTrailingZeros || vrIsTrailingZeros) { // General case, which happens rarely (~0.7%). for (;;) { const uint64_t vpDiv10 = div10(vp); const uint64_t vmDiv10 = div10(vm); if (vpDiv10 <= vmDiv10) { break; } const uint32_t vmMod10 = ((uint32_t) vm) - 10 * ((uint32_t) vmDiv10); const uint64_t vrDiv10 = div10(vr); const uint32_t vrMod10 = ((uint32_t) vr) - 10 * ((uint32_t) vrDiv10); vmIsTrailingZeros &= vmMod10 == 0; vrIsTrailingZeros &= lastRemovedDigit == 0; lastRemovedDigit = (uint8_t) vrMod10; vr = vrDiv10; vp = vpDiv10; vm = vmDiv10; ++removed; } #ifdef RYU_DEBUG printf("V+=%" PRIu64 "\nV =%" PRIu64 "\nV-=%" PRIu64 "\n", vp, vr, vm); printf("d-10=%s\n", vmIsTrailingZeros ? "true" : "false"); #endif if (vmIsTrailingZeros) { for (;;) { const uint64_t vmDiv10 = div10(vm); const uint32_t vmMod10 = ((uint32_t) vm) - 10 * ((uint32_t) vmDiv10); if (vmMod10 != 0) { break; } const uint64_t vpDiv10 = div10(vp); const uint64_t vrDiv10 = div10(vr); const uint32_t vrMod10 = ((uint32_t) vr) - 10 * ((uint32_t) vrDiv10); vrIsTrailingZeros &= lastRemovedDigit == 0; lastRemovedDigit = (uint8_t) vrMod10; vr = vrDiv10; vp = vpDiv10; vm = vmDiv10; ++removed; } } #ifdef RYU_DEBUG printf("%" PRIu64 " %d\n", vr, lastRemovedDigit); printf("vr is trailing zeros=%s\n", vrIsTrailingZeros ? "true" : "false"); #endif if (vrIsTrailingZeros && lastRemovedDigit == 5 && vr % 2 == 0) { // Round even if the exact number is .....50..0. lastRemovedDigit = 4; } // We need to take vr + 1 if vr is outside bounds or we need to round up. output = vr + ((vr == vm && (!acceptBounds || !vmIsTrailingZeros)) || lastRemovedDigit >= 5); } else { // Specialized for the common case (~99.3%). Percentages below are relative to this. bool roundUp = false; const uint64_t vpDiv100 = div100(vp); const uint64_t vmDiv100 = div100(vm); if (vpDiv100 > vmDiv100) { // Optimization: remove two digits at a time (~86.2%). const uint64_t vrDiv100 = div100(vr); const uint32_t vrMod100 = ((uint32_t) vr) - 100 * ((uint32_t) vrDiv100); roundUp = vrMod100 >= 50; vr = vrDiv100; vp = vpDiv100; vm = vmDiv100; removed += 2; } // Loop iterations below (approximately), without optimization above: // 0: 0.03%, 1: 13.8%, 2: 70.6%, 3: 14.0%, 4: 1.40%, 5: 0.14%, 6+: 0.02% // Loop iterations below (approximately), with optimization above: // 0: 70.6%, 1: 27.8%, 2: 1.40%, 3: 0.14%, 4+: 0.02% for (;;) { const uint64_t vpDiv10 = div10(vp); const uint64_t vmDiv10 = div10(vm); if (vpDiv10 <= vmDiv10) { break; } const uint64_t vrDiv10 = div10(vr); const uint32_t vrMod10 = ((uint32_t) vr) - 10 * ((uint32_t) vrDiv10); roundUp = vrMod10 >= 5; vr = vrDiv10; vp = vpDiv10; vm = vmDiv10; ++removed; } #ifdef RYU_DEBUG printf("%" PRIu64 " roundUp=%s\n", vr, roundUp ? "true" : "false"); printf("vr is trailing zeros=%s\n", vrIsTrailingZeros ? "true" : "false"); #endif // We need to take vr + 1 if vr is outside bounds or we need to round up. output = vr + (vr == vm || roundUp); } const int32_t exp = e10 + removed; #ifdef RYU_DEBUG printf("V+=%" PRIu64 "\nV =%" PRIu64 "\nV-=%" PRIu64 "\n", vp, vr, vm); printf("O=%" PRIu64 "\n", output); printf("EXP=%d\n", exp); #endif floating_decimal_64 fd; fd.exponent = exp; fd.mantissa = output; return fd; } static inline int to_chars(const floating_decimal_64 v, const bool sign, char* const result) { // Step 5: Print the decimal representation. int index = 0; if (sign) { result[index++] = '-'; } uint64_t output = v.mantissa; const uint32_t olength = decimalLength17(output); #ifdef RYU_DEBUG printf("DIGITS=%" PRIu64 "\n", v.mantissa); printf("OLEN=%u\n", olength); printf("EXP=%u\n", v.exponent + olength); #endif // Print the decimal digits. // The following code is equivalent to: // for (uint32_t i = 0; i < olength - 1; ++i) { // const uint32_t c = output % 10; output /= 10; // result[index + olength - i] = (char) ('0' + c); // } // result[index] = '0' + output % 10; uint32_t i = 0; // We prefer 32-bit operations, even on 64-bit platforms. // We have at most 17 digits, and uint32_t can store 9 digits. // If output doesn't fit into uint32_t, we cut off 8 digits, // so the rest will fit into uint32_t. if ((output >> 32) != 0) { // Expensive 64-bit division. const uint64_t q = div1e8(output); uint32_t output2 = ((uint32_t) output) - 100000000 * ((uint32_t) q); output = q; const uint32_t c = output2 % 10000; output2 /= 10000; const uint32_t d = output2 % 10000; const uint32_t c0 = (c % 100) << 1; const uint32_t c1 = (c / 100) << 1; const uint32_t d0 = (d % 100) << 1; const uint32_t d1 = (d / 100) << 1; memcpy(result + index + olength - 1, DIGIT_TABLE + c0, 2); memcpy(result + index + olength - 3, DIGIT_TABLE + c1, 2); memcpy(result + index + olength - 5, DIGIT_TABLE + d0, 2); memcpy(result + index + olength - 7, DIGIT_TABLE + d1, 2); i += 8; } uint32_t output2 = (uint32_t) output; while (output2 >= 10000) { #ifdef __clang__ // https://bugs.llvm.org/show_bug.cgi?id=38217 const uint32_t c = output2 - 10000 * (output2 / 10000); #else const uint32_t c = output2 % 10000; #endif output2 /= 10000; const uint32_t c0 = (c % 100) << 1; const uint32_t c1 = (c / 100) << 1; memcpy(result + index + olength - i - 1, DIGIT_TABLE + c0, 2); memcpy(result + index + olength - i - 3, DIGIT_TABLE + c1, 2); i += 4; } if (output2 >= 100) { const uint32_t c = (output2 % 100) << 1; output2 /= 100; memcpy(result + index + olength - i - 1, DIGIT_TABLE + c, 2); i += 2; } if (output2 >= 10) { const uint32_t c = output2 << 1; // We can't use memcpy here: the decimal dot goes between these two digits. result[index + olength - i] = DIGIT_TABLE[c + 1]; result[index] = DIGIT_TABLE[c]; } else { result[index] = (char) ('0' + output2); } // Print decimal point if needed. if (olength > 1) { result[index + 1] = '.'; index += olength + 1; } else { ++index; } // Print the exponent. result[index++] = 'E'; int32_t exp = v.exponent + (int32_t) olength - 1; if (exp < 0) { result[index++] = '-'; exp = -exp; } if (exp >= 100) { const int32_t c = exp % 10; memcpy(result + index, DIGIT_TABLE + 2 * (exp / 10), 2); result[index + 2] = (char) ('0' + c); index += 3; } else if (exp >= 10) { memcpy(result + index, DIGIT_TABLE + 2 * exp, 2); index += 2; } else { result[index++] = (char) ('0' + exp); } return index; } static inline bool d2d_small_int(const uint64_t ieeeMantissa, const uint32_t ieeeExponent, floating_decimal_64* const v) { const uint64_t m2 = (1ull << DOUBLE_MANTISSA_BITS) | ieeeMantissa; const int32_t e2 = (int32_t) ieeeExponent - DOUBLE_BIAS - DOUBLE_MANTISSA_BITS; if (e2 > 0) { // f = m2 * 2^e2 >= 2^53 is an integer. // Ignore this case for now. return false; } if (e2 < -52) { // f < 1. return false; } // Since 2^52 <= m2 < 2^53 and 0 <= -e2 <= 52: 1 <= f = m2 / 2^-e2 < 2^53. // Test if the lower -e2 bits of the significand are 0, i.e. whether the fraction is 0. const uint64_t mask = (1ull << -e2) - 1; const uint64_t fraction = m2 & mask; if (fraction != 0) { return false; } // f is an integer in the range [1, 2^53). // Note: mantissa might contain trailing (decimal) 0's. // Note: since 2^53 < 10^16, there is no need to adjust decimalLength17(). v->mantissa = m2 >> -e2; v->exponent = 0; return true; } int d2s_buffered_n(double f, char* result) { // Step 1: Decode the floating-point number, and unify normalized and subnormal cases. const uint64_t bits = double_to_bits(f); #ifdef RYU_DEBUG printf("IN="); for (int32_t bit = 63; bit >= 0; --bit) { printf("%d", (int) ((bits >> bit) & 1)); } printf("\n"); #endif // Decode bits into sign, mantissa, and exponent. const bool ieeeSign = ((bits >> (DOUBLE_MANTISSA_BITS + DOUBLE_EXPONENT_BITS)) & 1) != 0; const uint64_t ieeeMantissa = bits & ((1ull << DOUBLE_MANTISSA_BITS) - 1); const uint32_t ieeeExponent = (uint32_t) ((bits >> DOUBLE_MANTISSA_BITS) & ((1u << DOUBLE_EXPONENT_BITS) - 1)); // Case distinction; exit early for the easy cases. if (ieeeExponent == ((1u << DOUBLE_EXPONENT_BITS) - 1u) || (ieeeExponent == 0 && ieeeMantissa == 0)) { return copy_special_str(result, ieeeSign, ieeeExponent, ieeeMantissa); } floating_decimal_64 v; const bool isSmallInt = d2d_small_int(ieeeMantissa, ieeeExponent, &v); if (isSmallInt) { // For small integers in the range [1, 2^53), v.mantissa might contain trailing (decimal) zeros. // For scientific notation we need to move these zeros into the exponent. // (This is not needed for fixed-point notation, so it might be beneficial to trim // trailing zeros in to_chars only if needed - once fixed-point notation output is implemented.) for (;;) { const uint64_t q = div10(v.mantissa); const uint32_t r = ((uint32_t) v.mantissa) - 10 * ((uint32_t) q); if (r != 0) { break; } v.mantissa = q; ++v.exponent; } } else { v = d2d(ieeeMantissa, ieeeExponent); } return to_chars(v, ieeeSign, result); } void d2s_buffered(double f, char* result) { const int index = d2s_buffered_n(f, result); // Terminate the string. result[index] = '\0'; } char* d2s(double f) { char* const result = (char*) malloc(25); d2s_buffered(f, result); return result; }
0
repos/ryu
repos/ryu/ryu/ryu_generic_128.h
// Copyright 2018 Ulf Adams // // The contents of this file may be used under the terms of the Apache License, // Version 2.0. // // (See accompanying file LICENSE-Apache or copy at // http://www.apache.org/licenses/LICENSE-2.0) // // Alternatively, the contents of this file may be used under the terms of // the Boost Software License, Version 1.0. // (See accompanying file LICENSE-Boost or copy at // https://www.boost.org/LICENSE_1_0.txt) // // Unless required by applicable law or agreed to in writing, this software // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. #ifndef RYU_GENERIC_128_H #define RYU_GENERIC_128_H #include <stdbool.h> #include <stdint.h> #ifdef __cplusplus extern "C" { #endif // This is a generic 128-bit implementation of float to shortest conversion // using the Ryu algorithm. It can handle any IEEE-compatible floating-point // type up to 128 bits. In order to use this correctly, you must use the // appropriate *_to_fd128 function for the underlying type - DO NOT CAST your // input to another floating-point type, doing so will result in incorrect // output! // // For any floating-point type that is not natively defined by the compiler, // you can use generic_binary_to_decimal to work directly on the underlying bit // representation. #define FD128_EXCEPTIONAL_EXPONENT 0x7FFFFFFF // A floating decimal representing (-1)^s * m * 10^e. struct floating_decimal_128 { __uint128_t mantissa; int32_t exponent; bool sign; }; struct floating_decimal_128 float_to_fd128(float f); struct floating_decimal_128 double_to_fd128(double d); // According to wikipedia (https://en.wikipedia.org/wiki/Long_double), this likely only works on // x86 with specific compilers (clang?). May need an ifdef. struct floating_decimal_128 long_double_to_fd128(long double d); // Converts the given binary floating point number to the shortest decimal floating point number // that still accurately represents it. struct floating_decimal_128 generic_binary_to_decimal( const __uint128_t bits, const uint32_t mantissaBits, const uint32_t exponentBits, const bool explicitLeadingBit); // Converts the given decimal floating point number to a string, writing to result, and returning // the number characters written. Does not terminate the buffer with a 0. In the worst case, this // function can write up to 53 characters. // // Maximal char buffer requirement: // sign + mantissa digits + decimal dot + 'E' + exponent sign + exponent digits // = 1 + 39 + 1 + 1 + 1 + 10 = 53 int generic_to_chars(const struct floating_decimal_128 v, char* const result); #ifdef __cplusplus } #endif #endif // RYU_GENERIC_128_H
0
repos/ryu
repos/ryu/ryu/f2s_intrinsics.h
// Copyright 2018 Ulf Adams // // The contents of this file may be used under the terms of the Apache License, // Version 2.0. // // (See accompanying file LICENSE-Apache or copy at // http://www.apache.org/licenses/LICENSE-2.0) // // Alternatively, the contents of this file may be used under the terms of // the Boost Software License, Version 1.0. // (See accompanying file LICENSE-Boost or copy at // https://www.boost.org/LICENSE_1_0.txt) // // Unless required by applicable law or agreed to in writing, this software // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. #ifndef RYU_F2S_INTRINSICS_H #define RYU_F2S_INTRINSICS_H // Defines RYU_32_BIT_PLATFORM if applicable. #include "ryu/common.h" #if defined(RYU_FLOAT_FULL_TABLE) #include "ryu/f2s_full_table.h" #else #if defined(RYU_OPTIMIZE_SIZE) #include "ryu/d2s_small_table.h" #else #include "ryu/d2s_full_table.h" #endif #define FLOAT_POW5_INV_BITCOUNT (DOUBLE_POW5_INV_BITCOUNT - 64) #define FLOAT_POW5_BITCOUNT (DOUBLE_POW5_BITCOUNT - 64) #endif static inline uint32_t pow5factor_32(uint32_t value) { uint32_t count = 0; for (;;) { assert(value != 0); const uint32_t q = value / 5; const uint32_t r = value % 5; if (r != 0) { break; } value = q; ++count; } return count; } // Returns true if value is divisible by 5^p. static inline bool multipleOfPowerOf5_32(const uint32_t value, const uint32_t p) { return pow5factor_32(value) >= p; } // Returns true if value is divisible by 2^p. static inline bool multipleOfPowerOf2_32(const uint32_t value, const uint32_t p) { // __builtin_ctz doesn't appear to be faster here. return (value & ((1u << p) - 1)) == 0; } // It seems to be slightly faster to avoid uint128_t here, although the // generated code for uint128_t looks slightly nicer. static inline uint32_t mulShift32(const uint32_t m, const uint64_t factor, const int32_t shift) { assert(shift > 32); // The casts here help MSVC to avoid calls to the __allmul library // function. const uint32_t factorLo = (uint32_t)(factor); const uint32_t factorHi = (uint32_t)(factor >> 32); const uint64_t bits0 = (uint64_t)m * factorLo; const uint64_t bits1 = (uint64_t)m * factorHi; #if defined(RYU_32_BIT_PLATFORM) // On 32-bit platforms we can avoid a 64-bit shift-right since we only // need the upper 32 bits of the result and the shift value is > 32. const uint32_t bits0Hi = (uint32_t)(bits0 >> 32); uint32_t bits1Lo = (uint32_t)(bits1); uint32_t bits1Hi = (uint32_t)(bits1 >> 32); bits1Lo += bits0Hi; bits1Hi += (bits1Lo < bits0Hi); if (shift >= 64) { // s2f can call this with a shift value >= 64, which we have to handle. // This could now be slower than the !defined(RYU_32_BIT_PLATFORM) case. return (uint32_t)(bits1Hi >> (shift - 64)); } else { const int32_t s = shift - 32; return (bits1Hi << (32 - s)) | (bits1Lo >> s); } #else // RYU_32_BIT_PLATFORM const uint64_t sum = (bits0 >> 32) + bits1; const uint64_t shiftedSum = sum >> (shift - 32); assert(shiftedSum <= UINT32_MAX); return (uint32_t) shiftedSum; #endif // RYU_32_BIT_PLATFORM } static inline uint32_t mulPow5InvDivPow2(const uint32_t m, const uint32_t q, const int32_t j) { #if defined(RYU_FLOAT_FULL_TABLE) return mulShift32(m, FLOAT_POW5_INV_SPLIT[q], j); #elif defined(RYU_OPTIMIZE_SIZE) // The inverse multipliers are defined as [2^x / 5^y] + 1; the upper 64 bits from the double lookup // table are the correct bits for [2^x / 5^y], so we have to add 1 here. Note that we rely on the // fact that the added 1 that's already stored in the table never overflows into the upper 64 bits. uint64_t pow5[2]; double_computeInvPow5(q, pow5); return mulShift32(m, pow5[1] + 1, j); #else return mulShift32(m, DOUBLE_POW5_INV_SPLIT[q][1] + 1, j); #endif } static inline uint32_t mulPow5divPow2(const uint32_t m, const uint32_t i, const int32_t j) { #if defined(RYU_FLOAT_FULL_TABLE) return mulShift32(m, FLOAT_POW5_SPLIT[i], j); #elif defined(RYU_OPTIMIZE_SIZE) uint64_t pow5[2]; double_computePow5(i, pow5); return mulShift32(m, pow5[1], j); #else return mulShift32(m, DOUBLE_POW5_SPLIT[i][1], j); #endif } #endif // RYU_F2S_INTRINSICS_H
0
repos/ryu
repos/ryu/ryu/d2s_full_table.h
// Copyright 2018 Ulf Adams // // The contents of this file may be used under the terms of the Apache License, // Version 2.0. // // (See accompanying file LICENSE-Apache or copy at // http://www.apache.org/licenses/LICENSE-2.0) // // Alternatively, the contents of this file may be used under the terms of // the Boost Software License, Version 1.0. // (See accompanying file LICENSE-Boost or copy at // https://www.boost.org/LICENSE_1_0.txt) // // Unless required by applicable law or agreed to in writing, this software // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. #ifndef RYU_D2S_FULL_TABLE_H #define RYU_D2S_FULL_TABLE_H // These tables are generated by PrintDoubleLookupTable. #define DOUBLE_POW5_INV_BITCOUNT 125 #define DOUBLE_POW5_BITCOUNT 125 #define DOUBLE_POW5_INV_TABLE_SIZE 342 #define DOUBLE_POW5_TABLE_SIZE 326 static const uint64_t DOUBLE_POW5_INV_SPLIT[DOUBLE_POW5_INV_TABLE_SIZE][2] = { { 1u, 2305843009213693952u }, { 11068046444225730970u, 1844674407370955161u }, { 5165088340638674453u, 1475739525896764129u }, { 7821419487252849886u, 1180591620717411303u }, { 8824922364862649494u, 1888946593147858085u }, { 7059937891890119595u, 1511157274518286468u }, { 13026647942995916322u, 1208925819614629174u }, { 9774590264567735146u, 1934281311383406679u }, { 11509021026396098440u, 1547425049106725343u }, { 16585914450600699399u, 1237940039285380274u }, { 15469416676735388068u, 1980704062856608439u }, { 16064882156130220778u, 1584563250285286751u }, { 9162556910162266299u, 1267650600228229401u }, { 7281393426775805432u, 2028240960365167042u }, { 16893161185646375315u, 1622592768292133633u }, { 2446482504291369283u, 1298074214633706907u }, { 7603720821608101175u, 2076918743413931051u }, { 2393627842544570617u, 1661534994731144841u }, { 16672297533003297786u, 1329227995784915872u }, { 11918280793837635165u, 2126764793255865396u }, { 5845275820328197809u, 1701411834604692317u }, { 15744267100488289217u, 1361129467683753853u }, { 3054734472329800808u, 2177807148294006166u }, { 17201182836831481939u, 1742245718635204932u }, { 6382248639981364905u, 1393796574908163946u }, { 2832900194486363201u, 2230074519853062314u }, { 5955668970331000884u, 1784059615882449851u }, { 1075186361522890384u, 1427247692705959881u }, { 12788344622662355584u, 2283596308329535809u }, { 13920024512871794791u, 1826877046663628647u }, { 3757321980813615186u, 1461501637330902918u }, { 10384555214134712795u, 1169201309864722334u }, { 5547241898389809503u, 1870722095783555735u }, { 4437793518711847602u, 1496577676626844588u }, { 10928932444453298728u, 1197262141301475670u }, { 17486291911125277965u, 1915619426082361072u }, { 6610335899416401726u, 1532495540865888858u }, { 12666966349016942027u, 1225996432692711086u }, { 12888448528943286597u, 1961594292308337738u }, { 17689456452638449924u, 1569275433846670190u }, { 14151565162110759939u, 1255420347077336152u }, { 7885109000409574610u, 2008672555323737844u }, { 9997436015069570011u, 1606938044258990275u }, { 7997948812055656009u, 1285550435407192220u }, { 12796718099289049614u, 2056880696651507552u }, { 2858676849947419045u, 1645504557321206042u }, { 13354987924183666206u, 1316403645856964833u }, { 17678631863951955605u, 2106245833371143733u }, { 3074859046935833515u, 1684996666696914987u }, { 13527933681774397782u, 1347997333357531989u }, { 10576647446613305481u, 2156795733372051183u }, { 15840015586774465031u, 1725436586697640946u }, { 8982663654677661702u, 1380349269358112757u }, { 18061610662226169046u, 2208558830972980411u }, { 10759939715039024913u, 1766847064778384329u }, { 12297300586773130254u, 1413477651822707463u }, { 15986332124095098083u, 2261564242916331941u }, { 9099716884534168143u, 1809251394333065553u }, { 14658471137111155161u, 1447401115466452442u }, { 4348079280205103483u, 1157920892373161954u }, { 14335624477811986218u, 1852673427797059126u }, { 7779150767507678651u, 1482138742237647301u }, { 2533971799264232598u, 1185710993790117841u }, { 15122401323048503126u, 1897137590064188545u }, { 12097921058438802501u, 1517710072051350836u }, { 5988988032009131678u, 1214168057641080669u }, { 16961078480698431330u, 1942668892225729070u }, { 13568862784558745064u, 1554135113780583256u }, { 7165741412905085728u, 1243308091024466605u }, { 11465186260648137165u, 1989292945639146568u }, { 16550846638002330379u, 1591434356511317254u }, { 16930026125143774626u, 1273147485209053803u }, { 4951948911778577463u, 2037035976334486086u }, { 272210314680951647u, 1629628781067588869u }, { 3907117066486671641u, 1303703024854071095u }, { 6251387306378674625u, 2085924839766513752u }, { 16069156289328670670u, 1668739871813211001u }, { 9165976216721026213u, 1334991897450568801u }, { 7286864317269821294u, 2135987035920910082u }, { 16897537898041588005u, 1708789628736728065u }, { 13518030318433270404u, 1367031702989382452u }, { 6871453250525591353u, 2187250724783011924u }, { 9186511415162383406u, 1749800579826409539u }, { 11038557946871817048u, 1399840463861127631u }, { 10282995085511086630u, 2239744742177804210u }, { 8226396068408869304u, 1791795793742243368u }, { 13959814484210916090u, 1433436634993794694u }, { 11267656730511734774u, 2293498615990071511u }, { 5324776569667477496u, 1834798892792057209u }, { 7949170070475892320u, 1467839114233645767u }, { 17427382500606444826u, 1174271291386916613u }, { 5747719112518849781u, 1878834066219066582u }, { 15666221734240810795u, 1503067252975253265u }, { 12532977387392648636u, 1202453802380202612u }, { 5295368560860596524u, 1923926083808324180u }, { 4236294848688477220u, 1539140867046659344u }, { 7078384693692692099u, 1231312693637327475u }, { 11325415509908307358u, 1970100309819723960u }, { 9060332407926645887u, 1576080247855779168u }, { 14626963555825137356u, 1260864198284623334u }, { 12335095245094488799u, 2017382717255397335u }, { 9868076196075591040u, 1613906173804317868u }, { 15273158586344293478u, 1291124939043454294u }, { 13369007293925138595u, 2065799902469526871u }, { 7005857020398200553u, 1652639921975621497u }, { 16672732060544291412u, 1322111937580497197u }, { 11918976037903224966u, 2115379100128795516u }, { 5845832015580669650u, 1692303280103036413u }, { 12055363241948356366u, 1353842624082429130u }, { 841837113407818570u, 2166148198531886609u }, { 4362818505468165179u, 1732918558825509287u }, { 14558301248600263113u, 1386334847060407429u }, { 12225235553534690011u, 2218135755296651887u }, { 2401490813343931363u, 1774508604237321510u }, { 1921192650675145090u, 1419606883389857208u }, { 17831303500047873437u, 2271371013423771532u }, { 6886345170554478103u, 1817096810739017226u }, { 1819727321701672159u, 1453677448591213781u }, { 16213177116328979020u, 1162941958872971024u }, { 14873036941900635463u, 1860707134196753639u }, { 15587778368262418694u, 1488565707357402911u }, { 8780873879868024632u, 1190852565885922329u }, { 2981351763563108441u, 1905364105417475727u }, { 13453127855076217722u, 1524291284333980581u }, { 7073153469319063855u, 1219433027467184465u }, { 11317045550910502167u, 1951092843947495144u }, { 12742985255470312057u, 1560874275157996115u }, { 10194388204376249646u, 1248699420126396892u }, { 1553625868034358140u, 1997919072202235028u }, { 8621598323911307159u, 1598335257761788022u }, { 17965325103354776697u, 1278668206209430417u }, { 13987124906400001422u, 2045869129935088668u }, { 121653480894270168u, 1636695303948070935u }, { 97322784715416134u, 1309356243158456748u }, { 14913111714512307107u, 2094969989053530796u }, { 8241140556867935363u, 1675975991242824637u }, { 17660958889720079260u, 1340780792994259709u }, { 17189487779326395846u, 2145249268790815535u }, { 13751590223461116677u, 1716199415032652428u }, { 18379969808252713988u, 1372959532026121942u }, { 14650556434236701088u, 2196735251241795108u }, { 652398703163629901u, 1757388200993436087u }, { 11589965406756634890u, 1405910560794748869u }, { 7475898206584884855u, 2249456897271598191u }, { 2291369750525997561u, 1799565517817278553u }, { 9211793429904618695u, 1439652414253822842u }, { 18428218302589300235u, 2303443862806116547u }, { 7363877012587619542u, 1842755090244893238u }, { 13269799239553916280u, 1474204072195914590u }, { 10615839391643133024u, 1179363257756731672u }, { 2227947767661371545u, 1886981212410770676u }, { 16539753473096738529u, 1509584969928616540u }, { 13231802778477390823u, 1207667975942893232u }, { 6413489186596184024u, 1932268761508629172u }, { 16198837793502678189u, 1545815009206903337u }, { 5580372605318321905u, 1236652007365522670u }, { 8928596168509315048u, 1978643211784836272u }, { 18210923379033183008u, 1582914569427869017u }, { 7190041073742725760u, 1266331655542295214u }, { 436019273762630246u, 2026130648867672343u }, { 7727513048493924843u, 1620904519094137874u }, { 9871359253537050198u, 1296723615275310299u }, { 4726128361433549347u, 2074757784440496479u }, { 7470251503888749801u, 1659806227552397183u }, { 13354898832594820487u, 1327844982041917746u }, { 13989140502667892133u, 2124551971267068394u }, { 14880661216876224029u, 1699641577013654715u }, { 11904528973500979224u, 1359713261610923772u }, { 4289851098633925465u, 2175541218577478036u }, { 18189276137874781665u, 1740432974861982428u }, { 3483374466074094362u, 1392346379889585943u }, { 1884050330976640656u, 2227754207823337509u }, { 5196589079523222848u, 1782203366258670007u }, { 15225317707844309248u, 1425762693006936005u }, { 5913764258841343181u, 2281220308811097609u }, { 8420360221814984868u, 1824976247048878087u }, { 17804334621677718864u, 1459980997639102469u }, { 17932816512084085415u, 1167984798111281975u }, { 10245762345624985047u, 1868775676978051161u }, { 4507261061758077715u, 1495020541582440929u }, { 7295157664148372495u, 1196016433265952743u }, { 7982903447895485668u, 1913626293225524389u }, { 10075671573058298858u, 1530901034580419511u }, { 4371188443704728763u, 1224720827664335609u }, { 14372599139411386667u, 1959553324262936974u }, { 15187428126271019657u, 1567642659410349579u }, { 15839291315758726049u, 1254114127528279663u }, { 3206773216762499739u, 2006582604045247462u }, { 13633465017635730761u, 1605266083236197969u }, { 14596120828850494932u, 1284212866588958375u }, { 4907049252451240275u, 2054740586542333401u }, { 236290587219081897u, 1643792469233866721u }, { 14946427728742906810u, 1315033975387093376u }, { 16535586736504830250u, 2104054360619349402u }, { 5849771759720043554u, 1683243488495479522u }, { 15747863852001765813u, 1346594790796383617u }, { 10439186904235184007u, 2154551665274213788u }, { 15730047152871967852u, 1723641332219371030u }, { 12584037722297574282u, 1378913065775496824u }, { 9066413911450387881u, 2206260905240794919u }, { 10942479943902220628u, 1765008724192635935u }, { 8753983955121776503u, 1412006979354108748u }, { 10317025513452932081u, 2259211166966573997u }, { 874922781278525018u, 1807368933573259198u }, { 8078635854506640661u, 1445895146858607358u }, { 13841606313089133175u, 1156716117486885886u }, { 14767872471458792434u, 1850745787979017418u }, { 746251532941302978u, 1480596630383213935u }, { 597001226353042382u, 1184477304306571148u }, { 15712597221132509104u, 1895163686890513836u }, { 8880728962164096960u, 1516130949512411069u }, { 10793931984473187891u, 1212904759609928855u }, { 17270291175157100626u, 1940647615375886168u }, { 2748186495899949531u, 1552518092300708935u }, { 2198549196719959625u, 1242014473840567148u }, { 18275073973719576693u, 1987223158144907436u }, { 10930710364233751031u, 1589778526515925949u }, { 12433917106128911148u, 1271822821212740759u }, { 8826220925580526867u, 2034916513940385215u }, { 7060976740464421494u, 1627933211152308172u }, { 16716827836597268165u, 1302346568921846537u }, { 11989529279587987770u, 2083754510274954460u }, { 9591623423670390216u, 1667003608219963568u }, { 15051996368420132820u, 1333602886575970854u }, { 13015147745246481542u, 2133764618521553367u }, { 3033420566713364587u, 1707011694817242694u }, { 6116085268112601993u, 1365609355853794155u }, { 9785736428980163188u, 2184974969366070648u }, { 15207286772667951197u, 1747979975492856518u }, { 1097782973908629988u, 1398383980394285215u }, { 1756452758253807981u, 2237414368630856344u }, { 5094511021344956708u, 1789931494904685075u }, { 4075608817075965366u, 1431945195923748060u }, { 6520974107321544586u, 2291112313477996896u }, { 1527430471115325346u, 1832889850782397517u }, { 12289990821117991246u, 1466311880625918013u }, { 17210690286378213644u, 1173049504500734410u }, { 9090360384495590213u, 1876879207201175057u }, { 18340334751822203140u, 1501503365760940045u }, { 14672267801457762512u, 1201202692608752036u }, { 16096930852848599373u, 1921924308174003258u }, { 1809498238053148529u, 1537539446539202607u }, { 12515645034668249793u, 1230031557231362085u }, { 1578287981759648052u, 1968050491570179337u }, { 12330676829633449412u, 1574440393256143469u }, { 13553890278448669853u, 1259552314604914775u }, { 3239480371808320148u, 2015283703367863641u }, { 17348979556414297411u, 1612226962694290912u }, { 6500486015647617283u, 1289781570155432730u }, { 10400777625036187652u, 2063650512248692368u }, { 15699319729512770768u, 1650920409798953894u }, { 16248804598352126938u, 1320736327839163115u }, { 7551343283653851484u, 2113178124542660985u }, { 6041074626923081187u, 1690542499634128788u }, { 12211557331022285596u, 1352433999707303030u }, { 1091747655926105338u, 2163894399531684849u }, { 4562746939482794594u, 1731115519625347879u }, { 7339546366328145998u, 1384892415700278303u }, { 8053925371383123274u, 2215827865120445285u }, { 6443140297106498619u, 1772662292096356228u }, { 12533209867169019542u, 1418129833677084982u }, { 5295740528502789974u, 2269007733883335972u }, { 15304638867027962949u, 1815206187106668777u }, { 4865013464138549713u, 1452164949685335022u }, { 14960057215536570740u, 1161731959748268017u }, { 9178696285890871890u, 1858771135597228828u }, { 14721654658196518159u, 1487016908477783062u }, { 4398626097073393881u, 1189613526782226450u }, { 7037801755317430209u, 1903381642851562320u }, { 5630241404253944167u, 1522705314281249856u }, { 814844308661245011u, 1218164251424999885u }, { 1303750893857992017u, 1949062802279999816u }, { 15800395974054034906u, 1559250241823999852u }, { 5261619149759407279u, 1247400193459199882u }, { 12107939454356961969u, 1995840309534719811u }, { 5997002748743659252u, 1596672247627775849u }, { 8486951013736837725u, 1277337798102220679u }, { 2511075177753209390u, 2043740476963553087u }, { 13076906586428298482u, 1634992381570842469u }, { 14150874083884549109u, 1307993905256673975u }, { 4194654460505726958u, 2092790248410678361u }, { 18113118827372222859u, 1674232198728542688u }, { 3422448617672047318u, 1339385758982834151u }, { 16543964232501006678u, 2143017214372534641u }, { 9545822571258895019u, 1714413771498027713u }, { 15015355686490936662u, 1371531017198422170u }, { 5577825024675947042u, 2194449627517475473u }, { 11840957649224578280u, 1755559702013980378u }, { 16851463748863483271u, 1404447761611184302u }, { 12204946739213931940u, 2247116418577894884u }, { 13453306206113055875u, 1797693134862315907u }, { 3383947335406624054u, 1438154507889852726u }, { 16482362180876329456u, 2301047212623764361u }, { 9496540929959153242u, 1840837770099011489u }, { 11286581558709232917u, 1472670216079209191u }, { 5339916432225476010u, 1178136172863367353u }, { 4854517476818851293u, 1885017876581387765u }, { 3883613981455081034u, 1508014301265110212u }, { 14174937629389795797u, 1206411441012088169u }, { 11611853762797942306u, 1930258305619341071u }, { 5600134195496443521u, 1544206644495472857u }, { 15548153800622885787u, 1235365315596378285u }, { 6430302007287065643u, 1976584504954205257u }, { 16212288050055383484u, 1581267603963364205u }, { 12969830440044306787u, 1265014083170691364u }, { 9683682259845159889u, 2024022533073106183u }, { 15125643437359948558u, 1619218026458484946u }, { 8411165935146048523u, 1295374421166787957u }, { 17147214310975587960u, 2072599073866860731u }, { 10028422634038560045u, 1658079259093488585u }, { 8022738107230848036u, 1326463407274790868u }, { 9147032156827446534u, 2122341451639665389u }, { 11006974540203867551u, 1697873161311732311u }, { 5116230817421183718u, 1358298529049385849u }, { 15564666937357714594u, 2173277646479017358u }, { 1383687105660440706u, 1738622117183213887u }, { 12174996128754083534u, 1390897693746571109u }, { 8411947361780802685u, 2225436309994513775u }, { 6729557889424642148u, 1780349047995611020u }, { 5383646311539713719u, 1424279238396488816u }, { 1235136468979721303u, 2278846781434382106u }, { 15745504434151418335u, 1823077425147505684u }, { 16285752362063044992u, 1458461940118004547u }, { 5649904260166615347u, 1166769552094403638u }, { 5350498001524674232u, 1866831283351045821u }, { 591049586477829062u, 1493465026680836657u }, { 11540886113407994219u, 1194772021344669325u }, { 18673707743239135u, 1911635234151470921u }, { 14772334225162232601u, 1529308187321176736u }, { 8128518565387875758u, 1223446549856941389u }, { 1937583260394870242u, 1957514479771106223u }, { 8928764237799716840u, 1566011583816884978u }, { 14521709019723594119u, 1252809267053507982u }, { 8477339172590109297u, 2004494827285612772u }, { 17849917782297818407u, 1603595861828490217u }, { 6901236596354434079u, 1282876689462792174u }, { 18420676183650915173u, 2052602703140467478u }, { 3668494502695001169u, 1642082162512373983u }, { 10313493231639821582u, 1313665730009899186u }, { 9122891541139893884u, 2101865168015838698u }, { 14677010862395735754u, 1681492134412670958u }, { 673562245690857633u, 1345193707530136767u } }; static const uint64_t DOUBLE_POW5_SPLIT[DOUBLE_POW5_TABLE_SIZE][2] = { { 0u, 1152921504606846976u }, { 0u, 1441151880758558720u }, { 0u, 1801439850948198400u }, { 0u, 2251799813685248000u }, { 0u, 1407374883553280000u }, { 0u, 1759218604441600000u }, { 0u, 2199023255552000000u }, { 0u, 1374389534720000000u }, { 0u, 1717986918400000000u }, { 0u, 2147483648000000000u }, { 0u, 1342177280000000000u }, { 0u, 1677721600000000000u }, { 0u, 2097152000000000000u }, { 0u, 1310720000000000000u }, { 0u, 1638400000000000000u }, { 0u, 2048000000000000000u }, { 0u, 1280000000000000000u }, { 0u, 1600000000000000000u }, { 0u, 2000000000000000000u }, { 0u, 1250000000000000000u }, { 0u, 1562500000000000000u }, { 0u, 1953125000000000000u }, { 0u, 1220703125000000000u }, { 0u, 1525878906250000000u }, { 0u, 1907348632812500000u }, { 0u, 1192092895507812500u }, { 0u, 1490116119384765625u }, { 4611686018427387904u, 1862645149230957031u }, { 9799832789158199296u, 1164153218269348144u }, { 12249790986447749120u, 1455191522836685180u }, { 15312238733059686400u, 1818989403545856475u }, { 14528612397897220096u, 2273736754432320594u }, { 13692068767113150464u, 1421085471520200371u }, { 12503399940464050176u, 1776356839400250464u }, { 15629249925580062720u, 2220446049250313080u }, { 9768281203487539200u, 1387778780781445675u }, { 7598665485932036096u, 1734723475976807094u }, { 274959820560269312u, 2168404344971008868u }, { 9395221924704944128u, 1355252715606880542u }, { 2520655369026404352u, 1694065894508600678u }, { 12374191248137781248u, 2117582368135750847u }, { 14651398557727195136u, 1323488980084844279u }, { 13702562178731606016u, 1654361225106055349u }, { 3293144668132343808u, 2067951531382569187u }, { 18199116482078572544u, 1292469707114105741u }, { 8913837547316051968u, 1615587133892632177u }, { 15753982952572452864u, 2019483917365790221u }, { 12152082354571476992u, 1262177448353618888u }, { 15190102943214346240u, 1577721810442023610u }, { 9764256642163156992u, 1972152263052529513u }, { 17631875447420442880u, 1232595164407830945u }, { 8204786253993389888u, 1540743955509788682u }, { 1032610780636961552u, 1925929944387235853u }, { 2951224747111794922u, 1203706215242022408u }, { 3689030933889743652u, 1504632769052528010u }, { 13834660704216955373u, 1880790961315660012u }, { 17870034976990372916u, 1175494350822287507u }, { 17725857702810578241u, 1469367938527859384u }, { 3710578054803671186u, 1836709923159824231u }, { 26536550077201078u, 2295887403949780289u }, { 11545800389866720434u, 1434929627468612680u }, { 14432250487333400542u, 1793662034335765850u }, { 8816941072311974870u, 2242077542919707313u }, { 17039803216263454053u, 1401298464324817070u }, { 12076381983474541759u, 1751623080406021338u }, { 5872105442488401391u, 2189528850507526673u }, { 15199280947623720629u, 1368455531567204170u }, { 9775729147674874978u, 1710569414459005213u }, { 16831347453020981627u, 2138211768073756516u }, { 1296220121283337709u, 1336382355046097823u }, { 15455333206886335848u, 1670477943807622278u }, { 10095794471753144002u, 2088097429759527848u }, { 6309871544845715001u, 1305060893599704905u }, { 12499025449484531656u, 1631326116999631131u }, { 11012095793428276666u, 2039157646249538914u }, { 11494245889320060820u, 1274473528905961821u }, { 532749306367912313u, 1593091911132452277u }, { 5277622651387278295u, 1991364888915565346u }, { 7910200175544436838u, 1244603055572228341u }, { 14499436237857933952u, 1555753819465285426u }, { 8900923260467641632u, 1944692274331606783u }, { 12480606065433357876u, 1215432671457254239u }, { 10989071563364309441u, 1519290839321567799u }, { 9124653435777998898u, 1899113549151959749u }, { 8008751406574943263u, 1186945968219974843u }, { 5399253239791291175u, 1483682460274968554u }, { 15972438586593889776u, 1854603075343710692u }, { 759402079766405302u, 1159126922089819183u }, { 14784310654990170340u, 1448908652612273978u }, { 9257016281882937117u, 1811135815765342473u }, { 16182956370781059300u, 2263919769706678091u }, { 7808504722524468110u, 1414949856066673807u }, { 5148944884728197234u, 1768687320083342259u }, { 1824495087482858639u, 2210859150104177824u }, { 1140309429676786649u, 1381786968815111140u }, { 1425386787095983311u, 1727233711018888925u }, { 6393419502297367043u, 2159042138773611156u }, { 13219259225790630210u, 1349401336733506972u }, { 16524074032238287762u, 1686751670916883715u }, { 16043406521870471799u, 2108439588646104644u }, { 803757039314269066u, 1317774742903815403u }, { 14839754354425000045u, 1647218428629769253u }, { 4714634887749086344u, 2059023035787211567u }, { 9864175832484260821u, 1286889397367007229u }, { 16941905809032713930u, 1608611746708759036u }, { 2730638187581340797u, 2010764683385948796u }, { 10930020904093113806u, 1256727927116217997u }, { 18274212148543780162u, 1570909908895272496u }, { 4396021111970173586u, 1963637386119090621u }, { 5053356204195052443u, 1227273366324431638u }, { 15540067292098591362u, 1534091707905539547u }, { 14813398096695851299u, 1917614634881924434u }, { 13870059828862294966u, 1198509146801202771u }, { 12725888767650480803u, 1498136433501503464u }, { 15907360959563101004u, 1872670541876879330u }, { 14553786618154326031u, 1170419088673049581u }, { 4357175217410743827u, 1463023860841311977u }, { 10058155040190817688u, 1828779826051639971u }, { 7961007781811134206u, 2285974782564549964u }, { 14199001900486734687u, 1428734239102843727u }, { 13137066357181030455u, 1785917798878554659u }, { 11809646928048900164u, 2232397248598193324u }, { 16604401366885338411u, 1395248280373870827u }, { 16143815690179285109u, 1744060350467338534u }, { 10956397575869330579u, 2180075438084173168u }, { 6847748484918331612u, 1362547148802608230u }, { 17783057643002690323u, 1703183936003260287u }, { 17617136035325974999u, 2128979920004075359u }, { 17928239049719816230u, 1330612450002547099u }, { 17798612793722382384u, 1663265562503183874u }, { 13024893955298202172u, 2079081953128979843u }, { 5834715712847682405u, 1299426220705612402u }, { 16516766677914378815u, 1624282775882015502u }, { 11422586310538197711u, 2030353469852519378u }, { 11750802462513761473u, 1268970918657824611u }, { 10076817059714813937u, 1586213648322280764u }, { 12596021324643517422u, 1982767060402850955u }, { 5566670318688504437u, 1239229412751781847u }, { 2346651879933242642u, 1549036765939727309u }, { 7545000868343941206u, 1936295957424659136u }, { 4715625542714963254u, 1210184973390411960u }, { 5894531928393704067u, 1512731216738014950u }, { 16591536947346905892u, 1890914020922518687u }, { 17287239619732898039u, 1181821263076574179u }, { 16997363506238734644u, 1477276578845717724u }, { 2799960309088866689u, 1846595723557147156u }, { 10973347230035317489u, 1154122327223216972u }, { 13716684037544146861u, 1442652909029021215u }, { 12534169028502795672u, 1803316136286276519u }, { 11056025267201106687u, 2254145170357845649u }, { 18439230838069161439u, 1408840731473653530u }, { 13825666510731675991u, 1761050914342066913u }, { 3447025083132431277u, 2201313642927583642u }, { 6766076695385157452u, 1375821026829739776u }, { 8457595869231446815u, 1719776283537174720u }, { 10571994836539308519u, 2149720354421468400u }, { 6607496772837067824u, 1343575221513417750u }, { 17482743002901110588u, 1679469026891772187u }, { 17241742735199000331u, 2099336283614715234u }, { 15387775227926763111u, 1312085177259197021u }, { 5399660979626290177u, 1640106471573996277u }, { 11361262242960250625u, 2050133089467495346u }, { 11712474920277544544u, 1281333180917184591u }, { 10028907631919542777u, 1601666476146480739u }, { 7924448521472040567u, 2002083095183100924u }, { 14176152362774801162u, 1251301934489438077u }, { 3885132398186337741u, 1564127418111797597u }, { 9468101516160310080u, 1955159272639746996u }, { 15140935484454969608u, 1221974545399841872u }, { 479425281859160394u, 1527468181749802341u }, { 5210967620751338397u, 1909335227187252926u }, { 17091912818251750210u, 1193334516992033078u }, { 12141518985959911954u, 1491668146240041348u }, { 15176898732449889943u, 1864585182800051685u }, { 11791404716994875166u, 1165365739250032303u }, { 10127569877816206054u, 1456707174062540379u }, { 8047776328842869663u, 1820883967578175474u }, { 836348374198811271u, 2276104959472719343u }, { 7440246761515338900u, 1422565599670449589u }, { 13911994470321561530u, 1778206999588061986u }, { 8166621051047176104u, 2222758749485077483u }, { 2798295147690791113u, 1389224218428173427u }, { 17332926989895652603u, 1736530273035216783u }, { 17054472718942177850u, 2170662841294020979u }, { 8353202440125167204u, 1356664275808763112u }, { 10441503050156459005u, 1695830344760953890u }, { 3828506775840797949u, 2119787930951192363u }, { 86973725686804766u, 1324867456844495227u }, { 13943775212390669669u, 1656084321055619033u }, { 3594660960206173375u, 2070105401319523792u }, { 2246663100128858359u, 1293815875824702370u }, { 12031700912015848757u, 1617269844780877962u }, { 5816254103165035138u, 2021587305976097453u }, { 5941001823691840913u, 1263492066235060908u }, { 7426252279614801142u, 1579365082793826135u }, { 4671129331091113523u, 1974206353492282669u }, { 5225298841145639904u, 1233878970932676668u }, { 6531623551432049880u, 1542348713665845835u }, { 3552843420862674446u, 1927935892082307294u }, { 16055585193321335241u, 1204959932551442058u }, { 10846109454796893243u, 1506199915689302573u }, { 18169322836923504458u, 1882749894611628216u }, { 11355826773077190286u, 1176718684132267635u }, { 9583097447919099954u, 1470898355165334544u }, { 11978871809898874942u, 1838622943956668180u }, { 14973589762373593678u, 2298278679945835225u }, { 2440964573842414192u, 1436424174966147016u }, { 3051205717303017741u, 1795530218707683770u }, { 13037379183483547984u, 2244412773384604712u }, { 8148361989677217490u, 1402757983365377945u }, { 14797138505523909766u, 1753447479206722431u }, { 13884737113477499304u, 2191809349008403039u }, { 15595489723564518921u, 1369880843130251899u }, { 14882676136028260747u, 1712351053912814874u }, { 9379973133180550126u, 2140438817391018593u }, { 17391698254306313589u, 1337774260869386620u }, { 3292878744173340370u, 1672217826086733276u }, { 4116098430216675462u, 2090272282608416595u }, { 266718509671728212u, 1306420176630260372u }, { 333398137089660265u, 1633025220787825465u }, { 5028433689789463235u, 2041281525984781831u }, { 10060300083759496378u, 1275800953740488644u }, { 12575375104699370472u, 1594751192175610805u }, { 1884160825592049379u, 1993438990219513507u }, { 17318501580490888525u, 1245899368887195941u }, { 7813068920331446945u, 1557374211108994927u }, { 5154650131986920777u, 1946717763886243659u }, { 915813323278131534u, 1216698602428902287u }, { 14979824709379828129u, 1520873253036127858u }, { 9501408849870009354u, 1901091566295159823u }, { 12855909558809837702u, 1188182228934474889u }, { 2234828893230133415u, 1485227786168093612u }, { 2793536116537666769u, 1856534732710117015u }, { 8663489100477123587u, 1160334207943823134u }, { 1605989338741628675u, 1450417759929778918u }, { 11230858710281811652u, 1813022199912223647u }, { 9426887369424876662u, 2266277749890279559u }, { 12809333633531629769u, 1416423593681424724u }, { 16011667041914537212u, 1770529492101780905u }, { 6179525747111007803u, 2213161865127226132u }, { 13085575628799155685u, 1383226165704516332u }, { 16356969535998944606u, 1729032707130645415u }, { 15834525901571292854u, 2161290883913306769u }, { 2979049660840976177u, 1350806802445816731u }, { 17558870131333383934u, 1688508503057270913u }, { 8113529608884566205u, 2110635628821588642u }, { 9682642023980241782u, 1319147268013492901u }, { 16714988548402690132u, 1648934085016866126u }, { 11670363648648586857u, 2061167606271082658u }, { 11905663298832754689u, 1288229753919426661u }, { 1047021068258779650u, 1610287192399283327u }, { 15143834390605638274u, 2012858990499104158u }, { 4853210475701136017u, 1258036869061940099u }, { 1454827076199032118u, 1572546086327425124u }, { 1818533845248790147u, 1965682607909281405u }, { 3442426662494187794u, 1228551629943300878u }, { 13526405364972510550u, 1535689537429126097u }, { 3072948650933474476u, 1919611921786407622u }, { 15755650962115585259u, 1199757451116504763u }, { 15082877684217093670u, 1499696813895630954u }, { 9630225068416591280u, 1874621017369538693u }, { 8324733676974063502u, 1171638135855961683u }, { 5794231077790191473u, 1464547669819952104u }, { 7242788847237739342u, 1830684587274940130u }, { 18276858095901949986u, 2288355734093675162u }, { 16034722328366106645u, 1430222333808546976u }, { 1596658836748081690u, 1787777917260683721u }, { 6607509564362490017u, 2234722396575854651u }, { 1823850468512862308u, 1396701497859909157u }, { 6891499104068465790u, 1745876872324886446u }, { 17837745916940358045u, 2182346090406108057u }, { 4231062170446641922u, 1363966306503817536u }, { 5288827713058302403u, 1704957883129771920u }, { 6611034641322878003u, 2131197353912214900u }, { 13355268687681574560u, 1331998346195134312u }, { 16694085859601968200u, 1664997932743917890u }, { 11644235287647684442u, 2081247415929897363u }, { 4971804045566108824u, 1300779634956185852u }, { 6214755056957636030u, 1625974543695232315u }, { 3156757802769657134u, 2032468179619040394u }, { 6584659645158423613u, 1270292612261900246u }, { 17454196593302805324u, 1587865765327375307u }, { 17206059723201118751u, 1984832206659219134u }, { 6142101308573311315u, 1240520129162011959u }, { 3065940617289251240u, 1550650161452514949u }, { 8444111790038951954u, 1938312701815643686u }, { 665883850346957067u, 1211445438634777304u }, { 832354812933696334u, 1514306798293471630u }, { 10263815553021896226u, 1892883497866839537u }, { 17944099766707154901u, 1183052186166774710u }, { 13206752671529167818u, 1478815232708468388u }, { 16508440839411459773u, 1848519040885585485u }, { 12623618533845856310u, 1155324400553490928u }, { 15779523167307320387u, 1444155500691863660u }, { 1277659885424598868u, 1805194375864829576u }, { 1597074856780748586u, 2256492969831036970u }, { 5609857803915355770u, 1410308106144398106u }, { 16235694291748970521u, 1762885132680497632u }, { 1847873790976661535u, 2203606415850622041u }, { 12684136165428883219u, 1377254009906638775u }, { 11243484188358716120u, 1721567512383298469u }, { 219297180166231438u, 2151959390479123087u }, { 7054589765244976505u, 1344974619049451929u }, { 13429923224983608535u, 1681218273811814911u }, { 12175718012802122765u, 2101522842264768639u }, { 14527352785642408584u, 1313451776415480399u }, { 13547504963625622826u, 1641814720519350499u }, { 12322695186104640628u, 2052268400649188124u }, { 16925056528170176201u, 1282667750405742577u }, { 7321262604930556539u, 1603334688007178222u }, { 18374950293017971482u, 2004168360008972777u }, { 4566814905495150320u, 1252605225005607986u }, { 14931890668723713708u, 1565756531257009982u }, { 9441491299049866327u, 1957195664071262478u }, { 1289246043478778550u, 1223247290044539049u }, { 6223243572775861092u, 1529059112555673811u }, { 3167368447542438461u, 1911323890694592264u }, { 1979605279714024038u, 1194577431684120165u }, { 7086192618069917952u, 1493221789605150206u }, { 18081112809442173248u, 1866527237006437757u }, { 13606538515115052232u, 1166579523129023598u }, { 7784801107039039482u, 1458224403911279498u }, { 507629346944023544u, 1822780504889099373u }, { 5246222702107417334u, 2278475631111374216u }, { 3278889188817135834u, 1424047269444608885u }, { 8710297504448807696u, 1780059086805761106u } }; #endif // RYU_D2S_FULL_TABLE_H
0
repos/ryu
repos/ryu/ryu/f2s_full_table.h
// Copyright 2018 Ulf Adams // // The contents of this file may be used under the terms of the Apache License, // Version 2.0. // // (See accompanying file LICENSE-Apache or copy at // http://www.apache.org/licenses/LICENSE-2.0) // // Alternatively, the contents of this file may be used under the terms of // the Boost Software License, Version 1.0. // (See accompanying file LICENSE-Boost or copy at // https://www.boost.org/LICENSE_1_0.txt) // // Unless required by applicable law or agreed to in writing, this software // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. #ifndef RYU_F2S_FULL_TABLE_H #define RYU_F2S_FULL_TABLE_H // This table is generated by PrintFloatLookupTable. #define FLOAT_POW5_INV_BITCOUNT 59 #define FLOAT_POW5_BITCOUNT 61 static uint64_t FLOAT_POW5_INV_SPLIT[55] = { 576460752303423489u, 461168601842738791u, 368934881474191033u, 295147905179352826u, 472236648286964522u, 377789318629571618u, 302231454903657294u, 483570327845851670u, 386856262276681336u, 309485009821345069u, 495176015714152110u, 396140812571321688u, 316912650057057351u, 507060240091291761u, 405648192073033409u, 324518553658426727u, 519229685853482763u, 415383748682786211u, 332306998946228969u, 531691198313966350u, 425352958651173080u, 340282366920938464u, 544451787073501542u, 435561429658801234u, 348449143727040987u, 557518629963265579u, 446014903970612463u, 356811923176489971u, 570899077082383953u, 456719261665907162u, 365375409332725730u, 292300327466180584u, 467680523945888934u, 374144419156711148u, 299315535325368918u, 478904856520590269u, 383123885216472215u, 306499108173177772u, 490398573077084435u, 392318858461667548u, 313855086769334039u, 502168138830934462u, 401734511064747569u, 321387608851798056u, 514220174162876889u, 411376139330301511u, 329100911464241209u, 526561458342785934u, 421249166674228747u, 336999333339382998u, 539198933343012796u, 431359146674410237u, 345087317339528190u, 552139707743245103u, 441711766194596083u }; static const uint64_t FLOAT_POW5_SPLIT[47] = { 1152921504606846976u, 1441151880758558720u, 1801439850948198400u, 2251799813685248000u, 1407374883553280000u, 1759218604441600000u, 2199023255552000000u, 1374389534720000000u, 1717986918400000000u, 2147483648000000000u, 1342177280000000000u, 1677721600000000000u, 2097152000000000000u, 1310720000000000000u, 1638400000000000000u, 2048000000000000000u, 1280000000000000000u, 1600000000000000000u, 2000000000000000000u, 1250000000000000000u, 1562500000000000000u, 1953125000000000000u, 1220703125000000000u, 1525878906250000000u, 1907348632812500000u, 1192092895507812500u, 1490116119384765625u, 1862645149230957031u, 1164153218269348144u, 1455191522836685180u, 1818989403545856475u, 2273736754432320594u, 1421085471520200371u, 1776356839400250464u, 2220446049250313080u, 1387778780781445675u, 1734723475976807094u, 2168404344971008868u, 1355252715606880542u, 1694065894508600678u, 2117582368135750847u, 1323488980084844279u, 1654361225106055349u, 2067951531382569187u, 1292469707114105741u, 1615587133892632177u, 2019483917365790221u }; #endif // RYU_F2S_FULL_TABLE_H
0
repos/ryu
repos/ryu/ryu/ryu_parse.h
// Copyright 2019 Ulf Adams // // The contents of this file may be used under the terms of the Apache License, // Version 2.0. // // (See accompanying file LICENSE-Apache or copy at // http://www.apache.org/licenses/LICENSE-2.0) // // Alternatively, the contents of this file may be used under the terms of // the Boost Software License, Version 1.0. // (See accompanying file LICENSE-Boost or copy at // https://www.boost.org/LICENSE_1_0.txt) // // Unless required by applicable law or agreed to in writing, this software // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. #ifndef RYU_PARSE_H #define RYU_PARSE_H #ifdef __cplusplus extern "C" { #endif // This is an experimental implementation of parsing strings to 64-bit floats // using a Ryu-like algorithm. At this time, it only support up to 17 non-zero // digits in the input, and also does not support all formats. Use at your own // risk. enum Status { SUCCESS, INPUT_TOO_SHORT, INPUT_TOO_LONG, MALFORMED_INPUT }; enum Status s2d_n(const char * buffer, const int len, double * result); enum Status s2d(const char * buffer, double * result); enum Status s2f_n(const char * buffer, const int len, float * result); enum Status s2f(const char * buffer, float * result); #ifdef __cplusplus } #endif #endif // RYU_PARSE_H
0
repos/ryu
repos/ryu/ryu/common.h
// Copyright 2018 Ulf Adams // // The contents of this file may be used under the terms of the Apache License, // Version 2.0. // // (See accompanying file LICENSE-Apache or copy at // http://www.apache.org/licenses/LICENSE-2.0) // // Alternatively, the contents of this file may be used under the terms of // the Boost Software License, Version 1.0. // (See accompanying file LICENSE-Boost or copy at // https://www.boost.org/LICENSE_1_0.txt) // // Unless required by applicable law or agreed to in writing, this software // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. #ifndef RYU_COMMON_H #define RYU_COMMON_H #include <assert.h> #include <stdint.h> #include <string.h> #if defined(_M_IX86) || defined(_M_ARM) #define RYU_32_BIT_PLATFORM #endif // Returns the number of decimal digits in v, which must not contain more than 9 digits. static inline uint32_t decimalLength9(const uint32_t v) { // Function precondition: v is not a 10-digit number. // (f2s: 9 digits are sufficient for round-tripping.) // (d2fixed: We print 9-digit blocks.) assert(v < 1000000000); if (v >= 100000000) { return 9; } if (v >= 10000000) { return 8; } if (v >= 1000000) { return 7; } if (v >= 100000) { return 6; } if (v >= 10000) { return 5; } if (v >= 1000) { return 4; } if (v >= 100) { return 3; } if (v >= 10) { return 2; } return 1; } // Returns e == 0 ? 1 : [log_2(5^e)]; requires 0 <= e <= 3528. static inline int32_t log2pow5(const int32_t e) { // This approximation works up to the point that the multiplication overflows at e = 3529. // If the multiplication were done in 64 bits, it would fail at 5^4004 which is just greater // than 2^9297. assert(e >= 0); assert(e <= 3528); return (int32_t) ((((uint32_t) e) * 1217359) >> 19); } // Returns e == 0 ? 1 : ceil(log_2(5^e)); requires 0 <= e <= 3528. static inline int32_t pow5bits(const int32_t e) { // This approximation works up to the point that the multiplication overflows at e = 3529. // If the multiplication were done in 64 bits, it would fail at 5^4004 which is just greater // than 2^9297. assert(e >= 0); assert(e <= 3528); return (int32_t) (((((uint32_t) e) * 1217359) >> 19) + 1); } // Returns e == 0 ? 1 : ceil(log_2(5^e)); requires 0 <= e <= 3528. static inline int32_t ceil_log2pow5(const int32_t e) { return log2pow5(e) + 1; } // Returns floor(log_10(2^e)); requires 0 <= e <= 1650. static inline uint32_t log10Pow2(const int32_t e) { // The first value this approximation fails for is 2^1651 which is just greater than 10^297. assert(e >= 0); assert(e <= 1650); return (((uint32_t) e) * 78913) >> 18; } // Returns floor(log_10(5^e)); requires 0 <= e <= 2620. static inline uint32_t log10Pow5(const int32_t e) { // The first value this approximation fails for is 5^2621 which is just greater than 10^1832. assert(e >= 0); assert(e <= 2620); return (((uint32_t) e) * 732923) >> 20; } static inline int copy_special_str(char * const result, const bool sign, const bool exponent, const bool mantissa) { if (mantissa) { memcpy(result, "NaN", 3); return 3; } if (sign) { result[0] = '-'; } if (exponent) { memcpy(result + sign, "Infinity", 8); return sign + 8; } memcpy(result + sign, "0E0", 3); return sign + 3; } static inline uint32_t float_to_bits(const float f) { uint32_t bits = 0; memcpy(&bits, &f, sizeof(float)); return bits; } static inline uint64_t double_to_bits(const double d) { uint64_t bits = 0; memcpy(&bits, &d, sizeof(double)); return bits; } #endif // RYU_COMMON_H
0
repos/ryu
repos/ryu/ryu/generic_128.h
// Copyright 2018 Ulf Adams // // The contents of this file may be used under the terms of the Apache License, // Version 2.0. // // (See accompanying file LICENSE-Apache or copy at // http://www.apache.org/licenses/LICENSE-2.0) // // Alternatively, the contents of this file may be used under the terms of // the Boost Software License, Version 1.0. // (See accompanying file LICENSE-Boost or copy at // https://www.boost.org/LICENSE_1_0.txt) // // Unless required by applicable law or agreed to in writing, this software // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. #ifndef RYU_GENERIC128_H #define RYU_GENERIC128_H #include <assert.h> #include <stdint.h> typedef __uint128_t uint128_t; #define FLOAT_128_POW5_INV_BITCOUNT 249 #define FLOAT_128_POW5_BITCOUNT 249 #define POW5_TABLE_SIZE 56 // These tables are ~4.5 kByte total, compared to ~160 kByte for the full tables. // There's no way to define 128-bit constants in C, so we use little-endian // pairs of 64-bit constants. static const uint64_t GENERIC_POW5_TABLE[POW5_TABLE_SIZE][2] = { { 1u, 0u }, { 5u, 0u }, { 25u, 0u }, { 125u, 0u }, { 625u, 0u }, { 3125u, 0u }, { 15625u, 0u }, { 78125u, 0u }, { 390625u, 0u }, { 1953125u, 0u }, { 9765625u, 0u }, { 48828125u, 0u }, { 244140625u, 0u }, { 1220703125u, 0u }, { 6103515625u, 0u }, { 30517578125u, 0u }, { 152587890625u, 0u }, { 762939453125u, 0u }, { 3814697265625u, 0u }, { 19073486328125u, 0u }, { 95367431640625u, 0u }, { 476837158203125u, 0u }, { 2384185791015625u, 0u }, { 11920928955078125u, 0u }, { 59604644775390625u, 0u }, { 298023223876953125u, 0u }, { 1490116119384765625u, 0u }, { 7450580596923828125u, 0u }, { 359414837200037393u, 2u }, { 1797074186000186965u, 10u }, { 8985370930000934825u, 50u }, { 8033366502585570893u, 252u }, { 3273344365508751233u, 1262u }, { 16366721827543756165u, 6310u }, { 8046632842880574361u, 31554u }, { 3339676066983768573u, 157772u }, { 16698380334918842865u, 788860u }, { 9704925379756007861u, 3944304u }, { 11631138751360936073u, 19721522u }, { 2815461535676025517u, 98607613u }, { 14077307678380127585u, 493038065u }, { 15046306170771983077u, 2465190328u }, { 1444554559021708921u, 12325951644u }, { 7222772795108544605u, 61629758220u }, { 17667119901833171409u, 308148791101u }, { 14548623214327650581u, 1540743955509u }, { 17402883850509598057u, 7703719777548u }, { 13227442957709783821u, 38518598887744u }, { 10796982567420264257u, 192592994438723u }, { 17091424689682218053u, 962964972193617u }, { 11670147153572883801u, 4814824860968089u }, { 3010503546735764157u, 24074124304840448u }, { 15052517733678820785u, 120370621524202240u }, { 1475612373555897461u, 601853107621011204u }, { 7378061867779487305u, 3009265538105056020u }, { 18443565265187884909u, 15046327690525280101u } }; static const uint64_t GENERIC_POW5_SPLIT[89][4] = { { 0u, 0u, 0u, 72057594037927936u }, { 0u, 5206161169240293376u, 4575641699882439235u, 73468396926392969u }, { 3360510775605221349u, 6983200512169538081u, 4325643253124434363u, 74906821675075173u }, { 11917660854915489451u, 9652941469841108803u, 946308467778435600u, 76373409087490117u }, { 1994853395185689235u, 16102657350889591545u, 6847013871814915412u, 77868710555449746u }, { 958415760277438274u, 15059347134713823592u, 7329070255463483331u, 79393288266368765u }, { 2065144883315240188u, 7145278325844925976u, 14718454754511147343u, 80947715414629833u }, { 8980391188862868935u, 13709057401304208685u, 8230434828742694591u, 82532576417087045u }, { 432148644612782575u, 7960151582448466064u, 12056089168559840552u, 84148467132788711u }, { 484109300864744403u, 15010663910730448582u, 16824949663447227068u, 85795995087002057u }, { 14793711725276144220u, 16494403799991899904u, 10145107106505865967u, 87475779699624060u }, { 15427548291869817042u, 12330588654550505203u, 13980791795114552342u, 89188452518064298u }, { 9979404135116626552u, 13477446383271537499u, 14459862802511591337u, 90934657454687378u }, { 12385121150303452775u, 9097130814231585614u, 6523855782339765207u, 92715051028904201u }, { 1822931022538209743u, 16062974719797586441u, 3619180286173516788u, 94530302614003091u }, { 12318611738248470829u, 13330752208259324507u, 10986694768744162601u, 96381094688813589u }, { 13684493829640282333u, 7674802078297225834u, 15208116197624593182u, 98268123094297527u }, { 5408877057066295332u, 6470124174091971006u, 15112713923117703147u, 100192097295163851u }, { 11407083166564425062u, 18189998238742408185u, 4337638702446708282u, 102153740646605557u }, { 4112405898036935485u, 924624216579956435u, 14251108172073737125u, 104153790666259019u }, { 16996739107011444789u, 10015944118339042475u, 2395188869672266257u, 106192999311487969u }, { 4588314690421337879u, 5339991768263654604u, 15441007590670620066u, 108272133262096356u }, { 2286159977890359825u, 14329706763185060248u, 5980012964059367667u, 110391974208576409u }, { 9654767503237031099u, 11293544302844823188u, 11739932712678287805u, 112553319146000238u }, { 11362964448496095896u, 7990659682315657680u, 251480263940996374u, 114756980673665505u }, { 1423410421096377129u, 14274395557581462179u, 16553482793602208894u, 117003787300607788u }, { 2070444190619093137u, 11517140404712147401u, 11657844572835578076u, 119294583757094535u }, { 7648316884775828921u, 15264332483297977688u, 247182277434709002u, 121630231312217685u }, { 17410896758132241352u, 10923914482914417070u, 13976383996795783649u, 124011608097704390u }, { 9542674537907272703u, 3079432708831728956u, 14235189590642919676u, 126439609438067572u }, { 10364666969937261816u, 8464573184892924210u, 12758646866025101190u, 128915148187220428u }, { 14720354822146013883u, 11480204489231511423u, 7449876034836187038u, 131439155071681461u }, { 1692907053653558553u, 17835392458598425233u, 1754856712536736598u, 134012579040499057u }, { 5620591334531458755u, 11361776175667106627u, 13350215315297937856u, 136636387622027174u }, { 17455759733928092601u, 10362573084069962561u, 11246018728801810510u, 139311567287686283u }, { 2465404073814044982u, 17694822665274381860u, 1509954037718722697u, 142039123822846312u }, { 2152236053329638369u, 11202280800589637091u, 16388426812920420176u, 72410041352485523u }, { 17319024055671609028u, 10944982848661280484u, 2457150158022562661u, 73827744744583080u }, { 17511219308535248024u, 5122059497846768077u, 2089605804219668451u, 75273205100637900u }, { 10082673333144031533u, 14429008783411894887u, 12842832230171903890u, 76746965869337783u }, { 16196653406315961184u, 10260180891682904501u, 10537411930446752461u, 78249581139456266u }, { 15084422041749743389u, 234835370106753111u, 16662517110286225617u, 79781615848172976u }, { 8199644021067702606u, 3787318116274991885u, 7438130039325743106u, 81343645993472659u }, { 12039493937039359765u, 9773822153580393709u, 5945428874398357806u, 82936258850702722u }, { 984543865091303961u, 7975107621689454830u, 6556665988501773347u, 84560053193370726u }, { 9633317878125234244u, 16099592426808915028u, 9706674539190598200u, 86215639518264828u }, { 6860695058870476186u, 4471839111886709592u, 7828342285492709568u, 87903640274981819u }, { 14583324717644598331u, 4496120889473451238u, 5290040788305728466u, 89624690099949049u }, { 18093669366515003715u, 12879506572606942994u, 18005739787089675377u, 91379436055028227u }, { 17997493966862379937u, 14646222655265145582u, 10265023312844161858u, 93168537870790806u }, { 12283848109039722318u, 11290258077250314935u, 9878160025624946825u, 94992668194556404u }, { 8087752761883078164u, 5262596608437575693u, 11093553063763274413u, 96852512843287537u }, { 15027787746776840781u, 12250273651168257752u, 9290470558712181914u, 98748771061435726u }, { 15003915578366724489u, 2937334162439764327u, 5404085603526796602u, 100682155783835929u }, { 5225610465224746757u, 14932114897406142027u, 2774647558180708010u, 102653393903748137u }, { 17112957703385190360u, 12069082008339002412u, 3901112447086388439u, 104663226546146909u }, { 4062324464323300238u, 3992768146772240329u, 15757196565593695724u, 106712409346361594u }, { 5525364615810306701u, 11855206026704935156u, 11344868740897365300u, 108801712734172003u }, { 9274143661888462646u, 4478365862348432381u, 18010077872551661771u, 110931922223466333u }, { 12604141221930060148u, 8930937759942591500u, 9382183116147201338u, 113103838707570263u }, { 14513929377491886653u, 1410646149696279084u, 587092196850797612u, 115318278760358235u }, { 2226851524999454362u, 7717102471110805679u, 7187441550995571734u, 117576074943260147u }, { 5527526061344932763u, 2347100676188369132u, 16976241418824030445u, 119878076118278875u }, { 6088479778147221611u, 17669593130014777580u, 10991124207197663546u, 122225147767136307u }, { 11107734086759692041u, 3391795220306863431u, 17233960908859089158u, 124618172316667879u }, { 7913172514655155198u, 17726879005381242552u, 641069866244011540u, 127058049470587962u }, { 12596991768458713949u, 15714785522479904446u, 6035972567136116512u, 129545696547750811u }, { 16901996933781815980u, 4275085211437148707u, 14091642539965169063u, 132082048827034281u }, { 7524574627987869240u, 15661204384239316051u, 2444526454225712267u, 134668059898975949u }, { 8199251625090479942u, 6803282222165044067u, 16064817666437851504u, 137304702024293857u }, { 4453256673338111920u, 15269922543084434181u, 3139961729834750852u, 139992966499426682u }, { 15841763546372731299u, 3013174075437671812u, 4383755396295695606u, 142733864029230733u }, { 9771896230907310329u, 4900659362437687569u, 12386126719044266361u, 72764212553486967u }, { 9420455527449565190u, 1859606122611023693u, 6555040298902684281u, 74188850200884818u }, { 5146105983135678095u, 2287300449992174951u, 4325371679080264751u, 75641380576797959u }, { 11019359372592553360u, 8422686425957443718u, 7175176077944048210u, 77122349788024458u }, { 11005742969399620716u, 4132174559240043701u, 9372258443096612118u, 78632314633490790u }, { 8887589641394725840u, 8029899502466543662u, 14582206497241572853u, 80171842813591127u }, { 360247523705545899u, 12568341805293354211u, 14653258284762517866u, 81741513143625247u }, { 12314272731984275834u, 4740745023227177044u, 6141631472368337539u, 83341915771415304u }, { 441052047733984759u, 7940090120939869826u, 11750200619921094248u, 84973652399183278u }, { 3436657868127012749u, 9187006432149937667u, 16389726097323041290u, 86637336509772529u }, { 13490220260784534044u, 15339072891382896702u, 8846102360835316895u, 88333593597298497u }, { 4125672032094859833u, 158347675704003277u, 10592598512749774447u, 90063061402315272u }, { 12189928252974395775u, 2386931199439295891u, 7009030566469913276u, 91826390151586454u }, { 9256479608339282969u, 2844900158963599229u, 11148388908923225596u, 93624242802550437u }, { 11584393507658707408u, 2863659090805147914u, 9873421561981063551u, 95457295292572042u }, { 13984297296943171390u, 1931468383973130608u, 12905719743235082319u, 97326236793074198u }, { 5837045222254987499u, 10213498696735864176u, 14893951506257020749u, 99231769968645227u } }; // Unfortunately, the results are sometimes off by one or two. We use an additional // lookup table to store those cases and adjust the result. static const uint64_t POW5_ERRORS[156] = { 0x0000000000000000u, 0x0000000000000000u, 0x0000000000000000u, 0x9555596400000000u, 0x65a6569525565555u, 0x4415551445449655u, 0x5105015504144541u, 0x65a69969a6965964u, 0x5054955969959656u, 0x5105154515554145u, 0x4055511051591555u, 0x5500514455550115u, 0x0041140014145515u, 0x1005440545511051u, 0x0014405450411004u, 0x0414440010500000u, 0x0044000440010040u, 0x5551155000004001u, 0x4554555454544114u, 0x5150045544005441u, 0x0001111400054501u, 0x6550955555554554u, 0x1504159645559559u, 0x4105055141454545u, 0x1411541410405454u, 0x0415555044545555u, 0x0014154115405550u, 0x1540055040411445u, 0x0000000500000000u, 0x5644000000000000u, 0x1155555591596555u, 0x0410440054569565u, 0x5145100010010005u, 0x0555041405500150u, 0x4141450455140450u, 0x0000000144000140u, 0x5114004001105410u, 0x4444100404005504u, 0x0414014410001015u, 0x5145055155555015u, 0x0141041444445540u, 0x0000100451541414u, 0x4105041104155550u, 0x0500501150451145u, 0x1001050000004114u, 0x5551504400141045u, 0x5110545410151454u, 0x0100001400004040u, 0x5040010111040000u, 0x0140000150541100u, 0x4400140400104110u, 0x5011014405545004u, 0x0000000044155440u, 0x0000000010000000u, 0x1100401444440001u, 0x0040401010055111u, 0x5155155551405454u, 0x0444440015514411u, 0x0054505054014101u, 0x0451015441115511u, 0x1541411401140551u, 0x4155104514445110u, 0x4141145450145515u, 0x5451445055155050u, 0x4400515554110054u, 0x5111145104501151u, 0x565a655455500501u, 0x5565555555525955u, 0x0550511500405695u, 0x4415504051054544u, 0x6555595965555554u, 0x0100915915555655u, 0x5540001510001001u, 0x5450051414000544u, 0x1405010555555551u, 0x5555515555644155u, 0x5555055595496555u, 0x5451045004415000u, 0x5450510144040144u, 0x5554155555556455u, 0x5051555495415555u, 0x5555554555555545u, 0x0000000010005455u, 0x4000005000040000u, 0x5565555555555954u, 0x5554559555555505u, 0x9645545495552555u, 0x4000400055955564u, 0x0040000000000001u, 0x4004100100000000u, 0x5540040440000411u, 0x4565555955545644u, 0x1140659549651556u, 0x0100000410010000u, 0x5555515400004001u, 0x5955545555155255u, 0x5151055545505556u, 0x5051454510554515u, 0x0501500050415554u, 0x5044154005441005u, 0x1455445450550455u, 0x0010144055144545u, 0x0000401100000004u, 0x1050145050000010u, 0x0415004554011540u, 0x1000510100151150u, 0x0100040400001144u, 0x0000000000000000u, 0x0550004400000100u, 0x0151145041451151u, 0x0000400400005450u, 0x0000100044010004u, 0x0100054100050040u, 0x0504400005410010u, 0x4011410445500105u, 0x0000404000144411u, 0x0101504404500000u, 0x0000005044400400u, 0x0000000014000100u, 0x0404440414000000u, 0x5554100410000140u, 0x4555455544505555u, 0x5454105055455455u, 0x0115454155454015u, 0x4404110000045100u, 0x4400001100101501u, 0x6596955956966a94u, 0x0040655955665965u, 0x5554144400100155u, 0xa549495401011041u, 0x5596555565955555u, 0x5569965959549555u, 0x969565a655555456u, 0x0000001000000000u, 0x0000000040000140u, 0x0000040100000000u, 0x1415454400000000u, 0x5410415411454114u, 0x0400040104000154u, 0x0504045000000411u, 0x0000001000000010u, 0x5554000000001040u, 0x5549155551556595u, 0x1455541055515555u, 0x0510555454554541u, 0x9555555555540455u, 0x6455456555556465u, 0x4524565555654514u, 0x5554655255559545u, 0x9555455441155556u, 0x0000000051515555u, 0x0010005040000550u, 0x5044044040000000u, 0x1045040440010500u, 0x0000400000040000u, 0x0000000000000000u }; static const uint64_t GENERIC_POW5_INV_SPLIT[89][4] = { { 0u, 0u, 0u, 144115188075855872u }, { 1573859546583440065u, 2691002611772552616u, 6763753280790178510u, 141347765182270746u }, { 12960290449513840412u, 12345512957918226762u, 18057899791198622765u, 138633484706040742u }, { 7615871757716765416u, 9507132263365501332u, 4879801712092008245u, 135971326161092377u }, { 7869961150745287587u, 5804035291554591636u, 8883897266325833928u, 133360288657597085u }, { 2942118023529634767u, 15128191429820565086u, 10638459445243230718u, 130799390525667397u }, { 14188759758411913794u, 5362791266439207815u, 8068821289119264054u, 128287668946279217u }, { 7183196927902545212u, 1952291723540117099u, 12075928209936341512u, 125824179589281448u }, { 5672588001402349748u, 17892323620748423487u, 9874578446960390364u, 123407996258356868u }, { 4442590541217566325u, 4558254706293456445u, 10343828952663182727u, 121038210542800766u }, { 3005560928406962566u, 2082271027139057888u, 13961184524927245081u, 118713931475986426u }, { 13299058168408384786u, 17834349496131278595u, 9029906103900731664u, 116434285200389047u }, { 5414878118283973035u, 13079825470227392078u, 17897304791683760280u, 114198414639042157u }, { 14609755883382484834u, 14991702445765844156u, 3269802549772755411u, 112005479173303009u }, { 15967774957605076027u, 2511532636717499923u, 16221038267832563171u, 109854654326805788u }, { 9269330061621627145u, 3332501053426257392u, 16223281189403734630u, 107745131455483836u }, { 16739559299223642282u, 1873986623300664530u, 6546709159471442872u, 105676117443544318u }, { 17116435360051202055u, 1359075105581853924u, 2038341371621886470u, 103646834405281051u }, { 17144715798009627550u, 3201623802661132408u, 9757551605154622431u, 101656519392613377u }, { 17580479792687825857u, 6546633380567327312u, 15099972427870912398u, 99704424108241124u }, { 9726477118325522902u, 14578369026754005435u, 11728055595254428803u, 97789814624307808u }, { 134593949518343635u, 5715151379816901985u, 1660163707976377376u, 95911971106466306u }, { 5515914027713859358u, 7124354893273815720u, 5548463282858794077u, 94070187543243255u }, { 6188403395862945512u, 5681264392632320838u, 15417410852121406654u, 92263771480600430u }, { 15908890877468271457u, 10398888261125597540u, 4817794962769172309u, 90492043761593298u }, { 1413077535082201005u, 12675058125384151580u, 7731426132303759597u, 88754338271028867u }, { 1486733163972670293u, 11369385300195092554u, 11610016711694864110u, 87050001685026843u }, { 8788596583757589684u, 3978580923851924802u, 9255162428306775812u, 85378393225389919u }, { 7203518319660962120u, 15044736224407683725u, 2488132019818199792u, 83738884418690858u }, { 4004175967662388707u, 18236988667757575407u, 15613100370957482671u, 82130858859985791u }, { 18371903370586036463u, 53497579022921640u, 16465963977267203307u, 80553711981064899u }, { 10170778323887491315u, 1999668801648976001u, 10209763593579456445u, 79006850823153334u }, { 17108131712433974546u, 16825784443029944237u, 2078700786753338945u, 77489693813976938u }, { 17221789422665858532u, 12145427517550446164u, 5391414622238668005u, 76001670549108934u }, { 4859588996898795878u, 1715798948121313204u, 3950858167455137171u, 74542221577515387u }, { 13513469241795711526u, 631367850494860526u, 10517278915021816160u, 73110798191218799u }, { 11757513142672073111u, 2581974932255022228u, 17498959383193606459u, 143413724438001539u }, { 14524355192525042817u, 5640643347559376447u, 1309659274756813016u, 140659771648132296u }, { 2765095348461978538u, 11021111021896007722u, 3224303603779962366u, 137958702611185230u }, { 12373410389187981037u, 13679193545685856195u, 11644609038462631561u, 135309501808182158u }, { 12813176257562780151u, 3754199046160268020u, 9954691079802960722u, 132711173221007413u }, { 17557452279667723458u, 3237799193992485824u, 17893947919029030695u, 130162739957935629u }, { 14634200999559435155u, 4123869946105211004u, 6955301747350769239u, 127663243886350468u }, { 2185352760627740240u, 2864813346878886844u, 13049218671329690184u, 125211745272516185u }, { 6143438674322183002u, 10464733336980678750u, 6982925169933978309u, 122807322428266620u }, { 1099509117817174576u, 10202656147550524081u, 754997032816608484u, 120449071364478757u }, { 2410631293559367023u, 17407273750261453804u, 15307291918933463037u, 118136105451200587u }, { 12224968375134586697u, 1664436604907828062u, 11506086230137787358u, 115867555084305488u }, { 3495926216898000888u, 18392536965197424288u, 10992889188570643156u, 113642567358547782u }, { 8744506286256259680u, 3966568369496879937u, 18342264969761820037u, 111460305746896569u }, { 7689600520560455039u, 5254331190877624630u, 9628558080573245556u, 109319949786027263u }, { 11862637625618819436u, 3456120362318976488u, 14690471063106001082u, 107220694767852583u }, { 5697330450030126444u, 12424082405392918899u, 358204170751754904u, 105161751436977040u }, { 11257457505097373622u, 15373192700214208870u, 671619062372033814u, 103142345693961148u }, { 16850355018477166700u, 1913910419361963966u, 4550257919755970531u, 101161718304283822u }, { 9670835567561997011u, 10584031339132130638u, 3060560222974851757u, 99219124612893520u }, { 7698686577353054710u, 11689292838639130817u, 11806331021588878241u, 97313834264240819u }, { 12233569599615692137u, 3347791226108469959u, 10333904326094451110u, 95445130927687169u }, { 13049400362825383933u, 17142621313007799680u, 3790542585289224168u, 93612312028186576u }, { 12430457242474442072u, 5625077542189557960u, 14765055286236672238u, 91814688482138969u }, { 4759444137752473128u, 2230562561567025078u, 4954443037339580076u, 90051584438315940u }, { 7246913525170274758u, 8910297835195760709u, 4015904029508858381u, 88322337023761438u }, { 12854430245836432067u, 8135139748065431455u, 11548083631386317976u, 86626296094571907u }, { 4848827254502687803u, 4789491250196085625u, 3988192420450664125u, 84962823991462151u }, { 7435538409611286684u, 904061756819742353u, 14598026519493048444u, 83331295300025028u }, { 11042616160352530997u, 8948390828345326218u, 10052651191118271927u, 81731096615594853u }, { 11059348291563778943u, 11696515766184685544u, 3783210511290897367u, 80161626312626082u }, { 7020010856491885826u, 5025093219346041680u, 8960210401638911765u, 78622294318500592u }, { 17732844474490699984u, 7820866704994446502u, 6088373186798844243u, 77112521891678506u }, { 688278527545590501u, 3045610706602776618u, 8684243536999567610u, 75631741404109150u }, { 2734573255120657297u, 3903146411440697663u, 9470794821691856713u, 74179396127820347u }, { 15996457521023071259u, 4776627823451271680u, 12394856457265744744u, 72754940025605801u }, { 13492065758834518331u, 7390517611012222399u, 1630485387832860230u, 142715675091463768u }, { 13665021627282055864u, 9897834675523659302u, 17907668136755296849u, 139975126841173266u }, { 9603773719399446181u, 10771916301484339398u, 10672699855989487527u, 137287204938390542u }, { 3630218541553511265u, 8139010004241080614u, 2876479648932814543u, 134650898807055963u }, { 8318835909686377084u, 9525369258927993371u, 2796120270400437057u, 132065217277054270u }, { 11190003059043290163u, 12424345635599592110u, 12539346395388933763u, 129529188211565064u }, { 8701968833973242276u, 820569587086330727u, 2315591597351480110u, 127041858141569228u }, { 5115113890115690487u, 16906305245394587826u, 9899749468931071388u, 124602291907373862u }, { 15543535488939245974u, 10945189844466391399u, 3553863472349432246u, 122209572307020975u }, { 7709257252608325038u, 1191832167690640880u, 15077137020234258537u, 119862799751447719u }, { 7541333244210021737u, 9790054727902174575u, 5160944773155322014u, 117561091926268545u }, { 12297384708782857832u, 1281328873123467374u, 4827925254630475769u, 115303583460052092u }, { 13243237906232367265u, 15873887428139547641u, 3607993172301799599u, 113089425598968120u }, { 11384616453739611114u, 15184114243769211033u, 13148448124803481057u, 110917785887682141u }, { 17727970963596660683u, 1196965221832671990u, 14537830463956404138u, 108787847856377790u }, { 17241367586707330931u, 8880584684128262874u, 11173506540726547818u, 106698810713789254u }, { 7184427196661305643u, 14332510582433188173u, 14230167953789677901u, 104649889046128358u } }; static const uint64_t POW5_INV_ERRORS[154] = { 0x1144155514145504u, 0x0000541555401141u, 0x0000000000000000u, 0x0154454000000000u, 0x4114105515544440u, 0x0001001111500415u, 0x4041411410011000u, 0x5550114515155014u, 0x1404100041554551u, 0x0515000450404410u, 0x5054544401140004u, 0x5155501005555105u, 0x1144141000105515u, 0x0541500000500000u, 0x1104105540444140u, 0x4000015055514110u, 0x0054010450004005u, 0x4155515404100005u, 0x5155145045155555u, 0x1511555515440558u, 0x5558544555515555u, 0x0000000000000010u, 0x5004000000000050u, 0x1415510100000010u, 0x4545555444514500u, 0x5155151555555551u, 0x1441540144044554u, 0x5150104045544400u, 0x5450545401444040u, 0x5554455045501400u, 0x4655155555555145u, 0x1000010055455055u, 0x1000004000055004u, 0x4455405104000005u, 0x4500114504150545u, 0x0000000014000000u, 0x5450000000000000u, 0x5514551511445555u, 0x4111501040555451u, 0x4515445500054444u, 0x5101500104100441u, 0x1545115155545055u, 0x0000000000000000u, 0x1554000000100000u, 0x5555545595551555u, 0x5555051851455955u, 0x5555555555555559u, 0x0000400011001555u, 0x0000004400040000u, 0x5455511555554554u, 0x5614555544115445u, 0x6455156145555155u, 0x5455855455415455u, 0x5515555144555545u, 0x0114400000145155u, 0x0000051000450511u, 0x4455154554445100u, 0x4554150141544455u, 0x65955555559a5965u, 0x5555555854559559u, 0x9569654559616595u, 0x1040044040005565u, 0x1010010500011044u, 0x1554015545154540u, 0x4440555401545441u, 0x1014441450550105u, 0x4545400410504145u, 0x5015111541040151u, 0x5145051154000410u, 0x1040001044545044u, 0x4001400000151410u, 0x0540000044040000u, 0x0510555454411544u, 0x0400054054141550u, 0x1001041145001100u, 0x0000000140000000u, 0x0000000014100000u, 0x1544005454000140u, 0x4050055505445145u, 0x0011511104504155u, 0x5505544415045055u, 0x1155154445515554u, 0x0000000000004555u, 0x0000000000000000u, 0x5101010510400004u, 0x1514045044440400u, 0x5515519555515555u, 0x4554545441555545u, 0x1551055955551515u, 0x0150000011505515u, 0x0044005040400000u, 0x0004001004010050u, 0x0000051004450414u, 0x0114001101001144u, 0x0401000001000001u, 0x4500010001000401u, 0x0004100000005000u, 0x0105000441101100u, 0x0455455550454540u, 0x5404050144105505u, 0x4101510540555455u, 0x1055541411451555u, 0x5451445110115505u, 0x1154110010101545u, 0x1145140450054055u, 0x5555565415551554u, 0x1550559555555555u, 0x5555541545045141u, 0x4555455450500100u, 0x5510454545554555u, 0x1510140115045455u, 0x1001050040111510u, 0x5555454555555504u, 0x9954155545515554u, 0x6596656555555555u, 0x0140410051555559u, 0x0011104010001544u, 0x965669659a680501u, 0x5655a55955556955u, 0x4015111014404514u, 0x1414155554505145u, 0x0540040011051404u, 0x1010000000015005u, 0x0010054050004410u, 0x5041104014000100u, 0x4440010500100001u, 0x1155510504545554u, 0x0450151545115541u, 0x4000100400110440u, 0x1004440010514440u, 0x0000115050450000u, 0x0545404455541500u, 0x1051051555505101u, 0x5505144554544144u, 0x4550545555515550u, 0x0015400450045445u, 0x4514155400554415u, 0x4555055051050151u, 0x1511441450001014u, 0x4544554510404414u, 0x4115115545545450u, 0x5500541555551555u, 0x5550010544155015u, 0x0144414045545500u, 0x4154050001050150u, 0x5550511111000145u, 0x1114504055000151u, 0x5104041101451040u, 0x0010501401051441u, 0x0010501450504401u, 0x4554585440044444u, 0x5155555951450455u, 0x0040000400105555u, 0x0000000000000001u, }; // Returns e == 0 ? 1 : ceil(log_2(5^e)); requires 0 <= e <= 32768. static inline uint32_t pow5bits(const int32_t e) { assert(e >= 0); assert(e <= 1 << 15); return (uint32_t) (((e * 163391164108059ull) >> 46) + 1); } static inline void mul_128_256_shift( const uint64_t* const a, const uint64_t* const b, const uint32_t shift, const uint32_t corr, uint64_t* const result) { assert(shift > 0); assert(shift < 256); const uint128_t b00 = ((uint128_t) a[0]) * b[0]; // 0 const uint128_t b01 = ((uint128_t) a[0]) * b[1]; // 64 const uint128_t b02 = ((uint128_t) a[0]) * b[2]; // 128 const uint128_t b03 = ((uint128_t) a[0]) * b[3]; // 196 const uint128_t b10 = ((uint128_t) a[1]) * b[0]; // 64 const uint128_t b11 = ((uint128_t) a[1]) * b[1]; // 128 const uint128_t b12 = ((uint128_t) a[1]) * b[2]; // 196 const uint128_t b13 = ((uint128_t) a[1]) * b[3]; // 256 const uint128_t s0 = b00; // 0 x const uint128_t s1 = b01 + b10; // 64 x const uint128_t c1 = s1 < b01; // 196 x const uint128_t s2 = b02 + b11; // 128 x const uint128_t c2 = s2 < b02; // 256 x const uint128_t s3 = b03 + b12; // 196 x const uint128_t c3 = s3 < b03; // 324 x const uint128_t p0 = s0 + (s1 << 64); // 0 const uint128_t d0 = p0 < b00; // 128 const uint128_t q1 = s2 + (s1 >> 64) + (s3 << 64); // 128 const uint128_t d1 = q1 < s2; // 256 const uint128_t p1 = q1 + (c1 << 64) + d0; // 128 const uint128_t d2 = p1 < q1; // 256 const uint128_t p2 = b13 + (s3 >> 64) + c2 + (c3 << 64) + d1 + d2; // 256 if (shift < 128) { const uint128_t r0 = corr + ((p0 >> shift) | (p1 << (128 - shift))); const uint128_t r1 = ((p1 >> shift) | (p2 << (128 - shift))) + (r0 < corr); result[0] = (uint64_t) r0; result[1] = (uint64_t) (r0 >> 64); result[2] = (uint64_t) r1; result[3] = (uint64_t) (r1 >> 64); } else if (shift == 128) { const uint128_t r0 = corr + p1; const uint128_t r1 = p2 + (r0 < corr); result[0] = (uint64_t) r0; result[1] = (uint64_t) (r0 >> 64); result[2] = (uint64_t) r1; result[3] = (uint64_t) (r1 >> 64); } else { const uint128_t r0 = corr + ((p1 >> (shift - 128)) | (p2 << (256 - shift))); const uint128_t r1 = (p2 >> (shift - 128)) + (r0 < corr); result[0] = (uint64_t) r0; result[1] = (uint64_t) (r0 >> 64); result[2] = (uint64_t) r1; result[3] = (uint64_t) (r1 >> 64); } } // Computes 5^i in the form required by Ryu, and stores it in the given pointer. static inline void generic_computePow5(const uint32_t i, uint64_t* const result) { const uint32_t base = i / POW5_TABLE_SIZE; const uint32_t base2 = base * POW5_TABLE_SIZE; const uint64_t* const mul = GENERIC_POW5_SPLIT[base]; if (i == base2) { result[0] = mul[0]; result[1] = mul[1]; result[2] = mul[2]; result[3] = mul[3]; } else { const uint32_t offset = i - base2; const uint64_t* const m = GENERIC_POW5_TABLE[offset]; const uint32_t delta = pow5bits(i) - pow5bits(base2); const uint32_t corr = (uint32_t) ((POW5_ERRORS[i / 32] >> (2 * (i % 32))) & 3); mul_128_256_shift(m, mul, delta, corr, result); } } // Computes 5^-i in the form required by Ryu, and stores it in the given pointer. static inline void generic_computeInvPow5(const uint32_t i, uint64_t* const result) { const uint32_t base = (i + POW5_TABLE_SIZE - 1) / POW5_TABLE_SIZE; const uint32_t base2 = base * POW5_TABLE_SIZE; const uint64_t* const mul = GENERIC_POW5_INV_SPLIT[base]; // 1/5^base2 if (i == base2) { result[0] = mul[0] + 1; result[1] = mul[1]; result[2] = mul[2]; result[3] = mul[3]; } else { const uint32_t offset = base2 - i; const uint64_t* const m = GENERIC_POW5_TABLE[offset]; // 5^offset const uint32_t delta = pow5bits(base2) - pow5bits(i); const uint32_t corr = (uint32_t) ((POW5_INV_ERRORS[i / 32] >> (2 * (i % 32))) & 3) + 1; mul_128_256_shift(m, mul, delta, corr, result); } } static inline uint32_t pow5Factor(uint128_t value) { for (uint32_t count = 0; value > 0; ++count) { if (value % 5 != 0) { return count; } value /= 5; } return 0; } // Returns true if value is divisible by 5^p. static inline bool multipleOfPowerOf5(const uint128_t value, const uint32_t p) { // I tried a case distinction on p, but there was no performance difference. return pow5Factor(value) >= p; } // Returns true if value is divisible by 2^p. static inline bool multipleOfPowerOf2(const uint128_t value, const uint32_t p) { return (value & ((((uint128_t) 1) << p) - 1)) == 0; } static inline uint128_t mulShift(const uint128_t m, const uint64_t* const mul, const int32_t j) { assert(j > 128); uint64_t a[2]; a[0] = (uint64_t) m; a[1] = (uint64_t) (m >> 64); uint64_t result[4]; mul_128_256_shift(a, mul, j, 0, result); return (((uint128_t) result[1]) << 64) | result[0]; } static inline uint32_t decimalLength(const uint128_t v) { static uint128_t LARGEST_POW10 = (((uint128_t) 5421010862427522170ull) << 64) | 687399551400673280ull; uint128_t p10 = LARGEST_POW10; for (uint32_t i = 39; i > 0; i--) { if (v >= p10) { return i; } p10 /= 10; } return 1; } // Returns floor(log_10(2^e)). static inline uint32_t log10Pow2(const int32_t e) { // The first value this approximation fails for is 2^1651 which is just greater than 10^297. assert(e >= 0); assert(e <= 1 << 15); return (uint32_t) ((((uint64_t) e) * 169464822037455ull) >> 49); } // Returns floor(log_10(5^e)). static inline uint32_t log10Pow5(const int32_t e) { // The first value this approximation fails for is 5^2621 which is just greater than 10^1832. assert(e >= 0); assert(e <= 1 << 15); return (uint32_t) ((((uint64_t) e) * 196742565691928ull) >> 48); } #endif // RYU_GENERIC128_H
0
repos/ryu
repos/ryu/ryu/s2f.c
// Copyright 2019 Ulf Adams // // The contents of this file may be used under the terms of the Apache License, // Version 2.0. // // (See accompanying file LICENSE-Apache or copy at // http://www.apache.org/licenses/LICENSE-2.0) // // Alternatively, the contents of this file may be used under the terms of // the Boost Software License, Version 1.0. // (See accompanying file LICENSE-Boost or copy at // https://www.boost.org/LICENSE_1_0.txt) // // Unless required by applicable law or agreed to in writing, this software // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. #include "ryu/ryu_parse.h" #include <assert.h> #include <stdbool.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #ifdef RYU_DEBUG #include <inttypes.h> #include <stdio.h> #endif #include "ryu/common.h" #include "ryu/f2s_intrinsics.h" #define FLOAT_MANTISSA_BITS 23 #define FLOAT_EXPONENT_BITS 8 #define FLOAT_EXPONENT_BIAS 127 #if defined(_MSC_VER) #include <intrin.h> static inline uint32_t floor_log2(const uint32_t value) { unsigned long index; return _BitScanReverse(&index, value) ? index : 32; } #else static inline uint32_t floor_log2(const uint32_t value) { return 31 - __builtin_clz(value); } #endif // The max function is already defined on Windows. static inline int32_t max32(int32_t a, int32_t b) { return a < b ? b : a; } static inline float int32Bits2Float(uint32_t bits) { float f; memcpy(&f, &bits, sizeof(float)); return f; } enum Status s2f_n(const char * buffer, const int len, float * result) { if (len == 0) { return INPUT_TOO_SHORT; } int m10digits = 0; int e10digits = 0; int dotIndex = len; int eIndex = len; uint32_t m10 = 0; int32_t e10 = 0; bool signedM = false; bool signedE = false; int i = 0; if (buffer[i] == '-') { signedM = true; i++; } for (; i < len; i++) { char c = buffer[i]; if (c == '.') { if (dotIndex != len) { return MALFORMED_INPUT; } dotIndex = i; continue; } if ((c < '0') || (c > '9')) { break; } if (m10digits >= 9) { return INPUT_TOO_LONG; } m10 = 10 * m10 + (c - '0'); if (m10 != 0) { m10digits++; } } if (i < len && ((buffer[i] == 'e') || (buffer[i] == 'E'))) { eIndex = i; i++; if (i < len && ((buffer[i] == '-') || (buffer[i] == '+'))) { signedE = buffer[i] == '-'; i++; } for (; i < len; i++) { char c = buffer[i]; if ((c < '0') || (c > '9')) { return MALFORMED_INPUT; } if (e10digits > 3) { // TODO: Be more lenient. Return +/-Infinity or +/-0 instead. return INPUT_TOO_LONG; } e10 = 10 * e10 + (c - '0'); if (e10 != 0) { e10digits++; } } } if (i < len) { return MALFORMED_INPUT; } if (signedE) { e10 = -e10; } e10 -= dotIndex < eIndex ? eIndex - dotIndex - 1 : 0; if (m10 == 0) { *result = signedM ? -0.0f : 0.0f; return SUCCESS; } #ifdef RYU_DEBUG printf("Input=%s\n", buffer); printf("m10digits = %d\n", m10digits); printf("e10digits = %d\n", e10digits); printf("m10 * 10^e10 = %u * 10^%d\n", m10, e10); #endif if ((m10digits + e10 <= -46) || (m10 == 0)) { // Number is less than 1e-46, which should be rounded down to 0; return +/-0.0. uint32_t ieee = ((uint32_t) signedM) << (FLOAT_EXPONENT_BITS + FLOAT_MANTISSA_BITS); *result = int32Bits2Float(ieee); return SUCCESS; } if (m10digits + e10 >= 40) { // Number is larger than 1e+39, which should be rounded to +/-Infinity. uint32_t ieee = (((uint32_t) signedM) << (FLOAT_EXPONENT_BITS + FLOAT_MANTISSA_BITS)) | (0xffu << FLOAT_MANTISSA_BITS); *result = int32Bits2Float(ieee); return SUCCESS; } // Convert to binary float m2 * 2^e2, while retaining information about whether the conversion // was exact (trailingZeros). int32_t e2; uint32_t m2; bool trailingZeros; if (e10 >= 0) { // The length of m * 10^e in bits is: // log2(m10 * 10^e10) = log2(m10) + e10 log2(10) = log2(m10) + e10 + e10 * log2(5) // // We want to compute the FLOAT_MANTISSA_BITS + 1 top-most bits (+1 for the implicit leading // one in IEEE format). We therefore choose a binary output exponent of // log2(m10 * 10^e10) - (FLOAT_MANTISSA_BITS + 1). // // We use floor(log2(5^e10)) so that we get at least this many bits; better to // have an additional bit than to not have enough bits. e2 = floor_log2(m10) + e10 + log2pow5(e10) - (FLOAT_MANTISSA_BITS + 1); // We now compute [m10 * 10^e10 / 2^e2] = [m10 * 5^e10 / 2^(e2-e10)]. // To that end, we use the FLOAT_POW5_SPLIT table. int j = e2 - e10 - ceil_log2pow5(e10) + FLOAT_POW5_BITCOUNT; assert(j >= 0); m2 = mulPow5divPow2(m10, e10, j); // We also compute if the result is exact, i.e., // [m10 * 10^e10 / 2^e2] == m10 * 10^e10 / 2^e2. // This can only be the case if 2^e2 divides m10 * 10^e10, which in turn requires that the // largest power of 2 that divides m10 + e10 is greater than e2. If e2 is less than e10, then // the result must be exact. Otherwise we use the existing multipleOfPowerOf2 function. trailingZeros = e2 < e10 || (e2 - e10 < 32 && multipleOfPowerOf2_32(m10, e2 - e10)); } else { e2 = floor_log2(m10) + e10 - ceil_log2pow5(-e10) - (FLOAT_MANTISSA_BITS + 1); // We now compute [m10 * 10^e10 / 2^e2] = [m10 / (5^(-e10) 2^(e2-e10))]. int j = e2 - e10 + ceil_log2pow5(-e10) - 1 + FLOAT_POW5_INV_BITCOUNT; m2 = mulPow5InvDivPow2(m10, -e10, j); // We also compute if the result is exact, i.e., // [m10 / (5^(-e10) 2^(e2-e10))] == m10 / (5^(-e10) 2^(e2-e10)) // // If e2-e10 >= 0, we need to check whether (5^(-e10) 2^(e2-e10)) divides m10, which is the // case iff pow5(m10) >= -e10 AND pow2(m10) >= e2-e10. // // If e2-e10 < 0, we have actually computed [m10 * 2^(e10 e2) / 5^(-e10)] above, // and we need to check whether 5^(-e10) divides (m10 * 2^(e10-e2)), which is the case iff // pow5(m10 * 2^(e10-e2)) = pow5(m10) >= -e10. trailingZeros = (e2 < e10 || (e2 - e10 < 32 && multipleOfPowerOf2_32(m10, e2 - e10))) && multipleOfPowerOf5_32(m10, -e10); } #ifdef RYU_DEBUG printf("m2 * 2^e2 = %u * 2^%d\n", m2, e2); #endif // Compute the final IEEE exponent. uint32_t ieee_e2 = (uint32_t) max32(0, e2 + FLOAT_EXPONENT_BIAS + floor_log2(m2)); if (ieee_e2 > 0xfe) { // Final IEEE exponent is larger than the maximum representable; return +/-Infinity. uint32_t ieee = (((uint32_t) signedM) << (FLOAT_EXPONENT_BITS + FLOAT_MANTISSA_BITS)) | (0xffu << FLOAT_MANTISSA_BITS); *result = int32Bits2Float(ieee); return SUCCESS; } // We need to figure out how much we need to shift m2. The tricky part is that we need to take // the final IEEE exponent into account, so we need to reverse the bias and also special-case // the value 0. int32_t shift = (ieee_e2 == 0 ? 1 : ieee_e2) - e2 - FLOAT_EXPONENT_BIAS - FLOAT_MANTISSA_BITS; assert(shift >= 0); #ifdef RYU_DEBUG printf("ieee_e2 = %d\n", ieee_e2); printf("shift = %d\n", shift); #endif // We need to round up if the exact value is more than 0.5 above the value we computed. That's // equivalent to checking if the last removed bit was 1 and either the value was not just // trailing zeros or the result would otherwise be odd. // // We need to update trailingZeros given that we have the exact output exponent ieee_e2 now. trailingZeros &= (m2 & ((1u << (shift - 1)) - 1)) == 0; uint32_t lastRemovedBit = (m2 >> (shift - 1)) & 1; bool roundUp = (lastRemovedBit != 0) && (!trailingZeros || (((m2 >> shift) & 1) != 0)); #ifdef RYU_DEBUG printf("roundUp = %d\n", roundUp); printf("ieee_m2 = %u\n", (m2 >> shift) + roundUp); #endif uint32_t ieee_m2 = (m2 >> shift) + roundUp; assert(ieee_m2 <= (1u << (FLOAT_MANTISSA_BITS + 1))); ieee_m2 &= (1u << FLOAT_MANTISSA_BITS) - 1; if (ieee_m2 == 0 && roundUp) { // Rounding up may overflow the mantissa. // In this case we move a trailing zero of the mantissa into the exponent. // Due to how the IEEE represents +/-Infinity, we don't need to check for overflow here. ieee_e2++; } uint32_t ieee = (((((uint32_t) signedM) << FLOAT_EXPONENT_BITS) | (uint32_t)ieee_e2) << FLOAT_MANTISSA_BITS) | ieee_m2; *result = int32Bits2Float(ieee); return SUCCESS; } enum Status s2f(const char * buffer, float * result) { return s2f_n(buffer, strlen(buffer), result); }
0
repos/ryu
repos/ryu/ryu/d2s_small_table.h
// Copyright 2018 Ulf Adams // // The contents of this file may be used under the terms of the Apache License, // Version 2.0. // // (See accompanying file LICENSE-Apache or copy at // http://www.apache.org/licenses/LICENSE-2.0) // // Alternatively, the contents of this file may be used under the terms of // the Boost Software License, Version 1.0. // (See accompanying file LICENSE-Boost or copy at // https://www.boost.org/LICENSE_1_0.txt) // // Unless required by applicable law or agreed to in writing, this software // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. #ifndef RYU_D2S_SMALL_TABLE_H #define RYU_D2S_SMALL_TABLE_H // Defines HAS_UINT128 and uint128_t if applicable. #include "ryu/d2s_intrinsics.h" // These tables are generated by PrintDoubleLookupTable. #define DOUBLE_POW5_INV_BITCOUNT 125 #define DOUBLE_POW5_BITCOUNT 125 static const uint64_t DOUBLE_POW5_INV_SPLIT2[15][2] = { { 1u, 2305843009213693952u }, { 5955668970331000884u, 1784059615882449851u }, { 8982663654677661702u, 1380349269358112757u }, { 7286864317269821294u, 2135987035920910082u }, { 7005857020398200553u, 1652639921975621497u }, { 17965325103354776697u, 1278668206209430417u }, { 8928596168509315048u, 1978643211784836272u }, { 10075671573058298858u, 1530901034580419511u }, { 597001226353042382u, 1184477304306571148u }, { 1527430471115325346u, 1832889850782397517u }, { 12533209867169019542u, 1418129833677084982u }, { 5577825024675947042u, 2194449627517475473u }, { 11006974540203867551u, 1697873161311732311u }, { 10313493231639821582u, 1313665730009899186u }, { 12701016819766672773u, 2032799256770390445u } }; static const uint32_t POW5_INV_OFFSETS[19] = { 0x54544554, 0x04055545, 0x10041000, 0x00400414, 0x40010000, 0x41155555, 0x00000454, 0x00010044, 0x40000000, 0x44000041, 0x50454450, 0x55550054, 0x51655554, 0x40004000, 0x01000001, 0x00010500, 0x51515411, 0x05555554, 0x00000000 }; static const uint64_t DOUBLE_POW5_SPLIT2[13][2] = { { 0u, 1152921504606846976u }, { 0u, 1490116119384765625u }, { 1032610780636961552u, 1925929944387235853u }, { 7910200175544436838u, 1244603055572228341u }, { 16941905809032713930u, 1608611746708759036u }, { 13024893955298202172u, 2079081953128979843u }, { 6607496772837067824u, 1343575221513417750u }, { 17332926989895652603u, 1736530273035216783u }, { 13037379183483547984u, 2244412773384604712u }, { 1605989338741628675u, 1450417759929778918u }, { 9630225068416591280u, 1874621017369538693u }, { 665883850346957067u, 1211445438634777304u }, { 14931890668723713708u, 1565756531257009982u } }; static const uint32_t POW5_OFFSETS[21] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40000000, 0x59695995, 0x55545555, 0x56555515, 0x41150504, 0x40555410, 0x44555145, 0x44504540, 0x45555550, 0x40004000, 0x96440440, 0x55565565, 0x54454045, 0x40154151, 0x55559155, 0x51405555, 0x00000105 }; #define POW5_TABLE_SIZE 26 static const uint64_t DOUBLE_POW5_TABLE[POW5_TABLE_SIZE] = { 1ull, 5ull, 25ull, 125ull, 625ull, 3125ull, 15625ull, 78125ull, 390625ull, 1953125ull, 9765625ull, 48828125ull, 244140625ull, 1220703125ull, 6103515625ull, 30517578125ull, 152587890625ull, 762939453125ull, 3814697265625ull, 19073486328125ull, 95367431640625ull, 476837158203125ull, 2384185791015625ull, 11920928955078125ull, 59604644775390625ull, 298023223876953125ull //, 1490116119384765625ull }; #if defined(HAS_UINT128) // Computes 5^i in the form required by Ryu, and stores it in the given pointer. static inline void double_computePow5(const uint32_t i, uint64_t* const result) { const uint32_t base = i / POW5_TABLE_SIZE; const uint32_t base2 = base * POW5_TABLE_SIZE; const uint32_t offset = i - base2; const uint64_t* const mul = DOUBLE_POW5_SPLIT2[base]; if (offset == 0) { result[0] = mul[0]; result[1] = mul[1]; return; } const uint64_t m = DOUBLE_POW5_TABLE[offset]; const uint128_t b0 = ((uint128_t) m) * mul[0]; const uint128_t b2 = ((uint128_t) m) * mul[1]; const uint32_t delta = pow5bits(i) - pow5bits(base2); const uint128_t shiftedSum = (b0 >> delta) + (b2 << (64 - delta)) + ((POW5_OFFSETS[i / 16] >> ((i % 16) << 1)) & 3); result[0] = (uint64_t) shiftedSum; result[1] = (uint64_t) (shiftedSum >> 64); } // Computes 5^-i in the form required by Ryu, and stores it in the given pointer. static inline void double_computeInvPow5(const uint32_t i, uint64_t* const result) { const uint32_t base = (i + POW5_TABLE_SIZE - 1) / POW5_TABLE_SIZE; const uint32_t base2 = base * POW5_TABLE_SIZE; const uint32_t offset = base2 - i; const uint64_t* const mul = DOUBLE_POW5_INV_SPLIT2[base]; // 1/5^base2 if (offset == 0) { result[0] = mul[0]; result[1] = mul[1]; return; } const uint64_t m = DOUBLE_POW5_TABLE[offset]; // 5^offset const uint128_t b0 = ((uint128_t) m) * (mul[0] - 1); const uint128_t b2 = ((uint128_t) m) * mul[1]; // 1/5^base2 * 5^offset = 1/5^(base2-offset) = 1/5^i const uint32_t delta = pow5bits(base2) - pow5bits(i); const uint128_t shiftedSum = ((b0 >> delta) + (b2 << (64 - delta))) + 1 + ((POW5_INV_OFFSETS[i / 16] >> ((i % 16) << 1)) & 3); result[0] = (uint64_t) shiftedSum; result[1] = (uint64_t) (shiftedSum >> 64); } #else // defined(HAS_UINT128) // Computes 5^i in the form required by Ryu, and stores it in the given pointer. static inline void double_computePow5(const uint32_t i, uint64_t* const result) { const uint32_t base = i / POW5_TABLE_SIZE; const uint32_t base2 = base * POW5_TABLE_SIZE; const uint32_t offset = i - base2; const uint64_t* const mul = DOUBLE_POW5_SPLIT2[base]; if (offset == 0) { result[0] = mul[0]; result[1] = mul[1]; return; } const uint64_t m = DOUBLE_POW5_TABLE[offset]; uint64_t high1; const uint64_t low1 = umul128(m, mul[1], &high1); uint64_t high0; const uint64_t low0 = umul128(m, mul[0], &high0); const uint64_t sum = high0 + low1; if (sum < high0) { ++high1; // overflow into high1 } // high1 | sum | low0 const uint32_t delta = pow5bits(i) - pow5bits(base2); result[0] = shiftright128(low0, sum, delta) + ((POW5_OFFSETS[i / 16] >> ((i % 16) << 1)) & 3); result[1] = shiftright128(sum, high1, delta); } // Computes 5^-i in the form required by Ryu, and stores it in the given pointer. static inline void double_computeInvPow5(const uint32_t i, uint64_t* const result) { const uint32_t base = (i + POW5_TABLE_SIZE - 1) / POW5_TABLE_SIZE; const uint32_t base2 = base * POW5_TABLE_SIZE; const uint32_t offset = base2 - i; const uint64_t* const mul = DOUBLE_POW5_INV_SPLIT2[base]; // 1/5^base2 if (offset == 0) { result[0] = mul[0]; result[1] = mul[1]; return; } const uint64_t m = DOUBLE_POW5_TABLE[offset]; uint64_t high1; const uint64_t low1 = umul128(m, mul[1], &high1); uint64_t high0; const uint64_t low0 = umul128(m, mul[0] - 1, &high0); const uint64_t sum = high0 + low1; if (sum < high0) { ++high1; // overflow into high1 } // high1 | sum | low0 const uint32_t delta = pow5bits(base2) - pow5bits(i); result[0] = shiftright128(low0, sum, delta) + 1 + ((POW5_INV_OFFSETS[i / 16] >> ((i % 16) << 1)) & 3); result[1] = shiftright128(sum, high1, delta); } #endif // defined(HAS_UINT128) #endif // RYU_D2S_SMALL_TABLE_H
0
repos/ryu
repos/ryu/ryu/digit_table.h
// Copyright 2018 Ulf Adams // // The contents of this file may be used under the terms of the Apache License, // Version 2.0. // // (See accompanying file LICENSE-Apache or copy at // http://www.apache.org/licenses/LICENSE-2.0) // // Alternatively, the contents of this file may be used under the terms of // the Boost Software License, Version 1.0. // (See accompanying file LICENSE-Boost or copy at // https://www.boost.org/LICENSE_1_0.txt) // // Unless required by applicable law or agreed to in writing, this software // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. #ifndef RYU_DIGIT_TABLE_H #define RYU_DIGIT_TABLE_H // A table of all two-digit numbers. This is used to speed up decimal digit // generation by copying pairs of digits into the final output. static const char DIGIT_TABLE[200] = { '0','0','0','1','0','2','0','3','0','4','0','5','0','6','0','7','0','8','0','9', '1','0','1','1','1','2','1','3','1','4','1','5','1','6','1','7','1','8','1','9', '2','0','2','1','2','2','2','3','2','4','2','5','2','6','2','7','2','8','2','9', '3','0','3','1','3','2','3','3','3','4','3','5','3','6','3','7','3','8','3','9', '4','0','4','1','4','2','4','3','4','4','4','5','4','6','4','7','4','8','4','9', '5','0','5','1','5','2','5','3','5','4','5','5','5','6','5','7','5','8','5','9', '6','0','6','1','6','2','6','3','6','4','6','5','6','6','6','7','6','8','6','9', '7','0','7','1','7','2','7','3','7','4','7','5','7','6','7','7','7','8','7','9', '8','0','8','1','8','2','8','3','8','4','8','5','8','6','8','7','8','8','8','9', '9','0','9','1','9','2','9','3','9','4','9','5','9','6','9','7','9','8','9','9' }; #endif // RYU_DIGIT_TABLE_H
0
repos/ryu
repos/ryu/ryu/s2d.c
// Copyright 2019 Ulf Adams // // The contents of this file may be used under the terms of the Apache License, // Version 2.0. // // (See accompanying file LICENSE-Apache or copy at // http://www.apache.org/licenses/LICENSE-2.0) // // Alternatively, the contents of this file may be used under the terms of // the Boost Software License, Version 1.0. // (See accompanying file LICENSE-Boost or copy at // https://www.boost.org/LICENSE_1_0.txt) // // Unless required by applicable law or agreed to in writing, this software // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. #include "ryu/ryu_parse.h" #include <assert.h> #include <stdbool.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #ifdef RYU_DEBUG #include <inttypes.h> #include <stdio.h> #endif #include "ryu/common.h" #include "ryu/d2s_intrinsics.h" #if defined(RYU_OPTIMIZE_SIZE) #include "ryu/d2s_small_table.h" #else #include "ryu/d2s_full_table.h" #endif #define DOUBLE_MANTISSA_BITS 52 #define DOUBLE_EXPONENT_BITS 11 #define DOUBLE_EXPONENT_BIAS 1023 #if defined(_MSC_VER) #include <intrin.h> static inline uint32_t floor_log2(const uint64_t value) { long index; return _BitScanReverse64(&index, value) ? index : 64; } #else static inline uint32_t floor_log2(const uint64_t value) { return 63 - __builtin_clzll(value); } #endif // The max function is already defined on Windows. static inline int32_t max32(int32_t a, int32_t b) { return a < b ? b : a; } static inline double int64Bits2Double(uint64_t bits) { double f; memcpy(&f, &bits, sizeof(double)); return f; } enum Status s2d_n(const char * buffer, const int len, double * result) { if (len == 0) { return INPUT_TOO_SHORT; } int m10digits = 0; int e10digits = 0; int dotIndex = len; int eIndex = len; uint64_t m10 = 0; int32_t e10 = 0; bool signedM = false; bool signedE = false; int i = 0; if (buffer[i] == '-') { signedM = true; i++; } for (; i < len; i++) { char c = buffer[i]; if (c == '.') { if (dotIndex != len) { return MALFORMED_INPUT; } dotIndex = i; continue; } if ((c < '0') || (c > '9')) { break; } if (m10digits >= 17) { return INPUT_TOO_LONG; } m10 = 10 * m10 + (c - '0'); if (m10 != 0) { m10digits++; } } if (i < len && ((buffer[i] == 'e') || (buffer[i] == 'E'))) { eIndex = i; i++; if (i < len && ((buffer[i] == '-') || (buffer[i] == '+'))) { signedE = buffer[i] == '-'; i++; } for (; i < len; i++) { char c = buffer[i]; if ((c < '0') || (c > '9')) { return MALFORMED_INPUT; } if (e10digits > 3) { // TODO: Be more lenient. Return +/-Infinity or +/-0 instead. return INPUT_TOO_LONG; } e10 = 10 * e10 + (c - '0'); if (e10 != 0) { e10digits++; } } } if (i < len) { return MALFORMED_INPUT; } if (signedE) { e10 = -e10; } e10 -= dotIndex < eIndex ? eIndex - dotIndex - 1 : 0; if (m10 == 0) { *result = signedM ? -0.0 : 0.0; return SUCCESS; } #ifdef RYU_DEBUG printf("Input=%s\n", buffer); printf("m10digits = %d\n", m10digits); printf("e10digits = %d\n", e10digits); printf("m10 * 10^e10 = %" PRIu64 " * 10^%d\n", m10, e10); #endif if ((m10digits + e10 <= -324) || (m10 == 0)) { // Number is less than 1e-324, which should be rounded down to 0; return +/-0.0. uint64_t ieee = ((uint64_t) signedM) << (DOUBLE_EXPONENT_BITS + DOUBLE_MANTISSA_BITS); *result = int64Bits2Double(ieee); return SUCCESS; } if (m10digits + e10 >= 310) { // Number is larger than 1e+309, which should be rounded to +/-Infinity. uint64_t ieee = (((uint64_t) signedM) << (DOUBLE_EXPONENT_BITS + DOUBLE_MANTISSA_BITS)) | (0x7ffull << DOUBLE_MANTISSA_BITS); *result = int64Bits2Double(ieee); return SUCCESS; } // Convert to binary float m2 * 2^e2, while retaining information about whether the conversion // was exact (trailingZeros). int32_t e2; uint64_t m2; bool trailingZeros; if (e10 >= 0) { // The length of m * 10^e in bits is: // log2(m10 * 10^e10) = log2(m10) + e10 log2(10) = log2(m10) + e10 + e10 * log2(5) // // We want to compute the DOUBLE_MANTISSA_BITS + 1 top-most bits (+1 for the implicit leading // one in IEEE format). We therefore choose a binary output exponent of // log2(m10 * 10^e10) - (DOUBLE_MANTISSA_BITS + 1). // // We use floor(log2(5^e10)) so that we get at least this many bits; better to // have an additional bit than to not have enough bits. e2 = floor_log2(m10) + e10 + log2pow5(e10) - (DOUBLE_MANTISSA_BITS + 1); // We now compute [m10 * 10^e10 / 2^e2] = [m10 * 5^e10 / 2^(e2-e10)]. // To that end, we use the DOUBLE_POW5_SPLIT table. int j = e2 - e10 - ceil_log2pow5(e10) + DOUBLE_POW5_BITCOUNT; assert(j >= 0); #if defined(RYU_OPTIMIZE_SIZE) uint64_t pow5[2]; double_computePow5(e10, pow5); m2 = mulShift64(m10, pow5, j); #else assert(e10 < DOUBLE_POW5_TABLE_SIZE); m2 = mulShift64(m10, DOUBLE_POW5_SPLIT[e10], j); #endif // We also compute if the result is exact, i.e., // [m10 * 10^e10 / 2^e2] == m10 * 10^e10 / 2^e2. // This can only be the case if 2^e2 divides m10 * 10^e10, which in turn requires that the // largest power of 2 that divides m10 + e10 is greater than e2. If e2 is less than e10, then // the result must be exact. Otherwise we use the existing multipleOfPowerOf2 function. trailingZeros = e2 < e10 || (e2 - e10 < 64 && multipleOfPowerOf2(m10, e2 - e10)); } else { e2 = floor_log2(m10) + e10 - ceil_log2pow5(-e10) - (DOUBLE_MANTISSA_BITS + 1); int j = e2 - e10 + ceil_log2pow5(-e10) - 1 + DOUBLE_POW5_INV_BITCOUNT; #if defined(RYU_OPTIMIZE_SIZE) uint64_t pow5[2]; double_computeInvPow5(-e10, pow5); m2 = mulShift64(m10, pow5, j); #else assert(-e10 < DOUBLE_POW5_INV_TABLE_SIZE); m2 = mulShift64(m10, DOUBLE_POW5_INV_SPLIT[-e10], j); #endif trailingZeros = multipleOfPowerOf5(m10, -e10); } #ifdef RYU_DEBUG printf("m2 * 2^e2 = %" PRIu64 " * 2^%d\n", m2, e2); #endif // Compute the final IEEE exponent. uint32_t ieee_e2 = (uint32_t) max32(0, e2 + DOUBLE_EXPONENT_BIAS + floor_log2(m2)); if (ieee_e2 > 0x7fe) { // Final IEEE exponent is larger than the maximum representable; return +/-Infinity. uint64_t ieee = (((uint64_t) signedM) << (DOUBLE_EXPONENT_BITS + DOUBLE_MANTISSA_BITS)) | (0x7ffull << DOUBLE_MANTISSA_BITS); *result = int64Bits2Double(ieee); return SUCCESS; } // We need to figure out how much we need to shift m2. The tricky part is that we need to take // the final IEEE exponent into account, so we need to reverse the bias and also special-case // the value 0. int32_t shift = (ieee_e2 == 0 ? 1 : ieee_e2) - e2 - DOUBLE_EXPONENT_BIAS - DOUBLE_MANTISSA_BITS; assert(shift >= 0); #ifdef RYU_DEBUG printf("ieee_e2 = %d\n", ieee_e2); printf("shift = %d\n", shift); #endif // We need to round up if the exact value is more than 0.5 above the value we computed. That's // equivalent to checking if the last removed bit was 1 and either the value was not just // trailing zeros or the result would otherwise be odd. // // We need to update trailingZeros given that we have the exact output exponent ieee_e2 now. trailingZeros &= (m2 & ((1ull << (shift - 1)) - 1)) == 0; uint64_t lastRemovedBit = (m2 >> (shift - 1)) & 1; bool roundUp = (lastRemovedBit != 0) && (!trailingZeros || (((m2 >> shift) & 1) != 0)); #ifdef RYU_DEBUG printf("roundUp = %d\n", roundUp); printf("ieee_m2 = %" PRIu64 "\n", (m2 >> shift) + roundUp); #endif uint64_t ieee_m2 = (m2 >> shift) + roundUp; assert(ieee_m2 <= (1ull << (DOUBLE_MANTISSA_BITS + 1))); ieee_m2 &= (1ull << DOUBLE_MANTISSA_BITS) - 1; if (ieee_m2 == 0 && roundUp) { // Due to how the IEEE represents +/-Infinity, we don't need to check for overflow here. ieee_e2++; } uint64_t ieee = (((((uint64_t) signedM) << DOUBLE_EXPONENT_BITS) | (uint64_t)ieee_e2) << DOUBLE_MANTISSA_BITS) | ieee_m2; *result = int64Bits2Double(ieee); return SUCCESS; } enum Status s2d(const char * buffer, double * result) { return s2d_n(buffer, strlen(buffer), result); }
0
repos/ryu
repos/ryu/ryu/d2fixed.c
// Copyright 2018 Ulf Adams // // The contents of this file may be used under the terms of the Apache License, // Version 2.0. // // (See accompanying file LICENSE-Apache or copy at // http://www.apache.org/licenses/LICENSE-2.0) // // Alternatively, the contents of this file may be used under the terms of // the Boost Software License, Version 1.0. // (See accompanying file LICENSE-Boost or copy at // https://www.boost.org/LICENSE_1_0.txt) // // Unless required by applicable law or agreed to in writing, this software // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. // Runtime compiler options: // -DRYU_DEBUG Generate verbose debugging output to stdout. // // -DRYU_ONLY_64_BIT_OPS Avoid using uint128_t or 64-bit intrinsics. Slower, // depending on your compiler. // // -DRYU_AVOID_UINT128 Avoid using uint128_t. Slower, depending on your compiler. #include "ryu/ryu.h" #include <assert.h> #include <stdbool.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #ifdef RYU_DEBUG #include <inttypes.h> #include <stdio.h> #endif #include "ryu/common.h" #include "ryu/digit_table.h" #include "ryu/d2fixed_full_table.h" #include "ryu/d2s_intrinsics.h" #define DOUBLE_MANTISSA_BITS 52 #define DOUBLE_EXPONENT_BITS 11 #define DOUBLE_BIAS 1023 #define POW10_ADDITIONAL_BITS 120 #if defined(HAS_UINT128) static inline uint128_t umul256(const uint128_t a, const uint64_t bHi, const uint64_t bLo, uint128_t* const productHi) { const uint64_t aLo = (uint64_t)a; const uint64_t aHi = (uint64_t)(a >> 64); const uint128_t b00 = (uint128_t)aLo * bLo; const uint128_t b01 = (uint128_t)aLo * bHi; const uint128_t b10 = (uint128_t)aHi * bLo; const uint128_t b11 = (uint128_t)aHi * bHi; const uint64_t b00Lo = (uint64_t)b00; const uint64_t b00Hi = (uint64_t)(b00 >> 64); const uint128_t mid1 = b10 + b00Hi; const uint64_t mid1Lo = (uint64_t)(mid1); const uint64_t mid1Hi = (uint64_t)(mid1 >> 64); const uint128_t mid2 = b01 + mid1Lo; const uint64_t mid2Lo = (uint64_t)(mid2); const uint64_t mid2Hi = (uint64_t)(mid2 >> 64); const uint128_t pHi = b11 + mid1Hi + mid2Hi; const uint128_t pLo = ((uint128_t)mid2Lo << 64) | b00Lo; *productHi = pHi; return pLo; } // Returns the high 128 bits of the 256-bit product of a and b. static inline uint128_t umul256_hi(const uint128_t a, const uint64_t bHi, const uint64_t bLo) { // Reuse the umul256 implementation. // Optimizers will likely eliminate the instructions used to compute the // low part of the product. uint128_t hi; umul256(a, bHi, bLo, &hi); return hi; } // Unfortunately, gcc/clang do not automatically turn a 128-bit integer division // into a multiplication, so we have to do it manually. static inline uint32_t uint128_mod1e9(const uint128_t v) { // After multiplying, we're going to shift right by 29, then truncate to uint32_t. // This means that we need only 29 + 32 = 61 bits, so we can truncate to uint64_t before shifting. const uint64_t multiplied = (uint64_t) umul256_hi(v, 0x89705F4136B4A597u, 0x31680A88F8953031u); // For uint32_t truncation, see the mod1e9() comment in d2s_intrinsics.h. const uint32_t shifted = (uint32_t) (multiplied >> 29); return ((uint32_t) v) - 1000000000 * shifted; } // Best case: use 128-bit type. static inline uint32_t mulShift_mod1e9(const uint64_t m, const uint64_t* const mul, const int32_t j) { const uint128_t b0 = ((uint128_t) m) * mul[0]; // 0 const uint128_t b1 = ((uint128_t) m) * mul[1]; // 64 const uint128_t b2 = ((uint128_t) m) * mul[2]; // 128 #ifdef RYU_DEBUG if (j < 128 || j > 180) { printf("%d\n", j); } #endif assert(j >= 128); assert(j <= 180); // j: [128, 256) const uint128_t mid = b1 + (uint64_t) (b0 >> 64); // 64 const uint128_t s1 = b2 + (uint64_t) (mid >> 64); // 128 return uint128_mod1e9(s1 >> (j - 128)); } #else // HAS_UINT128 #if defined(HAS_64_BIT_INTRINSICS) // Returns the low 64 bits of the high 128 bits of the 256-bit product of a and b. static inline uint64_t umul256_hi128_lo64( const uint64_t aHi, const uint64_t aLo, const uint64_t bHi, const uint64_t bLo) { uint64_t b00Hi; const uint64_t b00Lo = umul128(aLo, bLo, &b00Hi); uint64_t b01Hi; const uint64_t b01Lo = umul128(aLo, bHi, &b01Hi); uint64_t b10Hi; const uint64_t b10Lo = umul128(aHi, bLo, &b10Hi); uint64_t b11Hi; const uint64_t b11Lo = umul128(aHi, bHi, &b11Hi); (void) b00Lo; // unused (void) b11Hi; // unused const uint64_t temp1Lo = b10Lo + b00Hi; const uint64_t temp1Hi = b10Hi + (temp1Lo < b10Lo); const uint64_t temp2Lo = b01Lo + temp1Lo; const uint64_t temp2Hi = b01Hi + (temp2Lo < b01Lo); return b11Lo + temp1Hi + temp2Hi; } static inline uint32_t uint128_mod1e9(const uint64_t vHi, const uint64_t vLo) { // After multiplying, we're going to shift right by 29, then truncate to uint32_t. // This means that we need only 29 + 32 = 61 bits, so we can truncate to uint64_t before shifting. const uint64_t multiplied = umul256_hi128_lo64(vHi, vLo, 0x89705F4136B4A597u, 0x31680A88F8953031u); // For uint32_t truncation, see the mod1e9() comment in d2s_intrinsics.h. const uint32_t shifted = (uint32_t) (multiplied >> 29); return ((uint32_t) vLo) - 1000000000 * shifted; } #endif // HAS_64_BIT_INTRINSICS static inline uint32_t mulShift_mod1e9(const uint64_t m, const uint64_t* const mul, const int32_t j) { uint64_t high0; // 64 const uint64_t low0 = umul128(m, mul[0], &high0); // 0 uint64_t high1; // 128 const uint64_t low1 = umul128(m, mul[1], &high1); // 64 uint64_t high2; // 192 const uint64_t low2 = umul128(m, mul[2], &high2); // 128 const uint64_t s0low = low0; // 0 (void) s0low; // unused const uint64_t s0high = low1 + high0; // 64 const uint32_t c1 = s0high < low1; const uint64_t s1low = low2 + high1 + c1; // 128 const uint32_t c2 = s1low < low2; // high1 + c1 can't overflow, so compare against low2 const uint64_t s1high = high2 + c2; // 192 #ifdef RYU_DEBUG if (j < 128 || j > 180) { printf("%d\n", j); } #endif assert(j >= 128); assert(j <= 180); #if defined(HAS_64_BIT_INTRINSICS) const uint32_t dist = (uint32_t) (j - 128); // dist: [0, 52] const uint64_t shiftedhigh = s1high >> dist; const uint64_t shiftedlow = shiftright128(s1low, s1high, dist); return uint128_mod1e9(shiftedhigh, shiftedlow); #else // HAS_64_BIT_INTRINSICS if (j < 160) { // j: [128, 160) const uint64_t r0 = mod1e9(s1high); const uint64_t r1 = mod1e9((r0 << 32) | (s1low >> 32)); const uint64_t r2 = ((r1 << 32) | (s1low & 0xffffffff)); return mod1e9(r2 >> (j - 128)); } else { // j: [160, 192) const uint64_t r0 = mod1e9(s1high); const uint64_t r1 = ((r0 << 32) | (s1low >> 32)); return mod1e9(r1 >> (j - 160)); } #endif // HAS_64_BIT_INTRINSICS } #endif // HAS_UINT128 // Convert `digits` to a sequence of decimal digits. Append the digits to the result. // The caller has to guarantee that: // 10^(olength-1) <= digits < 10^olength // e.g., by passing `olength` as `decimalLength9(digits)`. static inline void append_n_digits(const uint32_t olength, uint32_t digits, char* const result) { #ifdef RYU_DEBUG printf("DIGITS=%u\n", digits); #endif uint32_t i = 0; while (digits >= 10000) { #ifdef __clang__ // https://bugs.llvm.org/show_bug.cgi?id=38217 const uint32_t c = digits - 10000 * (digits / 10000); #else const uint32_t c = digits % 10000; #endif digits /= 10000; const uint32_t c0 = (c % 100) << 1; const uint32_t c1 = (c / 100) << 1; memcpy(result + olength - i - 2, DIGIT_TABLE + c0, 2); memcpy(result + olength - i - 4, DIGIT_TABLE + c1, 2); i += 4; } if (digits >= 100) { const uint32_t c = (digits % 100) << 1; digits /= 100; memcpy(result + olength - i - 2, DIGIT_TABLE + c, 2); i += 2; } if (digits >= 10) { const uint32_t c = digits << 1; memcpy(result + olength - i - 2, DIGIT_TABLE + c, 2); } else { result[0] = (char) ('0' + digits); } } // Convert `digits` to a sequence of decimal digits. Print the first digit, followed by a decimal // dot '.' followed by the remaining digits. The caller has to guarantee that: // 10^(olength-1) <= digits < 10^olength // e.g., by passing `olength` as `decimalLength9(digits)`. static inline void append_d_digits(const uint32_t olength, uint32_t digits, char* const result) { #ifdef RYU_DEBUG printf("DIGITS=%u\n", digits); #endif uint32_t i = 0; while (digits >= 10000) { #ifdef __clang__ // https://bugs.llvm.org/show_bug.cgi?id=38217 const uint32_t c = digits - 10000 * (digits / 10000); #else const uint32_t c = digits % 10000; #endif digits /= 10000; const uint32_t c0 = (c % 100) << 1; const uint32_t c1 = (c / 100) << 1; memcpy(result + olength + 1 - i - 2, DIGIT_TABLE + c0, 2); memcpy(result + olength + 1 - i - 4, DIGIT_TABLE + c1, 2); i += 4; } if (digits >= 100) { const uint32_t c = (digits % 100) << 1; digits /= 100; memcpy(result + olength + 1 - i - 2, DIGIT_TABLE + c, 2); i += 2; } if (digits >= 10) { const uint32_t c = digits << 1; result[2] = DIGIT_TABLE[c + 1]; result[1] = '.'; result[0] = DIGIT_TABLE[c]; } else { result[1] = '.'; result[0] = (char) ('0' + digits); } } // Convert `digits` to decimal and write the last `count` decimal digits to result. // If `digits` contains additional digits, then those are silently ignored. static inline void append_c_digits(const uint32_t count, uint32_t digits, char* const result) { #ifdef RYU_DEBUG printf("DIGITS=%u\n", digits); #endif // Copy pairs of digits from DIGIT_TABLE. uint32_t i = 0; for (; i < count - 1; i += 2) { const uint32_t c = (digits % 100) << 1; digits /= 100; memcpy(result + count - i - 2, DIGIT_TABLE + c, 2); } // Generate the last digit if count is odd. if (i < count) { const char c = (char) ('0' + (digits % 10)); result[count - i - 1] = c; } } // Convert `digits` to decimal and write the last 9 decimal digits to result. // If `digits` contains additional digits, then those are silently ignored. static inline void append_nine_digits(uint32_t digits, char* const result) { #ifdef RYU_DEBUG printf("DIGITS=%u\n", digits); #endif if (digits == 0) { memset(result, '0', 9); return; } for (uint32_t i = 0; i < 5; i += 4) { #ifdef __clang__ // https://bugs.llvm.org/show_bug.cgi?id=38217 const uint32_t c = digits - 10000 * (digits / 10000); #else const uint32_t c = digits % 10000; #endif digits /= 10000; const uint32_t c0 = (c % 100) << 1; const uint32_t c1 = (c / 100) << 1; memcpy(result + 7 - i, DIGIT_TABLE + c0, 2); memcpy(result + 5 - i, DIGIT_TABLE + c1, 2); } result[0] = (char) ('0' + digits); } static inline uint32_t indexForExponent(const uint32_t e) { return (e + 15) / 16; } static inline uint32_t pow10BitsForIndex(const uint32_t idx) { return 16 * idx + POW10_ADDITIONAL_BITS; } static inline uint32_t lengthForIndex(const uint32_t idx) { // +1 for ceil, +16 for mantissa, +8 to round up when dividing by 9 return (log10Pow2(16 * (int32_t) idx) + 1 + 16 + 8) / 9; } static inline int copy_special_str_printf(char* const result, const bool sign, const uint64_t mantissa) { #if defined(_MSC_VER) // TODO: Check that -nan is expected output on Windows. if (sign) { result[0] = '-'; } if (mantissa) { if (mantissa < (1ull << (DOUBLE_MANTISSA_BITS - 1))) { memcpy(result + sign, "nan(snan)", 9); return sign + 9; } memcpy(result + sign, "nan", 3); return sign + 3; } #else if (mantissa) { memcpy(result, "nan", 3); return 3; } if (sign) { result[0] = '-'; } #endif memcpy(result + sign, "Infinity", 8); return sign + 8; } int d2fixed_buffered_n(double d, uint32_t precision, char* result) { const uint64_t bits = double_to_bits(d); #ifdef RYU_DEBUG printf("IN="); for (int32_t bit = 63; bit >= 0; --bit) { printf("%d", (int) ((bits >> bit) & 1)); } printf("\n"); #endif // Decode bits into sign, mantissa, and exponent. const bool ieeeSign = ((bits >> (DOUBLE_MANTISSA_BITS + DOUBLE_EXPONENT_BITS)) & 1) != 0; const uint64_t ieeeMantissa = bits & ((1ull << DOUBLE_MANTISSA_BITS) - 1); const uint32_t ieeeExponent = (uint32_t) ((bits >> DOUBLE_MANTISSA_BITS) & ((1u << DOUBLE_EXPONENT_BITS) - 1)); // Case distinction; exit early for the easy cases. if (ieeeExponent == ((1u << DOUBLE_EXPONENT_BITS) - 1u)) { return copy_special_str_printf(result, ieeeSign, ieeeMantissa); } if (ieeeExponent == 0 && ieeeMantissa == 0) { int index = 0; if (ieeeSign) { result[index++] = '-'; } result[index++] = '0'; if (precision > 0) { result[index++] = '.'; memset(result + index, '0', precision); index += precision; } return index; } int32_t e2; uint64_t m2; if (ieeeExponent == 0) { e2 = 1 - DOUBLE_BIAS - DOUBLE_MANTISSA_BITS; m2 = ieeeMantissa; } else { e2 = (int32_t) ieeeExponent - DOUBLE_BIAS - DOUBLE_MANTISSA_BITS; m2 = (1ull << DOUBLE_MANTISSA_BITS) | ieeeMantissa; } #ifdef RYU_DEBUG printf("-> %" PRIu64 " * 2^%d\n", m2, e2); #endif int index = 0; bool nonzero = false; if (ieeeSign) { result[index++] = '-'; } if (e2 >= -52) { const uint32_t idx = e2 < 0 ? 0 : indexForExponent((uint32_t) e2); const uint32_t p10bits = pow10BitsForIndex(idx); const int32_t len = (int32_t) lengthForIndex(idx); #ifdef RYU_DEBUG printf("idx=%u\n", idx); printf("len=%d\n", len); #endif for (int32_t i = len - 1; i >= 0; --i) { const uint32_t j = p10bits - e2; // Temporary: j is usually around 128, and by shifting a bit, we push it to 128 or above, which is // a slightly faster code path in mulShift_mod1e9. Instead, we can just increase the multipliers. const uint32_t digits = mulShift_mod1e9(m2 << 8, POW10_SPLIT[POW10_OFFSET[idx] + i], (int32_t) (j + 8)); if (nonzero) { append_nine_digits(digits, result + index); index += 9; } else if (digits != 0) { const uint32_t olength = decimalLength9(digits); append_n_digits(olength, digits, result + index); index += olength; nonzero = true; } } } if (!nonzero) { result[index++] = '0'; } if (precision > 0) { result[index++] = '.'; } #ifdef RYU_DEBUG printf("e2=%d\n", e2); #endif if (e2 < 0) { const int32_t idx = -e2 / 16; #ifdef RYU_DEBUG printf("idx=%d\n", idx); #endif const uint32_t blocks = precision / 9 + 1; // 0 = don't round up; 1 = round up unconditionally; 2 = round up if odd. int roundUp = 0; uint32_t i = 0; if (blocks <= MIN_BLOCK_2[idx]) { i = blocks; memset(result + index, '0', precision); index += precision; } else if (i < MIN_BLOCK_2[idx]) { i = MIN_BLOCK_2[idx]; memset(result + index, '0', 9 * i); index += 9 * i; } for (; i < blocks; ++i) { const int32_t j = ADDITIONAL_BITS_2 + (-e2 - 16 * idx); const uint32_t p = POW10_OFFSET_2[idx] + i - MIN_BLOCK_2[idx]; if (p >= POW10_OFFSET_2[idx + 1]) { // If the remaining digits are all 0, then we might as well use memset. // No rounding required in this case. const uint32_t fill = precision - 9 * i; memset(result + index, '0', fill); index += fill; break; } // Temporary: j is usually around 128, and by shifting a bit, we push it to 128 or above, which is // a slightly faster code path in mulShift_mod1e9. Instead, we can just increase the multipliers. uint32_t digits = mulShift_mod1e9(m2 << 8, POW10_SPLIT_2[p], j + 8); #ifdef RYU_DEBUG printf("digits=%u\n", digits); #endif if (i < blocks - 1) { append_nine_digits(digits, result + index); index += 9; } else { const uint32_t maximum = precision - 9 * i; uint32_t lastDigit = 0; for (uint32_t k = 0; k < 9 - maximum; ++k) { lastDigit = digits % 10; digits /= 10; } #ifdef RYU_DEBUG printf("lastDigit=%u\n", lastDigit); #endif if (lastDigit != 5) { roundUp = lastDigit > 5; } else { // Is m * 10^(additionalDigits + 1) / 2^(-e2) integer? const int32_t requiredTwos = -e2 - (int32_t) precision - 1; const bool trailingZeros = requiredTwos <= 0 || (requiredTwos < 60 && multipleOfPowerOf2(m2, (uint32_t) requiredTwos)); roundUp = trailingZeros ? 2 : 1; #ifdef RYU_DEBUG printf("requiredTwos=%d\n", requiredTwos); printf("trailingZeros=%s\n", trailingZeros ? "true" : "false"); #endif } if (maximum > 0) { append_c_digits(maximum, digits, result + index); index += maximum; } break; } } #ifdef RYU_DEBUG printf("roundUp=%d\n", roundUp); #endif if (roundUp != 0) { int roundIndex = index; int dotIndex = 0; // '.' can't be located at index 0 while (true) { --roundIndex; char c; if (roundIndex == -1 || (c = result[roundIndex], c == '-')) { result[roundIndex + 1] = '1'; if (dotIndex > 0) { result[dotIndex] = '0'; result[dotIndex + 1] = '.'; } result[index++] = '0'; break; } if (c == '.') { dotIndex = roundIndex; continue; } else if (c == '9') { result[roundIndex] = '0'; roundUp = 1; continue; } else { if (roundUp == 2 && c % 2 == 0) { break; } result[roundIndex] = c + 1; break; } } } } else { memset(result + index, '0', precision); index += precision; } return index; } void d2fixed_buffered(double d, uint32_t precision, char* result) { const int len = d2fixed_buffered_n(d, precision, result); result[len] = '\0'; } char* d2fixed(double d, uint32_t precision) { char* const buffer = (char*)malloc(2000); const int index = d2fixed_buffered_n(d, precision, buffer); buffer[index] = '\0'; return buffer; } int d2exp_buffered_n(double d, uint32_t precision, char* result) { const uint64_t bits = double_to_bits(d); #ifdef RYU_DEBUG printf("IN="); for (int32_t bit = 63; bit >= 0; --bit) { printf("%d", (int) ((bits >> bit) & 1)); } printf("\n"); #endif // Decode bits into sign, mantissa, and exponent. const bool ieeeSign = ((bits >> (DOUBLE_MANTISSA_BITS + DOUBLE_EXPONENT_BITS)) & 1) != 0; const uint64_t ieeeMantissa = bits & ((1ull << DOUBLE_MANTISSA_BITS) - 1); const uint32_t ieeeExponent = (uint32_t) ((bits >> DOUBLE_MANTISSA_BITS) & ((1u << DOUBLE_EXPONENT_BITS) - 1)); // Case distinction; exit early for the easy cases. if (ieeeExponent == ((1u << DOUBLE_EXPONENT_BITS) - 1u)) { return copy_special_str_printf(result, ieeeSign, ieeeMantissa); } if (ieeeExponent == 0 && ieeeMantissa == 0) { int index = 0; if (ieeeSign) { result[index++] = '-'; } result[index++] = '0'; if (precision > 0) { result[index++] = '.'; memset(result + index, '0', precision); index += precision; } memcpy(result + index, "e+00", 4); index += 4; return index; } int32_t e2; uint64_t m2; if (ieeeExponent == 0) { e2 = 1 - DOUBLE_BIAS - DOUBLE_MANTISSA_BITS; m2 = ieeeMantissa; } else { e2 = (int32_t) ieeeExponent - DOUBLE_BIAS - DOUBLE_MANTISSA_BITS; m2 = (1ull << DOUBLE_MANTISSA_BITS) | ieeeMantissa; } #ifdef RYU_DEBUG printf("-> %" PRIu64 " * 2^%d\n", m2, e2); #endif const bool printDecimalPoint = precision > 0; ++precision; int index = 0; if (ieeeSign) { result[index++] = '-'; } uint32_t digits = 0; uint32_t printedDigits = 0; uint32_t availableDigits = 0; int32_t exp = 0; if (e2 >= -52) { const uint32_t idx = e2 < 0 ? 0 : indexForExponent((uint32_t) e2); const uint32_t p10bits = pow10BitsForIndex(idx); const int32_t len = (int32_t) lengthForIndex(idx); #ifdef RYU_DEBUG printf("idx=%u\n", idx); printf("len=%d\n", len); #endif for (int32_t i = len - 1; i >= 0; --i) { const uint32_t j = p10bits - e2; // Temporary: j is usually around 128, and by shifting a bit, we push it to 128 or above, which is // a slightly faster code path in mulShift_mod1e9. Instead, we can just increase the multipliers. digits = mulShift_mod1e9(m2 << 8, POW10_SPLIT[POW10_OFFSET[idx] + i], (int32_t) (j + 8)); if (printedDigits != 0) { if (printedDigits + 9 > precision) { availableDigits = 9; break; } append_nine_digits(digits, result + index); index += 9; printedDigits += 9; } else if (digits != 0) { availableDigits = decimalLength9(digits); exp = i * 9 + (int32_t) availableDigits - 1; if (availableDigits > precision) { break; } if (printDecimalPoint) { append_d_digits(availableDigits, digits, result + index); index += availableDigits + 1; // +1 for decimal point } else { result[index++] = (char) ('0' + digits); } printedDigits = availableDigits; availableDigits = 0; } } } if (e2 < 0 && availableDigits == 0) { const int32_t idx = -e2 / 16; #ifdef RYU_DEBUG printf("idx=%d, e2=%d, min=%d\n", idx, e2, MIN_BLOCK_2[idx]); #endif for (int32_t i = MIN_BLOCK_2[idx]; i < 200; ++i) { const int32_t j = ADDITIONAL_BITS_2 + (-e2 - 16 * idx); const uint32_t p = POW10_OFFSET_2[idx] + (uint32_t) i - MIN_BLOCK_2[idx]; // Temporary: j is usually around 128, and by shifting a bit, we push it to 128 or above, which is // a slightly faster code path in mulShift_mod1e9. Instead, we can just increase the multipliers. digits = (p >= POW10_OFFSET_2[idx + 1]) ? 0 : mulShift_mod1e9(m2 << 8, POW10_SPLIT_2[p], j + 8); #ifdef RYU_DEBUG printf("exact=%" PRIu64 " * (%" PRIu64 " + %" PRIu64 " << 64) >> %d\n", m2, POW10_SPLIT_2[p][0], POW10_SPLIT_2[p][1], j); printf("digits=%u\n", digits); #endif if (printedDigits != 0) { if (printedDigits + 9 > precision) { availableDigits = 9; break; } append_nine_digits(digits, result + index); index += 9; printedDigits += 9; } else if (digits != 0) { availableDigits = decimalLength9(digits); exp = -(i + 1) * 9 + (int32_t) availableDigits - 1; if (availableDigits > precision) { break; } if (printDecimalPoint) { append_d_digits(availableDigits, digits, result + index); index += availableDigits + 1; // +1 for decimal point } else { result[index++] = (char) ('0' + digits); } printedDigits = availableDigits; availableDigits = 0; } } } const uint32_t maximum = precision - printedDigits; #ifdef RYU_DEBUG printf("availableDigits=%u\n", availableDigits); printf("digits=%u\n", digits); printf("maximum=%u\n", maximum); #endif if (availableDigits == 0) { digits = 0; } uint32_t lastDigit = 0; if (availableDigits > maximum) { for (uint32_t k = 0; k < availableDigits - maximum; ++k) { lastDigit = digits % 10; digits /= 10; } } #ifdef RYU_DEBUG printf("lastDigit=%u\n", lastDigit); #endif // 0 = don't round up; 1 = round up unconditionally; 2 = round up if odd. int roundUp = 0; if (lastDigit != 5) { roundUp = lastDigit > 5; } else { // Is m * 2^e2 * 10^(precision + 1 - exp) integer? // precision was already increased by 1, so we don't need to write + 1 here. const int32_t rexp = (int32_t) precision - exp; const int32_t requiredTwos = -e2 - rexp; bool trailingZeros = requiredTwos <= 0 || (requiredTwos < 60 && multipleOfPowerOf2(m2, (uint32_t) requiredTwos)); if (rexp < 0) { const int32_t requiredFives = -rexp; trailingZeros = trailingZeros && multipleOfPowerOf5(m2, (uint32_t) requiredFives); } roundUp = trailingZeros ? 2 : 1; #ifdef RYU_DEBUG printf("requiredTwos=%d\n", requiredTwos); printf("trailingZeros=%s\n", trailingZeros ? "true" : "false"); #endif } if (printedDigits != 0) { if (digits == 0) { memset(result + index, '0', maximum); } else { append_c_digits(maximum, digits, result + index); } index += maximum; } else { if (printDecimalPoint) { append_d_digits(maximum, digits, result + index); index += maximum + 1; // +1 for decimal point } else { result[index++] = (char) ('0' + digits); } } #ifdef RYU_DEBUG printf("roundUp=%d\n", roundUp); #endif if (roundUp != 0) { int roundIndex = index; while (true) { --roundIndex; char c; if (roundIndex == -1 || (c = result[roundIndex], c == '-')) { result[roundIndex + 1] = '1'; ++exp; break; } if (c == '.') { continue; } else if (c == '9') { result[roundIndex] = '0'; roundUp = 1; continue; } else { if (roundUp == 2 && c % 2 == 0) { break; } result[roundIndex] = c + 1; break; } } } result[index++] = 'e'; if (exp < 0) { result[index++] = '-'; exp = -exp; } else { result[index++] = '+'; } if (exp >= 100) { const int32_t c = exp % 10; memcpy(result + index, DIGIT_TABLE + 2 * (exp / 10), 2); result[index + 2] = (char) ('0' + c); index += 3; } else { memcpy(result + index, DIGIT_TABLE + 2 * exp, 2); index += 2; } return index; } void d2exp_buffered(double d, uint32_t precision, char* result) { const int len = d2exp_buffered_n(d, precision, result); result[len] = '\0'; } char* d2exp(double d, uint32_t precision) { char* const buffer = (char*)malloc(2000); const int index = d2exp_buffered_n(d, precision, buffer); buffer[index] = '\0'; return buffer; }
0
repos/ryu
repos/ryu/ryu/d2s_intrinsics.h
// Copyright 2018 Ulf Adams // // The contents of this file may be used under the terms of the Apache License, // Version 2.0. // // (See accompanying file LICENSE-Apache or copy at // http://www.apache.org/licenses/LICENSE-2.0) // // Alternatively, the contents of this file may be used under the terms of // the Boost Software License, Version 1.0. // (See accompanying file LICENSE-Boost or copy at // https://www.boost.org/LICENSE_1_0.txt) // // Unless required by applicable law or agreed to in writing, this software // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. #ifndef RYU_D2S_INTRINSICS_H #define RYU_D2S_INTRINSICS_H #include <assert.h> #include <stdint.h> // Defines RYU_32_BIT_PLATFORM if applicable. #include "ryu/common.h" // ABSL avoids uint128_t on Win32 even if __SIZEOF_INT128__ is defined. // Let's do the same for now. #if defined(__SIZEOF_INT128__) && !defined(_MSC_VER) && !defined(RYU_ONLY_64_BIT_OPS) #define HAS_UINT128 #elif defined(_MSC_VER) && !defined(RYU_ONLY_64_BIT_OPS) && defined(_M_X64) #define HAS_64_BIT_INTRINSICS #endif #if defined(HAS_UINT128) typedef __uint128_t uint128_t; #endif #if defined(HAS_64_BIT_INTRINSICS) #include <intrin.h> static inline uint64_t umul128(const uint64_t a, const uint64_t b, uint64_t* const productHi) { return _umul128(a, b, productHi); } // Returns the lower 64 bits of (hi*2^64 + lo) >> dist, with 0 < dist < 64. static inline uint64_t shiftright128(const uint64_t lo, const uint64_t hi, const uint32_t dist) { // For the __shiftright128 intrinsic, the shift value is always // modulo 64. // In the current implementation of the double-precision version // of Ryu, the shift value is always < 64. (In the case // RYU_OPTIMIZE_SIZE == 0, the shift value is in the range [49, 58]. // Otherwise in the range [2, 59].) // However, this function is now also called by s2d, which requires supporting // the larger shift range (TODO: what is the actual range?). // Check this here in case a future change requires larger shift // values. In this case this function needs to be adjusted. assert(dist < 64); return __shiftright128(lo, hi, (unsigned char) dist); } #else // defined(HAS_64_BIT_INTRINSICS) static inline uint64_t umul128(const uint64_t a, const uint64_t b, uint64_t* const productHi) { // The casts here help MSVC to avoid calls to the __allmul library function. const uint32_t aLo = (uint32_t)a; const uint32_t aHi = (uint32_t)(a >> 32); const uint32_t bLo = (uint32_t)b; const uint32_t bHi = (uint32_t)(b >> 32); const uint64_t b00 = (uint64_t)aLo * bLo; const uint64_t b01 = (uint64_t)aLo * bHi; const uint64_t b10 = (uint64_t)aHi * bLo; const uint64_t b11 = (uint64_t)aHi * bHi; const uint32_t b00Lo = (uint32_t)b00; const uint32_t b00Hi = (uint32_t)(b00 >> 32); const uint64_t mid1 = b10 + b00Hi; const uint32_t mid1Lo = (uint32_t)(mid1); const uint32_t mid1Hi = (uint32_t)(mid1 >> 32); const uint64_t mid2 = b01 + mid1Lo; const uint32_t mid2Lo = (uint32_t)(mid2); const uint32_t mid2Hi = (uint32_t)(mid2 >> 32); const uint64_t pHi = b11 + mid1Hi + mid2Hi; const uint64_t pLo = ((uint64_t)mid2Lo << 32) | b00Lo; *productHi = pHi; return pLo; } static inline uint64_t shiftright128(const uint64_t lo, const uint64_t hi, const uint32_t dist) { // We don't need to handle the case dist >= 64 here (see above). assert(dist < 64); assert(dist > 0); return (hi << (64 - dist)) | (lo >> dist); } #endif // defined(HAS_64_BIT_INTRINSICS) #if defined(RYU_32_BIT_PLATFORM) // Returns the high 64 bits of the 128-bit product of a and b. static inline uint64_t umulh(const uint64_t a, const uint64_t b) { // Reuse the umul128 implementation. // Optimizers will likely eliminate the instructions used to compute the // low part of the product. uint64_t hi; umul128(a, b, &hi); return hi; } // On 32-bit platforms, compilers typically generate calls to library // functions for 64-bit divisions, even if the divisor is a constant. // // E.g.: // https://bugs.llvm.org/show_bug.cgi?id=37932 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=17958 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37443 // // The functions here perform division-by-constant using multiplications // in the same way as 64-bit compilers would do. // // NB: // The multipliers and shift values are the ones generated by clang x64 // for expressions like x/5, x/10, etc. static inline uint64_t div5(const uint64_t x) { return umulh(x, 0xCCCCCCCCCCCCCCCDu) >> 2; } static inline uint64_t div10(const uint64_t x) { return umulh(x, 0xCCCCCCCCCCCCCCCDu) >> 3; } static inline uint64_t div100(const uint64_t x) { return umulh(x >> 2, 0x28F5C28F5C28F5C3u) >> 2; } static inline uint64_t div1e8(const uint64_t x) { return umulh(x, 0xABCC77118461CEFDu) >> 26; } static inline uint64_t div1e9(const uint64_t x) { return umulh(x >> 9, 0x44B82FA09B5A53u) >> 11; } static inline uint32_t mod1e9(const uint64_t x) { // Avoid 64-bit math as much as possible. // Returning (uint32_t) (x - 1000000000 * div1e9(x)) would // perform 32x64-bit multiplication and 64-bit subtraction. // x and 1000000000 * div1e9(x) are guaranteed to differ by // less than 10^9, so their highest 32 bits must be identical, // so we can truncate both sides to uint32_t before subtracting. // We can also simplify (uint32_t) (1000000000 * div1e9(x)). // We can truncate before multiplying instead of after, as multiplying // the highest 32 bits of div1e9(x) can't affect the lowest 32 bits. return ((uint32_t) x) - 1000000000 * ((uint32_t) div1e9(x)); } #else // defined(RYU_32_BIT_PLATFORM) static inline uint64_t div5(const uint64_t x) { return x / 5; } static inline uint64_t div10(const uint64_t x) { return x / 10; } static inline uint64_t div100(const uint64_t x) { return x / 100; } static inline uint64_t div1e8(const uint64_t x) { return x / 100000000; } static inline uint64_t div1e9(const uint64_t x) { return x / 1000000000; } static inline uint32_t mod1e9(const uint64_t x) { return (uint32_t) (x - 1000000000 * div1e9(x)); } #endif // defined(RYU_32_BIT_PLATFORM) static inline uint32_t pow5Factor(uint64_t value) { const uint64_t m_inv_5 = 14757395258967641293u; // 5 * m_inv_5 = 1 (mod 2^64) const uint64_t n_div_5 = 3689348814741910323u; // #{ n | n = 0 (mod 2^64) } = 2^64 / 5 uint32_t count = 0; for (;;) { assert(value != 0); value *= m_inv_5; if (value > n_div_5) break; ++count; } return count; } // Returns true if value is divisible by 5^p. static inline bool multipleOfPowerOf5(const uint64_t value, const uint32_t p) { // I tried a case distinction on p, but there was no performance difference. return pow5Factor(value) >= p; } // Returns true if value is divisible by 2^p. static inline bool multipleOfPowerOf2(const uint64_t value, const uint32_t p) { assert(value != 0); assert(p < 64); // __builtin_ctzll doesn't appear to be faster here. return (value & ((1ull << p) - 1)) == 0; } // We need a 64x128-bit multiplication and a subsequent 128-bit shift. // Multiplication: // The 64-bit factor is variable and passed in, the 128-bit factor comes // from a lookup table. We know that the 64-bit factor only has 55 // significant bits (i.e., the 9 topmost bits are zeros). The 128-bit // factor only has 124 significant bits (i.e., the 4 topmost bits are // zeros). // Shift: // In principle, the multiplication result requires 55 + 124 = 179 bits to // represent. However, we then shift this value to the right by j, which is // at least j >= 115, so the result is guaranteed to fit into 179 - 115 = 64 // bits. This means that we only need the topmost 64 significant bits of // the 64x128-bit multiplication. // // There are several ways to do this: // 1. Best case: the compiler exposes a 128-bit type. // We perform two 64x64-bit multiplications, add the higher 64 bits of the // lower result to the higher result, and shift by j - 64 bits. // // We explicitly cast from 64-bit to 128-bit, so the compiler can tell // that these are only 64-bit inputs, and can map these to the best // possible sequence of assembly instructions. // x64 machines happen to have matching assembly instructions for // 64x64-bit multiplications and 128-bit shifts. // // 2. Second best case: the compiler exposes intrinsics for the x64 assembly // instructions mentioned in 1. // // 3. We only have 64x64 bit instructions that return the lower 64 bits of // the result, i.e., we have to use plain C. // Our inputs are less than the full width, so we have three options: // a. Ignore this fact and just implement the intrinsics manually. // b. Split both into 31-bit pieces, which guarantees no internal overflow, // but requires extra work upfront (unless we change the lookup table). // c. Split only the first factor into 31-bit pieces, which also guarantees // no internal overflow, but requires extra work since the intermediate // results are not perfectly aligned. #if defined(HAS_UINT128) // Best case: use 128-bit type. static inline uint64_t mulShift64(const uint64_t m, const uint64_t* const mul, const int32_t j) { const uint128_t b0 = ((uint128_t) m) * mul[0]; const uint128_t b2 = ((uint128_t) m) * mul[1]; return (uint64_t) (((b0 >> 64) + b2) >> (j - 64)); } static inline uint64_t mulShiftAll64(const uint64_t m, const uint64_t* const mul, const int32_t j, uint64_t* const vp, uint64_t* const vm, const uint32_t mmShift) { // m <<= 2; // uint128_t b0 = ((uint128_t) m) * mul[0]; // 0 // uint128_t b2 = ((uint128_t) m) * mul[1]; // 64 // // uint128_t hi = (b0 >> 64) + b2; // uint128_t lo = b0 & 0xffffffffffffffffull; // uint128_t factor = (((uint128_t) mul[1]) << 64) + mul[0]; // uint128_t vpLo = lo + (factor << 1); // *vp = (uint64_t) ((hi + (vpLo >> 64)) >> (j - 64)); // uint128_t vmLo = lo - (factor << mmShift); // *vm = (uint64_t) ((hi + (vmLo >> 64) - (((uint128_t) 1ull) << 64)) >> (j - 64)); // return (uint64_t) (hi >> (j - 64)); *vp = mulShift64(4 * m + 2, mul, j); *vm = mulShift64(4 * m - 1 - mmShift, mul, j); return mulShift64(4 * m, mul, j); } #elif defined(HAS_64_BIT_INTRINSICS) static inline uint64_t mulShift64(const uint64_t m, const uint64_t* const mul, const int32_t j) { // m is maximum 55 bits uint64_t high1; // 128 const uint64_t low1 = umul128(m, mul[1], &high1); // 64 uint64_t high0; // 64 umul128(m, mul[0], &high0); // 0 const uint64_t sum = high0 + low1; if (sum < high0) { ++high1; // overflow into high1 } return shiftright128(sum, high1, j - 64); } static inline uint64_t mulShiftAll64(const uint64_t m, const uint64_t* const mul, const int32_t j, uint64_t* const vp, uint64_t* const vm, const uint32_t mmShift) { *vp = mulShift64(4 * m + 2, mul, j); *vm = mulShift64(4 * m - 1 - mmShift, mul, j); return mulShift64(4 * m, mul, j); } #else // !defined(HAS_UINT128) && !defined(HAS_64_BIT_INTRINSICS) static inline uint64_t mulShift64(const uint64_t m, const uint64_t* const mul, const int32_t j) { // m is maximum 55 bits uint64_t high1; // 128 const uint64_t low1 = umul128(m, mul[1], &high1); // 64 uint64_t high0; // 64 umul128(m, mul[0], &high0); // 0 const uint64_t sum = high0 + low1; if (sum < high0) { ++high1; // overflow into high1 } return shiftright128(sum, high1, j - 64); } // This is faster if we don't have a 64x64->128-bit multiplication. static inline uint64_t mulShiftAll64(uint64_t m, const uint64_t* const mul, const int32_t j, uint64_t* const vp, uint64_t* const vm, const uint32_t mmShift) { m <<= 1; // m is maximum 55 bits uint64_t tmp; const uint64_t lo = umul128(m, mul[0], &tmp); uint64_t hi; const uint64_t mid = tmp + umul128(m, mul[1], &hi); hi += mid < tmp; // overflow into hi const uint64_t lo2 = lo + mul[0]; const uint64_t mid2 = mid + mul[1] + (lo2 < lo); const uint64_t hi2 = hi + (mid2 < mid); *vp = shiftright128(mid2, hi2, (uint32_t) (j - 64 - 1)); if (mmShift == 1) { const uint64_t lo3 = lo - mul[0]; const uint64_t mid3 = mid - mul[1] - (lo3 > lo); const uint64_t hi3 = hi - (mid3 > mid); *vm = shiftright128(mid3, hi3, (uint32_t) (j - 64 - 1)); } else { const uint64_t lo3 = lo + lo; const uint64_t mid3 = mid + mid + (lo3 < lo); const uint64_t hi3 = hi + hi + (mid3 < mid); const uint64_t lo4 = lo3 - mul[0]; const uint64_t mid4 = mid3 - mul[1] - (lo4 > lo3); const uint64_t hi4 = hi3 - (mid4 > mid3); *vm = shiftright128(mid4, hi4, (uint32_t) (j - 64)); } return shiftright128(mid, hi, (uint32_t) (j - 64 - 1)); } #endif // HAS_64_BIT_INTRINSICS #endif // RYU_D2S_INTRINSICS_H
0
repos/ryu
repos/ryu/ryu/d2fixed_full_table.h
// Copyright 2018 Ulf Adams // // The contents of this file may be used under the terms of the Apache License, // Version 2.0. // // (See accompanying file LICENSE-Apache or copy at // http://www.apache.org/licenses/LICENSE-2.0) // // Alternatively, the contents of this file may be used under the terms of // the Boost Software License, Version 1.0. // (See accompanying file LICENSE-Boost or copy at // https://www.boost.org/LICENSE_1_0.txt) // // Unless required by applicable law or agreed to in writing, this software // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. #ifndef RYU_D2FIXED_FULL_TABLE_H #define RYU_D2FIXED_FULL_TABLE_H #include <stdint.h> #define TABLE_SIZE 64 static const uint16_t POW10_OFFSET[TABLE_SIZE] = { 0, 2, 5, 8, 12, 16, 21, 26, 32, 39, 46, 54, 62, 71, 80, 90, 100, 111, 122, 134, 146, 159, 173, 187, 202, 217, 233, 249, 266, 283, 301, 319, 338, 357, 377, 397, 418, 440, 462, 485, 508, 532, 556, 581, 606, 632, 658, 685, 712, 740, 769, 798, 828, 858, 889, 920, 952, 984, 1017, 1050, 1084, 1118, 1153, 1188 }; static const uint64_t POW10_SPLIT[1224][3] = { { 1u, 72057594037927936u, 0u }, { 699646928636035157u, 72057594u, 0u }, { 1u, 0u, 256u }, { 11902091922964236229u, 4722366482869u, 0u }, { 6760415703743915872u, 4722u, 0u }, { 1u, 0u, 16777216u }, { 13369850649504950658u, 309485009821345068u, 0u }, { 15151142278969419334u, 309485009u, 0u }, { 1u, 0u, 75511627776u }, { 4635408826454083567u, 9437866644873197963u, 1099u }, { 12367138975830625353u, 20282409603651u, 0u }, { 7555853734021184432u, 20282u, 0u }, { 1u, 0u, 250037927936u }, { 5171444645924616995u, 699646928636035156u, 72057594u }, { 16672297533003297786u, 1329227995784915872u, 0u }, { 14479142226848862515u, 1329227995u, 0u }, { 1u, 0u, 181645213696u }, { 12214193123817091081u, 11902091922964236228u, 114366482869u }, { 16592893013671929435u, 6760415703743915871u, 4722u }, { 4549827147718617003u, 87112285931760u, 0u }, { 5274510003815168971u, 87112u, 0u }, { 1u, 0u, 44724781056u }, { 9794971998307800535u, 13369850649504950657u, 209821345068u }, { 14720142899209240169u, 15151142278969419333u, 309485009u }, { 4300745446091561535u, 5708990770823839524u, 0u }, { 15197156861335443364u, 5708990770u, 0u }, { 1u, 0u, 139251286016u }, { 13484604155038683037u, 4635408826454083566u, 67670423947u }, { 8356963862052375699u, 12367138975830625352u, 58409603651u }, { 5850852848337610021u, 7555853734021184431u, 20282u }, { 2712780827214982050u, 374144419156711u, 0u }, { 7732076577307618052u, 374144u, 0u }, { 1u, 0u, 84280344576u }, { 17296309485351745867u, 5171444645924616994u, 160903807060u }, { 16598859101615853088u, 16672297533003297785u, 219784915872u }, { 7469952526870444257u, 14479142226848862514u, 1329227995u }, { 13531654022114669524u, 6073184580144670117u, 1u }, { 15757609704383306943u, 24519928653u, 0u }, { 9590990814237149590u, 24u, 0u }, { 1u, 0u, 196662132736u }, { 15408590707489433890u, 12214193123817091080u, 95899502532u }, { 18332056844289122710u, 16592893013671929434u, 240246646623u }, { 11114572877353986193u, 4549827147718617002u, 72285931760u }, { 1703393793997526525u, 5274510003815168970u, 87112u }, { 5082852056285196265u, 1606938044258990u, 0u }, { 816434266573722365u, 1606938u, 0u }, { 1u, 0u, 129530986496u }, { 5736523019264798742u, 9794971998307800534u, 69797980545u }, { 10129314776268243339u, 14720142899209240168u, 36233143877u }, { 16511595775483995364u, 4300745446091561534u, 50823839524u }, { 12367293405401453325u, 15197156861335443363u, 5708990770u }, { 16934621733248854291u, 13078571300009428617u, 5u }, { 10278280417769171336u, 105312291668u, 0u }, { 5760764486226151240u, 105u, 0u }, { 1u, 0u, 238731001856u }, { 4128368337188369761u, 13484604155038683036u, 72453031918u }, { 10240941003671005056u, 8356963862052375698u, 175317175368u }, { 17933378316822368251u, 5850852848337610020u, 231147060143u }, { 8346249813075698616u, 2712780827214982049u, 128419156711u }, { 15906203609160902695u, 7732076577307618051u, 374144u }, { 14525607416135386328u, 6901746346790563u, 0u }, { 6397156777364256320u, 6901746u, 0u }, { 1u, 0u, 34937634816u }, { 16798760952716600048u, 17296309485351745866u, 249899825954u }, { 2419982808370854967u, 16598859101615853087u, 50404946937u }, { 2922947087773078956u, 7469952526870444256u, 165733552434u }, { 15419220167069510190u, 13531654022114669523u, 77854221733u }, { 3452124642157173416u, 15757609704383306942u, 24519928653u }, { 5979700067267186899u, 9590990814237149589u, 24u }, { 4913998146922579597u, 452312848583u, 0u }, { 5771037749337678924u, 452u, 0u }, { 1u, 0u, 8835301376u }, { 3464734175350698519u, 15408590707489433889u, 90993782792u }, { 9334527711335850125u, 18332056844289122709u, 170602522202u }, { 7269882896518450106u, 11114572877353986192u, 202092341162u }, { 1372511258182263196u, 1703393793997526524u, 174275541962u }, { 7571228438575951046u, 5082852056285196264u, 26044258990u }, { 2992506536646070406u, 816434266573722364u, 1606938u }, { 524517896824344606u, 29642774844752946u, 0u }, { 15582941400898702773u, 29642774u, 0u }, { 1u, 0u, 214310977536u }, { 3846112492507251066u, 5736523019264798741u, 104549111254u }, { 16681117750123089487u, 10129314776268243338u, 62895095400u }, { 14986314536556547267u, 16511595775483995363u, 163670432318u }, { 2573712825027107389u, 12367293405401453324u, 137918027683u }, { 7504855874008324928u, 16934621733248854290u, 84557186697u }, { 9572138030626879787u, 10278280417769171335u, 105312291668u }, { 8520676959353394843u, 5760764486226151239u, 105u }, { 13448984662897903496u, 1942668892225u, 0u }, { 12338883700918130648u, 1942u, 0u }, { 1u, 0u, 156223799296u }, { 2517285787892561600u, 4128368337188369760u, 146555162524u }, { 4338831817635138103u, 10240941003671005055u, 36972170386u }, { 1561495325934523196u, 17933378316822368250u, 161452451108u }, { 12262635050079398786u, 8346249813075698615u, 3862277025u }, { 11144065765517284188u, 15906203609160902694u, 163787434755u }, { 1212260522471875711u, 14525607416135386327u, 242346790563u }, { 9695352922247418869u, 6397156777364256319u, 6901746u }, { 7227025834627242948u, 127314748520905380u, 0u }, { 9609008238705447829u, 127314748u, 0u }, { 1u, 0u, 74910662656u }, { 3609144142396852269u, 16798760952716600047u, 31131187530u }, { 11568848377382068865u, 2419982808370854966u, 224158453279u }, { 10068303578029323957u, 2922947087773078955u, 211835877600u }, { 11645070846862630231u, 15419220167069510189u, 190187140051u }, { 12449386705878485055u, 3452124642157173415u, 149324160190u }, { 15025619323517318418u, 5979700067267186898u, 199266388373u }, { 14996237555047131272u, 4913998146922579596u, 196312848583u }, { 10211005638256058413u, 5771037749337678923u, 452u }, { 1014743503555840530u, 8343699359066u, 0u }, { 12900897707145290678u, 8343u, 0u }, { 1u, 0u, 33187823616u }, { 4718003016239473662u, 3464734175350698518u, 149506025761u }, { 14865830648693666725u, 9334527711335850124u, 144394101141u }, { 14754517212823091778u, 7269882896518450105u, 252074403984u }, { 11113946551474911901u, 1372511258182263195u, 232410437116u }, { 1963520352638130630u, 7571228438575951045u, 252162224104u }, { 13342587341404964200u, 2992506536646070405u, 50028434172u }, { 6240392545013573291u, 524517896824344605u, 22844752946u }, { 14377490861349714758u, 15582941400898702772u, 29642774u }, { 1717863312631397839u, 546812681195752981u, 0u }, { 3611005143890591770u, 546812681u, 0u }, { 1u, 0u, 21208498176u }, { 13168252824351245504u, 3846112492507251065u, 138904285205u }, { 735883891883379688u, 16681117750123089486u, 227812409738u }, { 10609203866866106404u, 14986314536556547266u, 12139521251u }, { 12358191111890306470u, 2573712825027107388u, 18406839052u }, { 15229916368406413528u, 7504855874008324927u, 135518906642u }, { 7241424335568075942u, 9572138030626879786u, 71461906823u }, { 6049715868779871913u, 8520676959353394842u, 65729070919u }, { 2000548404719336762u, 13448984662897903495u, 150668892225u }, { 1410974761895205301u, 12338883700918130647u, 1942u }, { 16000132467694084868u, 35835915874844u, 0u }, { 16894908866816792556u, 35835u, 0u }, { 1u, 0u, 96136462336u }, { 589096329272056762u, 2517285787892561599u, 127235208544u }, { 7097729792403256904u, 4338831817635138102u, 250084648831u }, { 8553736750439287020u, 1561495325934523195u, 183664758778u }, { 2114152625261065696u, 12262635050079398785u, 38604121015u }, { 9817523680007641224u, 11144065765517284187u, 215065716774u }, { 13047215537500048015u, 1212260522471875710u, 63525586135u }, { 16755544192002345880u, 9695352922247418868u, 164391777855u }, { 6930119832670648356u, 7227025834627242947u, 60520905380u }, { 14560698131901886167u, 9609008238705447828u, 127314748u }, { 16408020927503338035u, 2348542582773833227u, 0u }, { 14274703510609809116u, 2348542582u, 0u }, { 1u, 0u, 239195652096u }, { 16428432973129962470u, 3609144142396852268u, 54627148527u }, { 3721112279790863774u, 11568848377382068864u, 171545803830u }, { 18032764903259620753u, 10068303578029323956u, 45631280555u }, { 18058455550468776079u, 11645070846862630230u, 167674882605u }, { 15692090139033993190u, 12449386705878485054u, 210814540455u }, { 389416944300619393u, 15025619323517318417u, 140812947666u }, { 12009691357260487293u, 14996237555047131271u, 75553539724u }, { 13494259174449809900u, 10211005638256058412u, 90055009355u }, { 18288583400616279877u, 1014743503555840529u, 151699359066u }, { 7216107869057472u, 12900897707145290677u, 8343u }, { 17237061291959073878u, 153914086704665u, 0u }, { 1599418782488783273u, 153914u, 0u }, { 1u, 0u, 22255763456u }, { 9565464987240335777u, 4718003016239473661u, 140805878294u }, { 857713933775880687u, 14865830648693666724u, 185799843980u }, { 4621617820081363356u, 14754517212823091777u, 155602488249u }, { 9630162611715632528u, 11113946551474911900u, 197106442651u }, { 9283986497984645815u, 1963520352638130629u, 133723303109u }, { 8981807745082630996u, 13342587341404964199u, 29338292357u }, { 18350140531565934622u, 6240392545013573290u, 180779405341u }, { 4411619033127524143u, 14377490861349714757u, 21093125556u }, { 1852297584111266889u, 1717863312631397838u, 9195752981u }, { 11746243463811666096u, 3611005143890591769u, 546812681u }, { 6335244004343789147u, 10086913586276986678u, 0u }, { 5109502367228239844u, 10086913586u, 0u }, { 1603272682579847821u, 10u, 0u }, { 1u, 0u, 121713852416u }, { 6609546910952910052u, 13168252824351245503u, 78039892345u }, { 3911171343112928288u, 735883891883379687u, 194575126094u }, { 5254510615100863555u, 10609203866866106403u, 60669938882u }, { 3881927570803887650u, 12358191111890306469u, 63825615420u }, { 6379348759607163190u, 15229916368406413527u, 42392558399u }, { 14595733737222406466u, 7241424335568075941u, 154327955754u }, { 14670223432002373542u, 6049715868779871912u, 135108449946u }, { 4045087795619708513u, 2000548404719336761u, 215076489095u }, { 12598467307137142718u, 1410974761895205300u, 28867368919u }, { 734704388050777108u, 16000132467694084867u, 251915874844u }, { 5682201693687285822u, 16894908866816792555u, 35835u }, { 11048712694145438788u, 661055968790248u, 0u }, { 17871025777010319485u, 661055u, 0u }, { 1u, 0u, 191031934976u }, { 15268761435931663695u, 589096329272056761u, 54384768703u }, { 5016238054648555438u, 7097729792403256903u, 59463698998u }, { 14236047313993899750u, 8553736750439287019u, 129114608443u }, { 6957759675154690848u, 2114152625261065695u, 91532209025u }, { 18439367135478514473u, 9817523680007641223u, 126707290971u }, { 8539004472540641041u, 13047215537500048014u, 244908319870u }, { 1908462039431738399u, 16755544192002345879u, 195375682548u }, { 714690453250792146u, 6930119832670648355u, 148789337027u }, { 13782189447673929633u, 14560698131901886166u, 11889480596u }, { 3584742913798803164u, 16408020927503338034u, 118773833227u }, { 4347581515245125291u, 14274703510609809115u, 2348542582u }, { 16836742268156371392u, 6429475823218628948u, 2u }, { 11764082328865615308u, 43322963970u, 0u }, { 5957633711383291746u, 43u, 0u }, { 1u, 0u, 44890587136u }, { 9917186842884466953u, 16428432973129962469u, 128201721900u }, { 4751011869809829335u, 3721112279790863773u, 180977558144u }, { 11068497969931435029u, 18032764903259620752u, 86978950836u }, { 17118056985122509954u, 18058455550468776078u, 62850669910u }, { 14607066080907684459u, 15692090139033993189u, 17021110334u }, { 11768892370493391107u, 389416944300619392u, 135651046673u }, { 4043396447647747170u, 12009691357260487292u, 44731525255u }, { 1670341095362518057u, 13494259174449809899u, 17991426092u }, { 3190817644167043165u, 18288583400616279876u, 181000391185u }, { 10425820027224322486u, 7216107869057471u, 25934422965u }, { 13139964660506311565u, 17237061291959073877u, 58086704665u }, { 2297772885416059937u, 1599418782488783272u, 153914u }, { 7677687919964523763u, 2839213766779714u, 0u }, { 14144589152747892828u, 2839213u, 0u }, { 1u, 0u, 253518544896u }, { 17069730341503660290u, 9565464987240335776u, 164046496765u }, { 18167423787163077107u, 857713933775880686u, 65250538404u }, { 3765746945827805904u, 4621617820081363355u, 156522052161u }, { 10241734342430761691u, 9630162611715632527u, 197503285916u }, { 13345717282537140784u, 9283986497984645814u, 103486904773u }, { 9313926784816939953u, 8981807745082630995u, 170994763111u }, { 550974205049535019u, 18350140531565934621u, 69239154346u }, { 4494692285504086222u, 4411619033127524142u, 206100413253u }, { 1134308559863725587u, 1852297584111266888u, 25636765134u }, { 17587558045116130233u, 11746243463811666095u, 54343434265u }, { 9817142032346161594u, 6335244004343789146u, 50276986678u }, { 6071944935834172568u, 5109502367228239843u, 10086913586u }, { 11564168293299416955u, 1603272682579847820u, 10u }, { 12458266507226064437u, 186070713419u, 0u }, { 1304432355328256915u, 186u, 0u }, { 1u, 0u, 191358304256u }, { 15946798815542087355u, 6609546910952910051u, 231212025023u }, { 12082566083831286138u, 3911171343112928287u, 35284847591u }, { 11449623684706196411u, 5254510615100863554u, 165210439715u }, { 17518743620362604446u, 3881927570803887649u, 215345825189u }, { 9451061563087633805u, 6379348759607163189u, 165791236311u }, { 13191114787623314926u, 14595733737222406465u, 168795274405u }, { 8367349876734474799u, 14670223432002373541u, 57219284648u }, { 6544253801674393507u, 4045087795619708512u, 180682964281u }, { 16113906253336597498u, 12598467307137142717u, 3039828404u }, { 10294087136797312392u, 734704388050777107u, 235308032771u }, { 9127173070014462803u, 5682201693687285821u, 232598951915u }, { 16266900839595484952u, 11048712694145438787u, 63968790248u }, { 3299745387370952632u, 17871025777010319484u, 661055u }, { 12061115182604399189u, 12194330274671844u, 0u }, { 5066801222582989646u, 12194330u, 0u }, { 1u, 0u, 185827721216u }, { 7568423425299591513u, 15268761435931663694u, 71271930809u }, { 16561505984665207377u, 5016238054648555437u, 235771737671u }, { 4329114621856906245u, 14236047313993899749u, 223377180907u }, { 1477500474861899139u, 6957759675154690847u, 135999600095u }, { 16891579639263969684u, 18439367135478514472u, 142462900359u }, { 4684451357140027420u, 8539004472540641040u, 151103457934u }, { 14727186580409080709u, 1908462039431738398u, 35038743447u }, { 15864176859687308834u, 714690453250792145u, 214747133987u }, { 1755486942842684438u, 13782189447673929632u, 50194329302u }, { 17417077516652710041u, 3584742913798803163u, 219235682866u }, { 4290982361913532783u, 4347581515245125290u, 84912721627u }, { 11826659981004351409u, 16836742268156371391u, 2637732180u }, { 932930645678090820u, 11764082328865615307u, 43322963970u }, { 12707792781328052617u, 5957633711383291745u, 43u }, { 16491596426880311906u, 799167628880u, 0u }, { 3092207065214166010u, 799u, 0u }, { 1u, 0u, 229537611776u }, { 8142946531605512550u, 9917186842884466952u, 157257552869u }, { 5328402096432654515u, 4751011869809829334u, 144600024477u }, { 1932004361303814512u, 11068497969931435028u, 142927971728u }, { 2511477647985517771u, 17118056985122509953u, 229791850638u }, { 17451375493324716694u, 14607066080907684458u, 128637992933u }, { 9489266854478998489u, 11768892370493391106u, 124219192960u }, { 8803053132063235169u, 4043396447647747169u, 235090549372u }, { 16198682197142616773u, 1670341095362518056u, 68172974571u }, { 13696242485403414202u, 3190817644167043164u, 191565184836u }, { 16409082426079859931u, 10425820027224322485u, 85712318911u }, { 11653410736879597610u, 13139964660506311564u, 168124562517u }, { 13589514120653213261u, 2297772885416059936u, 66416208296u }, { 8032934885905905774u, 7677687919964523762u, 173766779714u }, { 2753021350129449273u, 14144589152747892827u, 2839213u }, { 16974897459201404133u, 52374249726338269u, 0u }, { 13398576176159101589u, 52374249u, 0u }, { 1u, 0u, 160925351936u }, { 10284586955251725351u, 17069730341503660289u, 238984858016u }, { 5294476488634150891u, 18167423787163077106u, 155204141550u }, { 15833244538135063323u, 3765746945827805903u, 143555205531u }, { 10348512742273116664u, 10241734342430761690u, 182723472783u }, { 13658504610142595663u, 13345717282537140783u, 83504908982u }, { 11956362239240850266u, 9313926784816939952u, 29029868371u }, { 13415901703662731781u, 550974205049535018u, 46243657757u }, { 5161774027546852762u, 4494692285504086221u, 72061490990u }, { 15274384838790587711u, 1134308559863725586u, 175953423432u }, { 14233354597679374929u, 17587558045116130232u, 90532188335u }, { 4274656492162486921u, 9817142032346161593u, 227329160794u }, { 12040276505541795046u, 6071944935834172567u, 140626894819u }, { 13238307206256765457u, 11564168293299416954u, 75675363980u }, { 12850161204172713271u, 12458266507226064436u, 186070713419u }, { 17531777095001445154u, 1304432355328256914u, 186u }, { 5623628114515245990u, 3432398830065u, 0u }, { 7357116143579573377u, 3432u, 0u }, { 1u, 0u, 227864477696u }, { 3555734177475596582u, 15946798815542087354u, 31654997219u }, { 14001876724756424382u, 12082566083831286137u, 66620685343u }, { 18159905057231476140u, 11449623684706196410u, 33949692994u }, { 5585207679308509467u, 17518743620362604445u, 53512343073u }, { 13948697622866724672u, 9451061563087633804u, 65715091765u }, { 9807691927739036432u, 13191114787623314925u, 165453594945u }, { 15818010096140820918u, 8367349876734474798u, 96354764709u }, { 5629845624785010943u, 6544253801674393506u, 189873536608u }, { 9517635131137734707u, 16113906253336597497u, 19558043581u }, { 619338244618780585u, 10294087136797312391u, 61494785043u }, { 11632367007491958899u, 9127173070014462802u, 67881830461u }, { 12083314261009739916u, 16266900839595484951u, 124178879555u }, { 16880538609458881650u, 3299745387370952631u, 228653834364u }, { 17404223674486504228u, 12061115182604399188u, 26274671844u }, { 7089067015287185433u, 5066801222582989645u, 12194330u }, { 2592264228029443648u, 224945689727159819u, 0u }, { 13413731084370224440u, 224945689u, 0u }, { 1u, 0u, 78410285056u }, { 9323915941641553425u, 7568423425299591512u, 173897801038u }, { 12155831029092699564u, 16561505984665207376u, 229234681773u }, { 17397171276588232676u, 4329114621856906244u, 31080095461u }, { 11874560617553253769u, 1477500474861899138u, 40915694367u }, { 13444839516837727954u, 16891579639263969683u, 16253944616u }, { 16994416043584590671u, 4684451357140027419u, 30798362384u }, { 15879694502877015730u, 14727186580409080708u, 209859998750u }, { 4234647645735263359u, 15864176859687308833u, 160095165137u }, { 7978589901512919496u, 1755486942842684437u, 219944181664u }, { 6114237175390859894u, 17417077516652710040u, 170232614619u }, { 8658612872088282708u, 4290982361913532782u, 191641124522u }, { 10253813330683324853u, 11826659981004351408u, 203050574271u }, { 13289465061747830991u, 932930645678090819u, 97688890827u }, { 4123165538545565412u, 12707792781328052616u, 80894011233u }, { 7846417485927038481u, 16491596426880311905u, 31167628880u }, { 10562273346358018864u, 3092207065214166009u, 799u }, { 2691512658346619120u, 14742040721959u, 0u }, { 751187558544605998u, 14742u, 0u }, { 1u, 0u, 8441430016u }, { 3757709791947931308u, 8142946531605512549u, 214288853256u }, { 3452755398462519465u, 5328402096432654514u, 20104734166u }, { 3105818720159874523u, 1932004361303814511u, 129136147476u }, { 16859138458894499364u, 2511477647985517770u, 106946040961u }, { 12271894740606233755u, 17451375493324716693u, 2514414186u }, { 5429638071845793701u, 9489266854478998488u, 97477214466u }, { 145278150038876889u, 8803053132063235168u, 40878132321u }, { 9050266019724932450u, 16198682197142616772u, 92742474792u }, { 11907016253451490866u, 13696242485403414201u, 181889538140u }, { 2472757296513770735u, 16409082426079859930u, 140631732661u }, { 10558733798178239360u, 11653410736879597609u, 32736689036u }, { 15917322570831255850u, 13589514120653213260u, 242435466272u }, { 12254334656791355238u, 8032934885905905773u, 91149241586u }, { 7869542424662730262u, 2753021350129449272u, 221920211035u }, { 1378558986933000253u, 16974897459201404132u, 233726338269u }, { 13521405041909411105u, 13398576176159101588u, 52374249u }, { 3206744593298092012u, 966134380754314586u, 0u }, { 13914648122214918505u, 966134380u, 0u }, { 1u, 0u, 1557528576u }, { 1235541077112082496u, 10284586955251725350u, 242287014145u }, { 12014985518315533846u, 5294476488634150890u, 207858321906u }, { 1561535086344155741u, 15833244538135063322u, 218560993999u }, { 12761747276316224577u, 10348512742273116663u, 47740429018u }, { 9745594781103966137u, 13658504610142595662u, 176648155695u }, { 17514238702394846785u, 11956362239240850265u, 42727277488u }, { 2428898913707151713u, 13415901703662731780u, 205279820330u }, { 71666709959904945u, 5161774027546852761u, 18828026061u }, { 4049380135452919193u, 15274384838790587710u, 184771591698u }, { 18422240861777453733u, 14233354597679374928u, 185231729592u }, { 2914504416394425696u, 4274656492162486920u, 151652704697u }, { 12721377795748989418u, 12040276505541795045u, 122717650071u }, { 2626074459217717422u, 13238307206256765456u, 52696608634u }, { 4261529925046307655u, 12850161204172713270u, 146950399540u }, { 11536038685430305586u, 17531777095001445153u, 241304857490u }, { 12555757789435162768u, 5623628114515245989u, 104398830065u }, { 11905178684546080059u, 7357116143579573376u, 3432u }, { 14032797718924543051u, 63316582777114u, 0u }, { 10750340288005853484u, 63316u, 0u }, { 1u, 0u, 186192756736u }, { 9660290106216358253u, 3555734177475596581u, 121759043258u }, { 14820142034615351103u, 14001876724756424381u, 186984450425u }, { 12674041783707777619u, 18159905057231476139u, 157302774714u }, { 15386686816442679994u, 5585207679308509466u, 140756160413u }, { 5679510383719146248u, 13948697622866724671u, 237531676044u }, { 1391101719248678506u, 9807691927739036431u, 46857496045u }, { 3364596672173710517u, 15818010096140820917u, 162305194542u }, { 11276509210104319732u, 5629845624785010942u, 249515952034u }, { 5316312656902630164u, 9517635131137734706u, 135033574393u }, { 17470981304473644647u, 619338244618780584u, 82630591879u }, { 7373293636384920591u, 11632367007491958898u, 23655037778u }, { 7616810902585191937u, 12083314261009739915u, 183915095831u }, { 12740295655921903924u, 16880538609458881649u, 84943484855u }, { 18366635945916526940u, 17404223674486504227u, 77384299092u }, { 4472171448243407067u, 7089067015287185432u, 11140526925u }, { 229592460858185629u, 2592264228029443647u, 25727159819u }, { 12749672866417114996u, 13413731084370224439u, 224945689u }, { 9452256722867098693u, 4149515568880992958u, 0u }, { 16251451636418604634u, 4149515568u, 0u }, { 1u, 0u, 88505450496u }, { 4515791283442995454u, 9323915941641553424u, 80658968920u }, { 13306155670047701346u, 12155831029092699563u, 4943102544u }, { 4456930152933417601u, 17397171276588232675u, 130643721220u }, { 9089157128546489637u, 11874560617553253768u, 147728846210u }, { 12437332180345515840u, 13444839516837727953u, 27921269139u }, { 3433060408790452524u, 16994416043584590670u, 132860839963u }, { 8275594526021936172u, 15879694502877015729u, 33229560708u }, { 3846512444641107689u, 4234647645735263358u, 21432520225u }, { 6210962618469046250u, 7978589901512919495u, 152331453461u }, { 7272858906616296575u, 6114237175390859893u, 110469384344u }, { 3710743300451225347u, 8658612872088282707u, 176555860334u }, { 6424677242672030600u, 10253813330683324852u, 67720423344u }, { 11485842256170301862u, 13289465061747830990u, 136223517251u }, { 7355797963557024308u, 4123165538545565411u, 97425355144u }, { 6358188982569427273u, 7846417485927038480u, 249572581985u }, { 12475094728768767402u, 10562273346358018863u, 39145907193u }, { 17288154837907896183u, 2691512658346619119u, 150040721959u }, { 2983850577727105262u, 751187558544605997u, 14742u }, { 13918604635001185935u, 271942652322184u, 0u }, { 12033220395769876327u, 271942u, 0u }, { 1u, 0u, 101203705856u }, { 5782377197813462997u, 3757709791947931307u, 178187174245u }, { 17732139848231399226u, 3452755398462519464u, 111168366770u }, { 3628839527415562921u, 3105818720159874522u, 202913935727u }, { 3188692267613601004u, 16859138458894499363u, 149665260746u }, { 5168130193478377352u, 12271894740606233754u, 216294341269u }, { 12556227529405091290u, 5429638071845793700u, 96007875544u }, { 15087090312791441192u, 145278150038876888u, 196490615904u }, { 10281804758610642494u, 9050266019724932449u, 185645480644u }, { 14238177586158586580u, 11907016253451490865u, 218134048441u }, { 7107927498217678128u, 2472757296513770734u, 41572390106u }, { 3845814658485364450u, 10558733798178239359u, 76862879785u }, { 714293333681725946u, 15917322570831255849u, 109664308812u }, { 16766172658649116982u, 12254334656791355237u, 56426608749u }, { 812461421432632215u, 7869542424662730261u, 228074731832u }, { 15218024718633799196u, 1378558986933000252u, 148732996836u }, { 8110797782612805146u, 13521405041909411104u, 90173837972u }, { 15941193964933529227u, 3206744593298092011u, 108754314586u }, { 14144280602323277933u, 13914648122214918504u, 966134380u }, { 15072402647813125245u, 17822033662586700072u, 0u }, { 10822706091283369889u, 17822033662u, 0u }, { 15163844593710966731u, 17u, 0u }, { 1u, 0u, 38066978816u }, { 2408529687792073670u, 1235541077112082495u, 234651333670u }, { 3980682212356510808u, 12014985518315533845u, 26084650986u }, { 4202670442792148519u, 1561535086344155740u, 247691815706u }, { 9419583343154651922u, 12761747276316224576u, 78528309751u }, { 16359166491570434575u, 9745594781103966136u, 89949448782u }, { 12567727056384237385u, 17514238702394846784u, 4131670873u }, { 2068388267923286639u, 2428898913707151712u, 153003885060u }, { 5689135844565021196u, 71666709959904944u, 62219517337u }, { 3104061965171139313u, 4049380135452919192u, 80998671678u }, { 7955173880156328016u, 18422240861777453732u, 136157995600u }, { 1445179403240833754u, 2914504416394425695u, 229689627272u }, { 12538201164459126715u, 12721377795748989417u, 16142359781u }, { 7580606719088482667u, 2626074459217717421u, 54231018000u }, { 8168318283218819755u, 4261529925046307654u, 33625369910u }, { 5249615277755961676u, 11536038685430305585u, 165680648993u }, { 6312997372068219831u, 12555757789435162767u, 128645381029u }, { 9183815417025176703u, 11905178684546080058u, 26760719488u }, { 10683849953373876937u, 14032797718924543050u, 84582777114u }, { 17175012155615667568u, 10750340288005853483u, 63316u }, { 18003508288378896912u, 1167984798111281u, 0u }, { 14722554560950996951u, 1167984u, 0u }, { 1u, 0u, 37523685376u }, { 15059324482416394930u, 9660290106216358252u, 189803401509u }, { 4134778595813308312u, 14820142034615351102u, 171687061181u }, { 16321118342639660948u, 12674041783707777618u, 26834113963u }, { 1523550293123468805u, 15386686816442679993u, 63307886874u }, { 8016371634569878509u, 5679510383719146247u, 15075411775u }, { 9884220139611134110u, 1391101719248678505u, 181182395151u }, { 7218073002727840414u, 3364596672173710516u, 254611300789u }, { 16062235669481359233u, 11276509210104319731u, 50288197886u }, { 15558048660560338002u, 5316312656902630163u, 168947103794u }, { 8394398745765058609u, 17470981304473644646u, 114399707048u }, { 5693296366442904274u, 7373293636384920590u, 139412908146u }, { 11783494675061161358u, 7616810902585191936u, 113690652811u }, { 13377293110865447894u, 12740295655921903923u, 35995657329u }, { 12840734051093062130u, 18366635945916526939u, 24242436899u }, { 7009868331566697505u, 4472171448243407066u, 63012446232u }, { 5019690705031194477u, 229592460858185628u, 55691161151u }, { 8608277240439804984u, 12749672866417114995u, 190512407863u }, { 12172482590657749222u, 9452256722867098692u, 48880992958u }, { 16613484892678771990u, 16251451636418604633u, 4149515568u }, { 5721488662757049244u, 2758075434182769113u, 4u }, { 386931106438877039u, 76545051729u, 0u }, { 10054429752182825659u, 76u, 0u }, { 1u, 0u, 16244801536u }, { 8634592106137071313u, 4515791283442995453u, 171721328144u }, { 12626356501369830731u, 13306155670047701345u, 227241610667u }, { 4803333258178976933u, 4456930152933417600u, 136492724195u }, { 13613083223558209297u, 9089157128546489636u, 209674229128u }, { 16106967997237446989u, 12437332180345515839u, 78186106577u }, { 14832921244380020170u, 3433060408790452523u, 177448620878u }, { 13774024637717231397u, 8275594526021936171u, 126208519857u }, { 9673012968505228885u, 3846512444641107688u, 199336696958u }, { 5391832334264815667u, 6210962618469046249u, 117394262471u }, { 16514436292632703088u, 7272858906616296574u, 83201159797u }, { 12025036352783454153u, 3710743300451225346u, 180348282451u }, { 7059867105311401050u, 6424677242672030599u, 206622648756u }, { 12769210631552594670u, 11485842256170301861u, 227398758606u }, { 8328873878884556145u, 7355797963557024307u, 16344678115u }, { 1016565892414238685u, 6358188982569427272u, 47676276240u }, { 9662978461927250281u, 12475094728768767401u, 239937192751u }, { 13729967277551868112u, 17288154837907896182u, 45161754863u }, { 6371593776693359475u, 2983850577727105261u, 136754529069u }, { 17617208110845643245u, 13918604635001185934u, 70652322184u }, { 14960960225633086797u, 12033220395769876326u, 271942u }, { 12090634301321662558u, 5016456510113118u, 0u }, { 9409926148478635503u, 5016456u, 0u }, { 1u, 0u, 171313463296u }, { 4307062684900157136u, 5782377197813462996u, 168961261227u }, { 15300759383869911853u, 17732139848231399225u, 218196719784u }, { 16007534237643445447u, 3628839527415562920u, 35172859354u }, { 7138502295759677634u, 3188692267613601003u, 154280164899u }, { 8218537071653683708u, 5168130193478377351u, 164680674458u }, { 2254219416760329296u, 12556227529405091289u, 216817872804u }, { 3057410459568460683u, 15087090312791441191u, 97557377752u }, { 8217810929938874370u, 10281804758610642493u, 49771853153u }, { 11741126472498340929u, 14238177586158586579u, 238385321521u }, { 1175325363726654805u, 7107927498217678127u, 127208482030u }, { 9428843070696730900u, 3845814658485364449u, 41038721919u }, { 12662500978715131896u, 714293333681725945u, 101908896041u }, { 6443045597035184564u, 16766172658649116981u, 21044043621u }, { 1921385512639171183u, 812461421432632214u, 60824970773u }, { 10469475094355551399u, 15218024718633799195u, 32439687228u }, { 14679174489076953574u, 8110797782612805145u, 235864173856u }, { 11853074234719825644u, 15941193964933529226u, 104766762987u }, { 8270896886596139124u, 14144280602323277932u, 40817076584u }, { 16532667046659118126u, 15072402647813125244u, 254586700072u }, { 148341279888833483u, 10822706091283369888u, 17822033662u }, { 10364629296397276041u, 15163844593710966730u, 17u }, { 14265682585545771671u, 328758493846u, 0u }, { 13991741872911347878u, 328u, 0u }, { 1u, 0u, 63130566656u }, { 14029045786848724433u, 2408529687792073669u, 21215793215u }, { 4005878521026842341u, 3980682212356510807u, 92227827221u }, { 3428326338640386488u, 4202670442792148518u, 64510636636u }, { 1010001558294829380u, 9419583343154651921u, 184886832192u }, { 2012063724327403418u, 16359166491570434574u, 64681297848u }, { 10997154538851372612u, 12567727056384237384u, 96112127552u }, { 1917749645489607898u, 2068388267923286638u, 176308408672u }, { 9763872523711218805u, 5689135844565021195u, 152168271536u }, { 15875699078454059311u, 3104061965171139312u, 164431250840u }, { 10966529452671276106u, 7955173880156328015u, 95078343332u }, { 18073244132105736913u, 1445179403240833753u, 233679697247u }, { 4435241176994913173u, 12538201164459126714u, 173410945513u }, { 5464400086219074323u, 7580606719088482666u, 70442805421u }, { 2445909179323258812u, 8168318283218819754u, 49284582214u }, { 873962058644121211u, 5249615277755961675u, 143342228273u }, { 16675872194112650857u, 6312997372068219830u, 58497855631u }, { 10680102689274800355u, 9183815417025176702u, 74579172666u }, { 2370498083108897524u, 10683849953373876936u, 43931059274u }, { 15354400521451334666u, 17175012155615667567u, 49975972139u }, { 259991949657381021u, 18003508288378896911u, 112798111281u }, { 10335286558772966917u, 14722554560950996950u, 1167984u }, { 16337526653906757263u, 21545516652742137u, 0u }, { 12040967163702784894u, 21545516u, 0u }, { 1u, 0u, 108816367616u }, { 3373309160242342187u, 15059324482416394929u, 62224146796u }, { 13639841054510584221u, 4134778595813308311u, 82884769598u }, { 15898855427739708031u, 16321118342639660947u, 185082591826u }, { 4544387940067005419u, 1523550293123468804u, 7434568377u }, { 5281598644835398575u, 8016371634569878508u, 105535824647u }, { 13675642405083408835u, 9884220139611134109u, 180391292521u }, { 3973392623768015721u, 7218073002727840413u, 243870735540u }, { 4491285101509114191u, 16062235669481359232u, 19843403507u }, { 15002304272810270500u, 15558048660560338001u, 102455061267u }, { 17325098540619893468u, 8394398745765058608u, 14308634214u }, { 1137212864974584822u, 5693296366442904273u, 638784526u }, { 2619406097224859078u, 11783494675061161357u, 51725184512u }, { 8281347529729293732u, 13377293110865447893u, 91696097587u }, { 11344719666795450104u, 12840734051093062129u, 218380005723u }, { 17283870506679425783u, 7009868331566697504u, 156272117978u }, { 11054210518010603775u, 5019690705031194476u, 115466655644u }, { 6399455551799092885u, 8608277240439804983u, 68659871603u }, { 12930529916573967170u, 12172482590657749221u, 89900618820u }, { 14550097052337552404u, 16613484892678771989u, 217310162521u }, { 12487632712206414748u, 5721488662757049243u, 81020975577u }, { 5791017277843595715u, 386931106438877038u, 76545051729u }, { 10227264183449036113u, 10054429752182825658u, 76u }, { 2006055278511721441u, 1412006979354u, 0u }, { 128746359043876333u, 1412u, 0u }, { 1u, 0u, 253468082176u }, { 7408146306870995754u, 8634592106137071312u, 97684476157u }, { 8299024588195267962u, 12626356501369830730u, 128260389217u }, { 1497052939192040881u, 4803333258178976932u, 36737966720u }, { 16771714264265803747u, 13613083223558209296u, 63873160484u }, { 142988846654429432u, 16106967997237446988u, 43804094271u }, { 11839838367716104145u, 14832921244380020169u, 43746691371u }, { 6019646776647679765u, 13774024637717231396u, 232524375083u }, { 4611972391702034948u, 9673012968505228884u, 233292291816u }, { 16447182322205429545u, 5391832334264815666u, 126895249385u }, { 2113477168726764245u, 16514436292632703087u, 2651878526u }, { 3536261187802311516u, 12025036352783454152u, 135382716162u }, { 18444381860986709854u, 7059867105311401049u, 165692220295u }, { 4734315730275909838u, 12769210631552594669u, 51451509157u }, { 9974936316849658174u, 8328873878884556144u, 72055108147u }, { 11864423681540657642u, 1016565892414238684u, 169523831112u }, { 8207245621417902667u, 9662978461927250280u, 118744303017u }, { 7992526918695295028u, 13729967277551868111u, 237345404790u }, { 8679354522130259987u, 6371593776693359474u, 142955030765u }, { 6065763799692166461u, 17617208110845643244u, 102811035278u }, { 18143341109049024976u, 14960960225633086796u, 94655434598u }, { 15242492331283350570u, 12090634301321662557u, 136510113118u }, { 9986352353182266963u, 9409926148478635502u, 5016456u }, { 17340463289911536077u, 92537289398950870u, 0u }, { 7359344614214233035u, 92537289u, 0u }, { 1u, 0u, 212233486336u }, { 419091135888749535u, 4307062684900157135u, 57829455828u }, { 1073142712661309790u, 15300759383869911852u, 168867770169u }, { 11076438902195672286u, 16007534237643445446u, 235386978984u }, { 1820390940081322073u, 7138502295759677633u, 135445527787u }, { 18417808973944523597u, 8218537071653683707u, 217122201479u }, { 10251294197731582957u, 2254219416760329295u, 39165742553u }, { 1502394029870156428u, 3057410459568460682u, 61445488423u }, { 321014853559106075u, 8217810929938874369u, 211636487741u }, { 2390953058510591778u, 11741126472498340928u, 47063714515u }, { 10685224265907994087u, 1175325363726654804u, 225511138607u }, { 5967405799190505023u, 9428843070696730899u, 249686435553u }, { 11210723659228214761u, 12662500978715131895u, 53349278201u }, { 12327123641078462773u, 6443045597035184563u, 150104158517u }, { 1709976940107894237u, 1921385512639171182u, 27567551382u }, { 16607686590938553511u, 10469475094355551398u, 25795759643u }, { 18332088094272679457u, 14679174489076953573u, 138642556441u }, { 2946170632136780882u, 11853074234719825643u, 108448366218u }, { 4824449494694383419u, 8270896886596139123u, 124896237676u }, { 17008332258693407134u, 16532667046659118125u, 160008041596u }, { 1773419466622750661u, 148341279888833482u, 202561867680u }, { 3892343466023784379u, 10364629296397276040u, 150773344202u }, { 12001571085575422796u, 14265682585545771670u, 72758493846u }, { 12933506765500977582u, 13991741872911347877u, 328u }, { 11884830007749143734u, 6064523798049u, 0u }, { 9662368568096205337u, 6064u, 0u }, { 1u, 0u, 197760516096u }, { 16801499925276664442u, 14029045786848724432u, 87217159109u }, { 10492407990787637084u, 4005878521026842340u, 38185849943u }, { 7673849751013230269u, 3428326338640386487u, 17054752294u }, { 6046724489853072367u, 1010001558294829379u, 14109074193u }, { 3723941391207507903u, 2012063724327403417u, 72596156942u }, { 16844122108860347659u, 10997154538851372611u, 110103961416u }, { 10622020182694668027u, 1917749645489607897u, 11529300590u }, { 8741198820686854862u, 9763872523711218804u, 240860623371u }, { 6855480461211306807u, 15875699078454059310u, 79594496752u }, { 10005708458011566304u, 10966529452671276105u, 217979752527u }, { 8932093106442919061u, 18073244132105736912u, 186240434905u }, { 9062763476260756743u, 4435241176994913172u, 106296225722u }, { 13664977682032775521u, 5464400086219074322u, 170132593002u }, { 1078499125430623453u, 2445909179323258811u, 75047377578u }, { 6554586738078431161u, 873962058644121210u, 182904000843u }, { 12177313698643242883u, 16675872194112650856u, 126578969526u }, { 16615072271904633953u, 10680102689274800354u, 200128504958u }, { 16375404983106569285u, 2370498083108897523u, 111832363720u }, { 13552251831473522729u, 15354400521451334665u, 15014094191u }, { 8330500218412111874u, 259991949657381020u, 214560277007u }, { 7044338079053294004u, 10335286558772966916u, 249885659094u }, { 2688849443046530184u, 16337526653906757262u, 44652742137u }, { 855940991879596845u, 12040967163702784893u, 21545516u }, { 7344363609485825662u, 397444631628981487u, 0u }, { 11602660525134634992u, 397444631u, 0u }, { 1u, 0u, 177182867456u }, { 16945343208344873835u, 3373309160242342186u, 151739417265u }, { 9617992661337889145u, 13639841054510584220u, 147861878679u }, { 18280344933262742088u, 15898855427739708030u, 4246351763u }, { 5179975582362777795u, 4544387940067005418u, 236286316036u }, { 1798918997870037130u, 5281598644835398574u, 157741358060u }, { 6327667344756325883u, 13675642405083408834u, 157215398045u }, { 18380327574124007701u, 3973392623768015720u, 128243473053u }, { 18015447557304295289u, 4491285101509114190u, 81813276544u }, { 10315590748073249878u, 15002304272810270499u, 48939195473u }, { 7697916092577993382u, 17325098540619893467u, 209061648432u }, { 3124132817942110723u, 1137212864974584821u, 141141998289u }, { 7448238998520507049u, 2619406097224859077u, 213448932749u }, { 13892823322374205297u, 8281347529729293731u, 241614998485u }, { 11042137840046332564u, 11344719666795450103u, 32936960497u }, { 10513966307445593804u, 17283870506679425782u, 108599249952u }, { 9388437460943526958u, 11054210518010603774u, 55346915180u }, { 10967228614677896228u, 6399455551799092884u, 229700965431u }, { 2310996671540235542u, 12930529916573967169u, 21788762341u }, { 4989110555003898587u, 14550097052337552403u, 155676955925u }, { 16271452421983657679u, 12487632712206414747u, 110313931675u }, { 9523160181437090473u, 5791017277843595714u, 186554421102u }, { 13137707423765072250u, 10227264183449036112u, 26108748474u }, { 16846859744221860705u, 2006055278511721440u, 132006979354u }, { 7767140033449795569u, 128746359043876332u, 1412u }, { 17169456915721160017u, 26046931378436u, 0u }, { 17180899661833327819u, 26046u, 0u }, { 1u, 0u, 208401596416u }, { 17572520700934791416u, 7408146306870995753u, 74449891024u }, { 17968798858233825417u, 8299024588195267961u, 164081155402u }, { 15338423313945305609u, 1497052939192040880u, 16909196452u }, { 17895321323836726301u, 16771714264265803746u, 76007751440u }, { 814069333008965773u, 142988846654429431u, 201641838924u }, { 7200328959852723947u, 11839838367716104144u, 36326325705u }, { 759884557248133773u, 6019646776647679764u, 84250015524u }, { 13410165861863974851u, 4611972391702034947u, 50891603540u }, { 6278452420856351570u, 16447182322205429544u, 111114571826u }, { 9072115382556676442u, 2113477168726764244u, 200191701103u }, { 2755882551854926563u, 3536261187802311515u, 89999871944u }, { 8496072611504649269u, 18444381860986709853u, 237256647769u }, { 4122009033579215815u, 4734315730275909837u, 112540742381u }, { 10222217724450527221u, 9974936316849658173u, 220643171696u }, { 2064539481554006325u, 11864423681540657641u, 104444915676u }, { 7935605886598063693u, 8207245621417902666u, 207433275752u }, { 7805147585347548429u, 7992526918695295027u, 114470508751u }, { 5709020905457661273u, 8679354522130259986u, 236328825714u }, { 16257370307404906674u, 6065763799692166460u, 76983552492u }, { 14971258192939373646u, 18143341109049024975u, 93826297164u }, { 1133404845901376390u, 15242492331283350569u, 238541361245u }, { 9460827548162822047u, 9986352353182266962u, 214940028398u }, { 1273897659779791346u, 17340463289911536076u, 201398950870u }, { 7833262224435092783u, 7359344614214233034u, 92537289u }, { 3033420566713364587u, 1707011694817242694u, 0u }, { 15075466825360349103u, 1707011694u, 0u }, { 1u, 0u, 207022718976u }, { 2484134775182816690u, 419091135888749534u, 44058175183u }, { 18400539815335991277u, 1073142712661309789u, 198600454956u }, { 485494064952118286u, 11076438902195672285u, 193098683590u }, { 17577048805241314891u, 1820390940081322072u, 251998431425u }, { 2863946907557583807u, 18417808973944523596u, 79555723771u }, { 13045307417786230800u, 10251294197731582956u, 138081444943u }, { 12032088871615097766u, 1502394029870156427u, 1017402250u }, { 8848763446997690580u, 321014853559106074u, 64129613825u }, { 10031289150307672684u, 2390953058510591777u, 84579247168u }, { 11592215575498656563u, 10685224265907994086u, 19323493716u }, { 15894436747956898388u, 5967405799190505022u, 247607734547u }, { 2091546719588500923u, 11210723659228214760u, 179668254711u }, { 5863809244813756109u, 12327123641078462772u, 110092698035u }, { 11303008753675411245u, 1709976940107894236u, 166900304494u }, { 13238426537506910532u, 16607686590938553510u, 229993784486u }, { 17258458071023005565u, 18332088094272679456u, 235159712229u }, { 8385733444777075179u, 2946170632136780881u, 115261533931u }, { 9530757096163247300u, 4824449494694383418u, 45922023539u }, { 14423000845391072217u, 17008332258693407133u, 202096137261u }, { 10953140011159884311u, 1773419466622750660u, 136211004362u }, { 12228340237948264127u, 3892343466023784378u, 150650606472u }, { 11279134946966259189u, 12001571085575422795u, 165701126806u }, { 14640097792684582651u, 12933506765500977581u, 33644277925u }, { 6232313315128656728u, 11884830007749143733u, 176523798049u }, { 16136121832933322088u, 9662368568096205336u, 6064u }, { 15074767079673358271u, 111870718431542u, 0u }, { 13252722804829281908u, 111870u, 0u }, { 1u, 0u, 208910811136u }, { 7740175894281560509u, 16801499925276664441u, 228568794576u }, { 15670495392425593226u, 10492407990787637083u, 183416000228u }, { 15152257626756992778u, 7673849751013230268u, 67327793591u }, { 4090073428152440422u, 6046724489853072366u, 153201875267u }, { 14450327772834205584u, 3723941391207507902u, 67913121689u }, { 4466091895542494216u, 16844122108860347658u, 217575820867u }, { 10454115378553795377u, 10622020182694668026u, 116473861337u }, { 2267817233475657788u, 8741198820686854861u, 46371636340u }, { 5500455702636497521u, 6855480461211306806u, 73542410542u }, { 15178768299492252549u, 10005708458011566303u, 208484209737u }, { 7062359872332045590u, 8932093106442919060u, 148491293392u }, { 12297347290027942576u, 9062763476260756742u, 18740779924u }, { 8030124596941085588u, 13664977682032775520u, 187058465554u }, { 6526656990996654843u, 1078499125430623452u, 122355324859u }, { 6254287345256979850u, 6554586738078431160u, 104660133498u }, { 6642007136244870032u, 12177313698643242882u, 226900704872u }, { 2027592955437164718u, 16615072271904633952u, 243887712482u }, { 942718349157325567u, 16375404983106569284u, 9734669043u }, { 14617066671884002278u, 13552251831473522728u, 156451597321u }, { 6831631114396133348u, 8330500218412111873u, 4381874332u }, { 14603040013386939258u, 7044338079053294003u, 142145762820u }, { 9906106765319401103u, 2688849443046530183u, 125046400654u }, { 1396179595609933063u, 855940991879596844u, 239398138749u }, { 11524884268464976417u, 7344363609485825661u, 23628981487u }, { 382929570730827274u, 11602660525134634991u, 397444631u }, { 6109721884461301381u, 7331559403129590068u, 0u }, { 2390514825000339691u, 7331559403u, 0u }, { 6116191454763441755u, 7u, 0u }, { 1u, 0u, 42918608896u }, { 11598868771099176310u, 16945343208344873834u, 156521392426u }, { 14449966445520085105u, 9617992661337889144u, 126990979484u }, { 11675595287405614726u, 18280344933262742087u, 234280807038u }, { 15860796398550489897u, 5179975582362777794u, 174097519594u }, { 16180408435245829662u, 1798918997870037129u, 194343023534u }, { 13756992797154950706u, 6327667344756325882u, 104996399554u }, { 8830551328786758466u, 18380327574124007700u, 78976619368u }, { 16699955256560951264u, 18015447557304295288u, 35559209294u }, { 10038983627153402074u, 10315590748073249877u, 219417304867u }, { 15085100736692127346u, 7697916092577993381u, 245169359579u }, { 10007783780289711125u, 3124132817942110722u, 197403769845u }, { 17596907048353602192u, 7448238998520507048u, 163753131461u }, { 13530650344896573509u, 13892823322374205296u, 247598595491u }, { 6337724853398437005u, 11042137840046332563u, 246569963255u }, { 12768885008904063297u, 10513966307445593803u, 254508948214u }, { 2759773619512884114u, 9388437460943526957u, 148594534654u }, { 8434364600126655292u, 10967228614677896227u, 65125279380u }, { 3843827521199949338u, 2310996671540235541u, 19270460225u }, { 4661660852957808994u, 4989110555003898586u, 155882077203u }, { 15298044134177324417u, 16271452421983657678u, 194516251547u }, { 7747773274913338217u, 9523160181437090472u, 80712196546u }, { 10348785912020632966u, 13137707423765072249u, 224913270096u }, { 4175372293197190170u, 16846859744221860704u, 236421057504u }, { 11326064156813083145u, 7767140033449795568u, 4930758124u }, { 8100407170505981763u, 17169456915721160016u, 190931378436u }, { 1706556116319916846u, 17180899661833327818u, 26046u }, { 15028897280749641942u, 480481077043500u, 0u }, { 1421201742071739121u, 480481u, 0u }, { 1u, 0u, 41952608256u }, { 8480737406125178272u, 17572520700934791415u, 121974090537u }, { 10947205650755620361u, 17968798858233825416u, 176831497593u }, { 868577942165647781u, 15338423313945305608u, 226970107312u }, { 16017710019091388479u, 17895321323836726300u, 247044130786u }, { 6610879150827623375u, 814069333008965772u, 208390330615u }, { 12110095866223762092u, 7200328959852723946u, 20041193424u }, { 7756802952949470775u, 759884557248133772u, 3726966548u }, { 2941800790804618759u, 13410165861863974850u, 40340355587u }, { 11703600274199927522u, 6278452420856351569u, 212491800360u }, { 806737539257940346u, 9072115382556676441u, 91149396692u }, { 14579028397110132023u, 2755882551854926562u, 93460573019u }, { 14247808875344366934u, 8496072611504649268u, 205223454557u }, { 9713379923695279513u, 4122009033579215814u, 61554147533u }, { 2246428675703313877u, 10222217724450527220u, 233111918909u }, { 3549783776592680620u, 2064539481554006324u, 74430190057u }, { 12645029747929213033u, 7935605886598063692u, 51423117898u }, { 16279009267476580506u, 7805147585347548428u, 18309486643u }, { 343358782242907186u, 5709020905457661272u, 60881313810u }, { 10077054739085890321u, 16257370307404906673u, 207811593532u }, { 10526715404712173586u, 14971258192939373645u, 41061441999u }, { 11438715865125144243u, 1133404845901376389u, 82512872489u }, { 5040916178827294801u, 9460827548162822046u, 204069058130u }, { 16643761637275849508u, 1273897659779791345u, 202424641996u }, { 4852542977279030386u, 7833262224435092782u, 70164442058u }, { 7883373066544387129u, 3033420566713364586u, 110817242694u }, { 16699064314768500978u, 15075466825360349102u, 1707011694u }, { 6805863634444817214u, 13042063791413317777u, 1u }, { 2266540253968903500u, 31488807865u, 0u }, { 9016913589137908810u, 31u, 0u }, { 1u, 0u, 222134665216u }, { 11654451024602552034u, 2484134775182816689u, 93997495262u }, { 5299013208454526793u, 18400539815335991276u, 221026318685u }, { 14918550373926182540u, 485494064952118285u, 88952853725u }, { 6225552657491071054u, 17577048805241314890u, 76155254872u }, { 10344713496596235785u, 2863946907557583806u, 236707187532u }, { 12972405634433280209u, 13045307417786230799u, 139652260844u }, { 12911885282402784945u, 12032088871615097765u, 26479692427u }, { 6934311832970995868u, 8848763446997690579u, 33543797274u }, { 9975729197003430461u, 10031289150307672683u, 230628415265u }, { 1982857556803548935u, 11592215575498656562u, 62861639142u }, { 2095735223386298223u, 15894436747956898387u, 232113382974u }, { 7110931538347639365u, 2091546719588500922u, 52317877736u }, { 15822183724630969535u, 5863809244813756108u, 220612737332u }, { 16931982690156327501u, 11303008753675411244u, 166717656540u }, { 6740069226761666110u, 13238426537506910531u, 32935582886u }, { 3138792961008474902u, 17258458071023005564u, 81454591520u }, { 12154594426971851390u, 8385733444777075178u, 58516663377u }, { 15780127219221910902u, 9530757096163247299u, 157781872442u }, { 16421541930960194381u, 14423000845391072216u, 196593770909u }, { 7485894627196740576u, 10953140011159884310u, 186662899652u }, { 8897269432694476707u, 12228340237948264126u, 75611443130u }, { 17189823634941678805u, 11279134946966259188u, 173793641291u }, { 9585582064286255216u, 14640097792684582650u, 181337854381u }, { 12835472279575022097u, 6232313315128656727u, 24874740917u }, { 6776016669542754608u, 16136121832933322087u, 54817204760u }, { 18340015775620871027u, 15074767079673358270u, 254718431542u }, { 5254188752292365830u, 13252722804829281907u, 111870u }, { 6798802596750151183u, 2063650512248692u, 0u }, { 9449320530215272000u, 2063650u, 0u }, { 1u, 0u, 121419595776u }, { 17110720482574968811u, 7740175894281560508u, 91849499257u }, { 16172441693558688213u, 15670495392425593225u, 188821405531u }, { 6234654946353717320u, 15152257626756992777u, 238221723324u }, { 11180283100679445438u, 4090073428152440421u, 190783353838u }, { 14852260031176961272u, 14450327772834205583u, 10242107326u }, { 4481533167346438750u, 4466091895542494215u, 250566718730u }, { 4269718344362365664u, 10454115378553795376u, 205122938618u }, { 11520029752381101466u, 2267817233475657787u, 54298180301u }, { 16778682550309368417u, 5500455702636497520u, 223822842678u }, { 9687587467301363608u, 15178768299492252548u, 148382851295u }, { 10093971076828497318u, 7062359872332045589u, 6666640532u }, { 1913763026490934696u, 12297347290027942575u, 96435313926u }, { 12701450127613557000u, 8030124596941085587u, 220353810784u }, { 8974572160711134644u, 6526656990996654842u, 184339045596u }, { 9890000077336694124u, 6254287345256979849u, 130360063928u }, { 4292326716201059148u, 6642007136244870031u, 96109916034u }, { 14644519175104337420u, 2027592955437164717u, 68051104864u }, { 5051178622270136798u, 942718349157325566u, 40792392772u }, { 675983118348065839u, 14617066671884002277u, 1370343464u }, { 4431647660065117244u, 6831631114396133347u, 179791632385u }, { 8316115180008411962u, 14603040013386939257u, 135537011123u }, { 9621158095544965602u, 9906106765319401102u, 44075687047u }, { 15283478958951102072u, 1396179595609933062u, 125624765228u }, { 13981553073094447813u, 11524884268464976416u, 239020758653u }, { 4558368743929911607u, 382929570730827273u, 52331208687u }, { 15217004469858477791u, 6109721884461301380u, 235129590068u }, { 11589190369996515737u, 2390514825000339690u, 7331559403u }, { 3670624237398152929u, 6116191454763441754u, 7u }, { 13471713758418039777u, 135243399970u, 0u }, { 4489936967610296411u, 135u, 0u }, { 1u, 0u, 106628775936u }, { 9052049303222747950u, 11598868771099176309u, 120783334250u }, { 1011330006193020538u, 14449966445520085104u, 71632935288u }, { 17412075644359478612u, 11675595287405614725u, 194859815495u }, { 6358678384745980468u, 15860796398550489896u, 137877141698u }, { 15262353928842850919u, 16180408435245829661u, 250745768073u }, { 11145257686438581736u, 13756992797154950705u, 20478705146u }, { 1600562031807691890u, 8830551328786758465u, 120905306388u }, { 6775147337046626724u, 16699955256560951263u, 85544214392u }, { 15772127322106297822u, 10038983627153402073u, 165817764949u }, { 4141472200527441474u, 15085100736692127345u, 2542523045u }, { 18246007807879281267u, 10007783780289711124u, 168953930242u }, { 960746958654787123u, 17596907048353602191u, 112733498024u }, { 11355981212264408477u, 13530650344896573508u, 147343568752u }, { 1573078209576251481u, 6337724853398437004u, 203692202643u }, { 6245294478780491367u, 12768885008904063296u, 45149607627u }, { 7523292955659721510u, 2759773619512884113u, 35457227821u }, { 14454736751015226505u, 8434364600126655291u, 21208374307u }, { 7219786377781411316u, 3843827521199949337u, 218252709141u }, { 10597123082209392431u, 4661660852957808993u, 206829308634u }, { 6922353544343010714u, 15298044134177324416u, 168420007630u }, { 14317523356293377430u, 7747773274913338216u, 121561008808u }, { 4057766168681892717u, 10348785912020632965u, 96226347385u }, { 15214083611901244045u, 4175372293197190169u, 240613987168u }, { 8390569016883950721u, 11326064156813083144u, 80439123952u }, { 10680472538208175055u, 8100407170505981762u, 202092512592u }, { 12173567833130544927u, 1706556116319916845u, 44814718154u }, { 1386341248286610026u, 15028897280749641941u, 225077043500u }, { 12487300952797237352u, 1421201742071739120u, 480481u }, { 2614759871804869720u, 8863311460481781u, 0u }, { 8494389567327729477u, 8863311u, 0u }, { 1u, 0u, 247459741696u }, { 6260469580539185878u, 8480737406125178271u, 136593449207u }, { 17818573101084525841u, 10947205650755620360u, 8047085704u }, { 2201029069927307150u, 868577942165647780u, 28868321800u }, { 10397997613804897039u, 16017710019091388478u, 140358376476u }, { 14269915965770103741u, 6610879150827623374u, 234656489612u }, { 16776139909196366727u, 12110095866223762091u, 140420497130u }, { 6246513436385199720u, 7756802952949470774u, 194159475340u }, { 2926026498821554288u, 2941800790804618758u, 81634453442u }, { 15725499391028340982u, 11703600274199927521u, 89043733329u }, { 8576577277771450827u, 806737539257940345u, 226790330713u }, { 15523351176022259335u, 14579028397110132022u, 52772375266u }, { 4775158829429176134u, 14247808875344366933u, 198526563380u }, { 10141817222123532462u, 9713379923695279512u, 244121779142u }, { 12847658900242624586u, 2246428675703313876u, 52192434164u }, { 13708197964460514655u, 3549783776592680619u, 76685488436u }, { 1951540006613246932u, 12645029747929213032u, 12882486860u }, { 9979297327280092199u, 16279009267476580505u, 88018613516u }, { 15381307706282553684u, 343358782242907185u, 177546278232u }, { 10037428657543061177u, 10077054739085890320u, 77570654385u }, { 2584877324547208668u, 10526715404712173585u, 133620094029u }, { 1126624732730703576u, 11438715865125144242u, 158273268613u }, { 1501064139624981020u, 5040916178827294800u, 241902260126u }, { 5219661484955306109u, 16643761637275849507u, 46263056881u }, { 5336997298570282212u, 4852542977279030385u, 106427358510u }, { 12191131175733833362u, 7883373066544387128u, 174905258090u }, { 3707068178994436536u, 16699064314768500977u, 145368946606u }, { 5045484691732942022u, 6805863634444817213u, 185122869393u }, { 14847900542908711232u, 2266540253968903499u, 31488807865u }, { 9097257915916965135u, 9016913589137908809u, 31u }, { 2472027983230314217u, 580865979874u, 0u }, { 15974509111133272205u, 580u, 0u }, { 1u, 0u, 177631789056u }, { 12099486841948187399u, 11654451024602552033u, 236287260081u }, { 5319910566029976328u, 5299013208454526792u, 13808736236u }, { 11549214421017285864u, 14918550373926182539u, 74337487885u }, { 1998791413186046700u, 6225552657491071053u, 190560788042u }, { 17075171930090011210u, 10344713496596235784u, 15703235518u }, { 15158296003813501474u, 12972405634433280208u, 165699954703u }, { 1360083178079384115u, 12911885282402784944u, 211375909797u }, { 6167980558592741158u, 6934311832970995867u, 107540785363u }, { 3630180428124865653u, 9975729197003430460u, 50107490923u }, { 2276550099763657677u, 1982857556803548934u, 83113610034u }, { 407006713016100655u, 2095735223386298222u, 186385484371u }, { 14242579061653496002u, 7110931538347639364u, 204857722298u }, { 17944493332678643704u, 15822183724630969534u, 44917884620u }, { 987185901870869452u, 16931982690156327500u, 67365379884u }, { 5578665155415167745u, 6740069226761666109u, 124170154307u }, { 4849210377429577536u, 3138792961008474901u, 234658901884u }, { 10811995403388891862u, 12154594426971851389u, 195855442410u }, { 7051931074990177294u, 15780127219221910901u, 216890213571u }, { 2030832259446664275u, 16421541930960194380u, 22405811160u }, { 6069512651054767896u, 7485894627196740575u, 190482321942u }, { 10608701253763958799u, 8897269432694476706u, 244931862206u }, { 15700053443426906717u, 17189823634941678804u, 250519635444u }, { 17759719234725541222u, 9585582064286255215u, 87695812346u }, { 15187321568916405210u, 12835472279575022096u, 103367328599u }, { 11040156458113129594u, 6776016669542754607u, 190994214247u }, { 2800727824598008497u, 18340015775620871026u, 115284830142u }, { 2997236166375604479u, 5254188752292365829u, 116368563827u }, { 6260091886451512841u, 6798802596750151182u, 34512248692u }, { 17573059315228347474u, 9449320530215271999u, 2063650u }, { 7519453664590169251u, 38067632857031246u, 0u }, { 15809436065653866529u, 38067632u, 0u }, { 1u, 0u, 188927574016u }, { 228921437623588922u, 17110720482574968810u, 137876709820u }, { 2195862230003073884u, 16172441693558688212u, 9337981321u }, { 960207412233973688u, 6234654946353717319u, 101606084361u }, { 2464387149230492479u, 11180283100679445437u, 143805142629u }, { 3631866936444955213u, 14852260031176961271u, 7242944399u }, { 1578304441149380227u, 4481533167346438749u, 48231461895u }, { 18190538519673445181u, 4269718344362365663u, 59624502064u }, { 1271000736479934749u, 11520029752381101465u, 112909574203u }, { 18292963032817745634u, 16778682550309368416u, 132525165168u }, { 17168014021925537455u, 9687587467301363607u, 21547195268u }, { 18046757712870378949u, 10093971076828497317u, 175103745301u }, { 14857998893911743220u, 1913763026490934695u, 147688546991u }, { 11933607369968684575u, 12701450127613556999u, 250486512531u }, { 3483798509902859162u, 8974572160711134643u, 137536137978u }, { 7378828438829845831u, 9890000077336694123u, 143232687497u }, { 15791137430347699565u, 4292326716201059147u, 173793880975u }, { 17044141236829932641u, 14644519175104337419u, 254273824941u }, { 9075651910862456484u, 5051178622270136797u, 229036645118u }, { 17811207355884564095u, 675983118348065838u, 227240240101u }, { 4438638126207305937u, 4431647660065117243u, 121450817507u }, { 12507972635512950185u, 8316115180008411961u, 142521564025u }, { 14658269128098109408u, 9621158095544965601u, 6828519054u }, { 3642436268910286111u, 15283478958951102071u, 32757941510u }, { 3783099432964819561u, 13981553073094447812u, 9247109664u }, { 9497579866027539638u, 4558368743929911606u, 132824915465u }, { 3395179445046271361u, 15217004469858477790u, 234628251268u }, { 5938502732309497276u, 11589190369996515736u, 90198984938u }, { 5793671185917606255u, 3670624237398152928u, 34730303066u }, { 889272970253526588u, 13471713758418039776u, 135243399970u }, { 8594177504370135501u, 4489936967610296410u, 135u }, { 7374354721120724712u, 2494800386918u, 0u }, { 14764532643665507567u, 2494u, 0u }, { 1u, 0u, 117490712576u }, { 5392404173658087695u, 9052049303222747949u, 112054824309u }, { 4976586473237854316u, 1011330006193020537u, 133943910512u }, { 6308932742419013569u, 17412075644359478611u, 40344704645u }, { 4831846642430703059u, 6358678384745980467u, 29827373864u }, { 18139507855949846901u, 15262353928842850918u, 49604185629u }, { 4865833876326628410u, 11145257686438581735u, 65086766641u }, { 14296661839130179261u, 1600562031807691889u, 223367281473u }, { 9254773150378118248u, 6775147337046626723u, 217855008735u }, { 12174712433727875143u, 15772127322106297821u, 113224509657u }, { 705653145340915199u, 4141472200527441473u, 20989118065u }, { 17763928858962481812u, 18246007807879281266u, 143052082196u }, { 3982836567612046296u, 960746958654787122u, 68615608975u }, { 12730849277561967739u, 11355981212264408476u, 140085276740u }, { 17314488764367235908u, 1573078209576251480u, 64338558092u }, { 15951418930590301119u, 6245294478780491366u, 145407838528u }, { 7193356087283467261u, 7523292955659721509u, 59783592849u }, { 17592945625696089446u, 14454736751015226504u, 25391385403u }, { 3554461664875361428u, 7219786377781411315u, 97574471193u }, { 2213779057785318208u, 10597123082209392430u, 128375261537u }, { 3880940796082421148u, 6922353544343010713u, 104776154496u }, { 4528237545358141043u, 14317523356293377429u, 133219971944u }, { 11681196539088147363u, 4057766168681892716u, 25824757125u }, { 9835005502912643017u, 15214083611901244044u, 8454853657u }, { 4964088126040986696u, 8390569016883950720u, 66578989576u }, { 3355564873147047622u, 10680472538208175054u, 45659930434u }, { 1853093467828272927u, 12173567833130544926u, 213075153709u }, { 14755341584803008677u, 1386341248286610025u, 240676937941u }, { 4701571132542556621u, 12487300952797237351u, 245141746416u }, { 6128849686644853851u, 2614759871804869719u, 79460481781u }, { 12026867901170202094u, 8494389567327729476u, 8863311u }, { 17909760324981426303u, 163499238157084246u, 0u }, { 2897692901883393664u, 163499238u, 0u }, { 1u, 0u, 159339380736u }, { 12323704802554838154u, 6260469580539185877u, 8965946783u }, { 7135886931147821732u, 17818573101084525840u, 164119318024u }, { 15341283120292884947u, 2201029069927307149u, 62563676580u }, { 3092789040392634166u, 10397997613804897038u, 206773573694u }, { 8811761390822097865u, 14269915965770103740u, 171909436366u }, { 16870860798610218169u, 16776139909196366726u, 54338624171u }, { 17452041453591904833u, 6246513436385199719u, 6158620214u }, { 10314783684009874908u, 2926026498821554287u, 225852481030u }, { 4932636630789274903u, 15725499391028340981u, 121464937185u }, { 18143884346082124480u, 8576577277771450826u, 54841522553u }, { 2823209155405527322u, 15523351176022259334u, 85258861878u }, { 16195396106620226251u, 4775158829429176133u, 152549789013u }, { 1150544491807648944u, 10141817222123532461u, 212696472984u }, { 7767455475523884824u, 12847658900242624585u, 171743122900u }, { 15204378045683991808u, 13708197964460514654u, 104105793195u }, { 17239732561718805622u, 1951540006613246931u, 153540978792u }, { 12886430624522800062u, 9979297327280092198u, 49833822361u }, { 18162250541178258136u, 15381307706282553683u, 16544130097u }, { 17028935366700158084u, 10037428657543061176u, 17140126480u }, { 16075467823964198637u, 2584877324547208667u, 178061074449u }, { 9803858825574498304u, 1126624732730703575u, 80081372850u }, { 17464070808143041817u, 1501064139624981019u, 35282958416u }, { 17682703471239266776u, 5219661484955306108u, 113289319203u }, { 18147688354161351336u, 5336997298570282211u, 56660882545u }, { 6663423873348080051u, 12191131175733833361u, 241200960568u }, { 9417270363716235133u, 3707068178994436535u, 61273516273u }, { 9295013721571344179u, 5045484691732942021u, 75804906301u }, { 6199479138350037783u, 14847900542908711231u, 73493163339u }, { 887603005365085688u, 9097257915916965134u, 226134008905u }, { 333989628642975696u, 2472027983230314216u, 68865979874u }, { 4620735991403939439u, 15974509111133272204u, 580u }, { 12418523063962801201u, 10715086071862u, 0u }, { 1587745622680169419u, 10715u, 0u }, { 1u, 0u, 225655914496u }, { 10968905082284365638u, 12099486841948187398u, 72288392929u }, { 14076907092801977812u, 5319910566029976327u, 139626084168u }, { 3438322122816124202u, 11549214421017285863u, 77108354699u }, { 14645413324829073676u, 1998791413186046699u, 8925646925u }, { 12271281439492289999u, 17075171930090011209u, 208821732872u }, { 6233751789862708246u, 15158296003813501473u, 176073730256u }, { 1962644459455827991u, 1360083178079384114u, 155334366896u }, { 8726934184642952500u, 6167980558592741157u, 60196792475u }, { 4531087719737475147u, 3630180428124865652u, 6123412028u }, { 481513520412720775u, 2276550099763657676u, 110022063878u }, { 992149349835802669u, 407006713016100654u, 68772091758u }, { 11165474436676191361u, 14242579061653496001u, 190972772932u }, { 10240785855143707184u, 17944493332678643703u, 76053515454u }, { 10059329918238932466u, 987185901870869451u, 61302420044u }, { 14791716450947031886u, 5578665155415167744u, 21262876221u }, { 15378882314737417403u, 4849210377429577535u, 125586119445u }, { 14726970229242271128u, 10811995403388891861u, 117382285949u }, { 5090110549507128156u, 7051931074990177293u, 76110091637u }, { 17185220781106503841u, 2030832259446664274u, 223329028940u }, { 9858517691519529306u, 6069512651054767895u, 162575098847u }, { 5595905546638020703u, 10608701253763958798u, 212851101602u }, { 15555173226968030256u, 15700053443426906716u, 111962756308u }, { 10745236628845355771u, 17759719234725541221u, 16823306351u }, { 9973314042399760760u, 15187321568916405209u, 47598488080u }, { 4374506813558796576u, 11040156458113129593u, 114151827759u }, { 15960826480426749933u, 2800727824598008496u, 5162480498u }, { 9636454862798615738u, 2997236166375604478u, 14339360261u }, { 17973331528911319269u, 6260091886451512840u, 63952637454u }, { 7366495200039369602u, 17573059315228347473u, 78407630399u }, { 10505831326526933399u, 7519453664590169250u, 176857031246u }, { 2803218632575724145u, 15809436065653866528u, 38067632u }, { 8425731874431741636u, 702223880805592151u, 0u }, { 14860552245711912111u, 702223880u, 0u }, { 1u, 0u, 234012409856u }, { 6993664200669526994u, 228921437623588921u, 212119037930u }, { 4065363582031999356u, 2195862230003073883u, 71052052948u }, { 6899780515342669867u, 960207412233973687u, 189133594695u }, { 17713500890201844939u, 2464387149230492478u, 247196883901u }, { 6445781125105107086u, 3631866936444955212u, 93085560055u }, { 13563044070717478571u, 1578304441149380226u, 223986111069u }, { 13167612994149348885u, 18190538519673445180u, 153068901087u }, { 5505463469596727288u, 1271000736479934748u, 96991663513u }, { 12125446212518819372u, 18292963032817745633u, 151930679904u }, { 12537707724735421794u, 17168014021925537454u, 165978316695u }, { 15173675086703777069u, 18046757712870378948u, 167805453733u }, { 13535510174093048476u, 14857998893911743219u, 7646922151u }, { 10698912997087096629u, 11933607369968684574u, 179188857095u }, { 16952559548431933861u, 3483798509902859161u, 107400007091u }, { 13528255827744249993u, 7378828438829845830u, 75856039275u }, { 14122167436324771955u, 15791137430347699564u, 11923964747u }, { 13071007137740038297u, 17044141236829932640u, 221491992075u }, { 13011887609328904025u, 9075651910862456483u, 46965547485u }, { 3116434332871336590u, 17811207355884564094u, 59240619054u }, { 9050993820536772770u, 4438638126207305936u, 57678058555u }, { 11993719123438634238u, 12507972635512950184u, 225794626361u }, { 1414857165879849301u, 14658269128098109407u, 119197456865u }, { 13819438220812375094u, 3642436268910286110u, 196205082231u }, { 6073063033888264440u, 3783099432964819560u, 54514864836u }, { 6828883869150720294u, 9497579866027539637u, 222184053046u }, { 4548265621068768345u, 3395179445046271360u, 152321926878u }, { 10422524923581371874u, 5938502732309497275u, 224314075544u }, { 1858996082510682634u, 5793671185917606254u, 224048207584u }, { 890276727450878316u, 889272970253526587u, 90465891296u }, { 3886008133802710905u, 8594177504370135500u, 102399764570u }, { 612074409233016757u, 7374354721120724711u, 190800386918u }, { 3927020336901729264u, 14764532643665507566u, 2494u }, { 5298603480094474942u, 46020944252475u, 0u }, { 17418383752590430025u, 46020u, 0u }, { 1u, 0u, 45292322816u }, { 8973799690601597929u, 5392404173658087694u, 121269781293u }, { 1343055462055792431u, 4976586473237854315u, 83342007929u }, { 17425118728683169659u, 6308932742419013568u, 51261934931u }, { 18389781726026675967u, 4831846642430703058u, 102983344691u }, { 272526939565961561u, 18139507855949846900u, 231263777382u }, { 11293026845930963228u, 4865833876326628409u, 113775023591u }, { 13997416438903902597u, 14296661839130179260u, 163501702257u }, { 6186605805999441184u, 9254773150378118247u, 221659992483u }, { 4401776373281836138u, 12174712433727875142u, 65038253533u }, { 16338917089754547008u, 705653145340915198u, 114962984513u }, { 13337700757935003056u, 17763928858962481811u, 50215910002u }, { 14612496890816348693u, 3982836567612046295u, 156690140722u }, { 3219935399907691719u, 12730849277561967738u, 88938620316u }, { 10887238730052330387u, 17314488764367235907u, 102864728152u }, { 360256418697768294u, 15951418930590301118u, 37389952614u }, { 321440824631118565u, 7193356087283467260u, 136953715493u }, { 10069228080701402580u, 17592945625696089445u, 243192687752u }, { 9428069607611622975u, 3554461664875361427u, 46120009203u }, { 14736799017468812344u, 2213779057785318207u, 153210386222u }, { 10875332567307979280u, 3880940796082421147u, 149245476249u }, { 4611492910339012807u, 4528237545358141042u, 108633238933u }, { 10743508637597314786u, 11681196539088147362u, 140533156716u }, { 9356196315668016028u, 9835005502912643016u, 128269103756u }, { 15755598617722189347u, 4964088126040986695u, 206181905536u }, { 1275276394173375542u, 3355564873147047621u, 30100456398u }, { 12644999363867216251u, 1853093467828272926u, 105799888670u }, { 4553830511509832021u, 14755341584803008676u, 103254872681u }, { 8869400642218174412u, 4701571132542556620u, 87332245607u }, { 16570849151159054040u, 6128849686644853850u, 68651977815u }, { 16127119334101797673u, 12026867901170202093u, 86970890052u }, { 9686867250420930550u, 17909760324981426302u, 230157084246u }, { 10678226869774428035u, 2897692901883393663u, 163499238u }, { 7767227962910162068u, 3016028602530220424u, 0u }, { 9780840471948993674u, 3016028602u, 0u }, { 1u, 0u, 213668069376u }, { 6288709332106746357u, 12323704802554838153u, 16386837205u }, { 9066785620141948673u, 7135886931147821731u, 141831652624u }, { 8442375916704414909u, 15341283120292884946u, 14167660429u }, { 11604629218100425803u, 3092789040392634165u, 188477686542u }, { 3877248044010875762u, 8811761390822097864u, 134914571196u }, { 16435137704395217283u, 16870860798610218168u, 103946077062u }, { 14994442577577813271u, 17452041453591904832u, 111559165543u }, { 4410105917142436089u, 10314783684009874907u, 245267398767u }, { 4632574728444936970u, 4932636630789274902u, 202983581941u }, { 9117147535650050359u, 18143884346082124479u, 134153046474u }, { 588939301256904809u, 2823209155405527321u, 69877954182u }, { 324393982565305683u, 16195396106620226250u, 173062371141u }, { 9380909186923521175u, 1150544491807648943u, 73421074605u }, { 4463385697777230217u, 7767455475523884823u, 94824230985u }, { 16378985502426333808u, 15204378045683991807u, 211934567774u }, { 18210894922387834354u, 17239732561718805621u, 38698574803u }, { 1555748035329493205u, 12886430624522800061u, 83984577574u }, { 4277055533891898507u, 18162250541178258135u, 184923140435u }, { 11574429772510874408u, 17028935366700158083u, 219871452856u }, { 17391099253493808815u, 16075467823964198636u, 215531468251u }, { 5791212393959129882u, 9803858825574498303u, 27946729175u }, { 11254268231455680880u, 17464070808143041816u, 124958581275u }, { 16355477587312235322u, 17682703471239266775u, 227983788156u }, { 2411485149249320633u, 18147688354161351335u, 145361224931u }, { 12763114642070638360u, 6663423873348080050u, 183510511249u }, { 1147543073987366419u, 9417270363716235132u, 197503883703u }, { 8410777835225272692u, 9295013721571344178u, 63336074437u }, { 8134725822306818018u, 6199479138350037782u, 14048117055u }, { 8899607004752328377u, 887603005365085687u, 232018105614u }, { 690976506652396830u, 333989628642975695u, 140250490600u }, { 12281570945595192074u, 4620735991403939438u, 54673209484u }, { 12592957291365552899u, 12418523063962801200u, 219086071862u }, { 13595807339013970272u, 1587745622680169418u, 10715u }, { 9698096389749839992u, 197658450495420u, 0u }, { 8310173728816391804u, 197658u, 0u }, }; #define TABLE_SIZE_2 69 #define ADDITIONAL_BITS_2 120 static const uint16_t POW10_OFFSET_2[TABLE_SIZE_2] = { 0, 2, 6, 12, 20, 29, 40, 52, 66, 80, 95, 112, 130, 150, 170, 192, 215, 240, 265, 292, 320, 350, 381, 413, 446, 480, 516, 552, 590, 629, 670, 712, 755, 799, 845, 892, 940, 989, 1040, 1092, 1145, 1199, 1254, 1311, 1369, 1428, 1488, 1550, 1613, 1678, 1743, 1810, 1878, 1947, 2017, 2088, 2161, 2235, 2311, 2387, 2465, 2544, 2625, 2706, 2789, 2873, 2959, 3046, 3133 }; static const uint8_t MIN_BLOCK_2[TABLE_SIZE_2] = { 0, 0, 0, 0, 0, 0, 1, 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 34, 0 }; static const uint64_t POW10_SPLIT_2[3133][3] = { { 0u, 0u, 3906250u }, { 0u, 0u, 202000000000u }, { 0u, 11153727427136454656u, 59u }, { 0u, 7205759403792793600u, 59604644775u }, { 0u, 0u, 167390625000u }, { 0u, 0u, 232000000000u }, { 0u, 16777216000000000u, 0u }, { 0u, 12945425605062557696u, 909494u }, { 0u, 4388757836872548352u, 182701772928u }, { 0u, 1152921504606846976u, 128237915039u }, { 0u, 0u, 159062500000u }, { 0u, 0u, 160000000000u }, { 0u, 256000000000u, 0u }, { 0u, 16192327041775828992u, 13u }, { 0u, 15024075324038053888u, 13877787807u }, { 0u, 5449091666327633920u, 159814456755u }, { 0u, 2494994193563254784u, 179295395851u }, { 0u, 4611686018427387904u, 11135253906u }, { 0u, 0u, 146250000000u }, { 0u, 0u, 128000000000u }, { 0u, 3906250u, 0u }, { 0u, 3906250000000000u, 0u }, { 0u, 4368439412768899072u, 211758u }, { 0u, 1563676642168012800u, 46236813575u }, { 0u, 11532349341402398720u, 7084767080u }, { 0u, 9048364970084925440u, 104625169910u }, { 0u, 16609275425742389248u, 246490512847u }, { 0u, 0u, 207900390625u }, { 0u, 0u, 225000000000u }, { 11153727427136454656u, 59u, 0u }, { 7205759403792793600u, 59604644775u, 0u }, { 0u, 4264412554261970152u, 3u }, { 0u, 14485570586272534528u, 3231174267u }, { 0u, 17827675094632103936u, 123785264354u }, { 0u, 7347197909193981952u, 226966440203u }, { 0u, 13677404030777688064u, 11398292396u }, { 0u, 3810326759732150272u, 172741453558u }, { 0u, 9943947977234055168u, 246206558227u }, { 0u, 0u, 19539062500u }, { 0u, 0u, 228000000000u }, { 12945425605062557696u, 909494u, 0u }, { 4388757836872548352u, 909494701772928u, 0u }, { 1152921504606846976u, 14878706826214591391u, 49303u }, { 0u, 4387341015746028192u, 151806576313u }, { 0u, 651726680428265472u, 185237838233u }, { 0u, 2570638187944738816u, 153035330174u }, { 0u, 7419175577111756800u, 126139354575u }, { 0u, 17299322326264840192u, 207402194313u }, { 0u, 7990511638862102528u, 137937798142u }, { 0u, 16717361816799281152u, 254433166503u }, { 0u, 0u, 167906250000u }, { 0u, 0u, 16000000000u }, { 16192327041775828992u, 13u, 0u }, { 15024075324038053888u, 13877787807u, 0u }, { 5449091666327633920u, 13877787807814456755u, 0u }, { 2494994193563254784u, 9707857417284919307u, 752316384u }, { 4611686018427387904u, 1844515466944871826u, 224526264005u }, { 0u, 15167599819856275072u, 197099991383u }, { 0u, 14830185305589481472u, 87822237233u }, { 0u, 6163721531743535104u, 49803945956u }, { 0u, 14122847407012052992u, 228334136013u }, { 0u, 335491783960035328u, 205765601092u }, { 0u, 941252322120433664u, 68018187046u }, { 0u, 11529215046068469760u, 38051025390u }, { 0u, 0u, 238625000000u }, { 0u, 0u, 64000000000u }, { 4368439412768899072u, 211758u, 0u }, { 1563676642168012800u, 211758236813575u, 0u }, { 11532349341402398720u, 8061591463141767016u, 11479u }, { 9048364970084925440u, 16628725344207857142u, 215437019748u }, { 16609275425742389248u, 3555541870038531535u, 100901445007u }, { 0u, 18316647450161853665u, 143192746310u }, { 0u, 16709574568378075648u, 70992947447u }, { 0u, 7696022835795591168u, 247905827852u }, { 0u, 16664449640376041472u, 12417202233u }, { 0u, 3109186955116544000u, 57903381625u }, { 0u, 10515518101817131008u, 121168549362u }, { 0u, 9961962375743537152u, 242570047378u }, { 0u, 9223372036854775808u, 146540039062u }, { 0u, 0u, 150500000000u }, { 14485570586272534528u, 3231174267u, 0u }, { 17827675094632103936u, 3231174267785264354u, 0u }, { 7347197909193981952u, 748977172262750475u, 175162308u }, { 13677404030777688064u, 15965033457315095468u, 196040602133u }, { 3810326759732150272u, 16809402149066729206u, 21865466197u }, { 9943947977234055168u, 7563769067065700371u, 85911239516u }, { 0u, 13550322810840051428u, 92410032742u }, { 0u, 8663209637545764864u, 102734564471u }, { 0u, 8969247575312957440u, 119469633535u }, { 0u, 6193172891660451840u, 255486223885u }, { 0u, 3427954273864908800u, 13335732575u }, { 0u, 10058367555266936832u, 95185829773u }, { 0u, 13907115649320091648u, 141545265197u }, { 0u, 0u, 45753906250u }, { 0u, 0u, 74000000000u }, { 14878706826214591391u, 49303u, 0u }, { 4387341015746028192u, 49303806576313u, 0u }, { 651726680428265472u, 14106411361315920281u, 2672u }, { 2570638187944738816u, 3609034283485221502u, 112764710092u }, { 7419175577111756800u, 9896072247338192335u, 204195646140u }, { 17299322326264840192u, 8889095178479228297u, 188536467151u }, { 7990511638862102528u, 3631796911038383102u, 207481878815u }, { 16717361816799281152u, 898318840772166823u, 31196880105u }, { 0u, 17293677953982795024u, 233048697961u }, { 0u, 7353628266884669440u, 105937492160u }, { 0u, 2404693032470315008u, 192398640987u }, { 0u, 9191155893041889280u, 91130358670u }, { 0u, 6353946855033798656u, 142498253559u }, { 0u, 3767824038248841216u, 247344448149u }, { 0u, 7205759403792793600u, 149204254150u }, { 0u, 0u, 198390625000u }, { 0u, 0u, 232000000000u }, { 9707857417284919307u, 752316384u, 0u }, { 1844515466944871826u, 752316384526264005u, 0u }, { 15167599819856275072u, 17063068157692817751u, 40783152u }, { 14830185305589481472u, 5385330256507239985u, 48924990778u }, { 6163721531743535104u, 3373050282752075748u, 58291939338u }, { 14122847407012052992u, 4116064001262906061u, 10182853422u }, { 335491783960035328u, 11306582046748043076u, 46223132276u }, { 941252322120433664u, 17035410946089626406u, 116612931040u }, { 11529215046068469760u, 15618595715183448558u, 224923491477u }, { 0u, 5141740092277295680u, 149846685770u }, { 0u, 16973644291514990592u, 74278734288u }, { 0u, 14625255268443750400u, 208920143100u }, { 0u, 14021170507320131584u, 252792836676u }, { 0u, 4451355232865091584u, 68760089176u }, { 0u, 12891553933348044800u, 88241308450u }, { 0u, 1152921504606846976u, 34698852539u }, { 0u, 0u, 187062500000u }, { 0u, 0u, 160000000000u }, { 8061591463141767016u, 11479u, 0u }, { 16628725344207857142u, 11479437019748u, 0u }, { 3555541870038531535u, 5562205901560339855u, 622u }, { 18316647450161853665u, 2106077949367544134u, 110301527786u }, { 16709574568378075648u, 7496855998374373623u, 234114170714u }, { 7696022835795591168u, 229183437194837004u, 90406405378u }, { 16664449640376041472u, 465169186276472889u, 2012424059u }, { 3109186955116544000u, 2152980561625316473u, 123025216872u }, { 10515518101817131008u, 2059790725449340402u, 104116713310u }, { 9961962375743537152u, 17891190926410198930u, 94111661478u }, { 9223372036854775808u, 9930696175609809814u, 166969883403u }, { 0u, 7276914261609005312u, 11538344118u }, { 0u, 10539762974036983808u, 182394482312u }, { 0u, 12851089458992250880u, 136571361695u }, { 0u, 9449311677678878720u, 159696658955u }, { 0u, 8699564697382289408u, 11512248212u }, { 0u, 4224376450473525248u, 148471604347u }, { 0u, 4611686018427387904u, 123229003906u }, { 0u, 0u, 130250000000u }, { 0u, 0u, 128000000000u }, { 748977172262750475u, 175162308u, 0u }, { 15965033457315095468u, 175162308040602133u, 0u }, { 16809402149066729206u, 13756840147955779925u, 9495567u }, { 7563769067065700371u, 13788447602092505948u, 15745759798u }, { 13550322810840051428u, 4972540435632173670u, 54747473242u }, { 8663209637545764864u, 2844874687533091959u, 90269561957u }, { 8969247575312957440u, 15377573779532804095u, 101154220965u }, { 6193172891660451840u, 17824715805091194381u, 165833619944u }, { 3427954273864908800u, 18277569135638159711u, 232966279779u }, { 10058367555266936832u, 4254645803379752845u, 99990829008u }, { 13907115649320091648u, 2933643244178200621u, 208230644811u }, { 0u, 17188148801879487562u, 75159033118u }, { 0u, 11069762501163246592u, 30931771413u }, { 0u, 11676570643941818368u, 21600093027u }, { 0u, 17840016768744030208u, 99632988162u }, { 0u, 16463817321652158464u, 2967109246u }, { 0u, 6954191143357644800u, 126892505325u }, { 0u, 5080060379673919488u, 237376987457u }, { 0u, 0u, 65275390625u }, { 0u, 0u, 161000000000u }, { 14106411361315920281u, 2672u, 0u }, { 3609034283485221502u, 2672764710092u, 0u }, { 9896072247338192335u, 16433563478020213436u, 144u }, { 8889095178479228297u, 4194750497955655375u, 144890865261u }, { 3631796911038383102u, 2691539602252904735u, 109227397880u }, { 898318840772166823u, 3775467271962795241u, 248145908654u }, { 17293677953982795024u, 16980212613224918121u, 174204668490u }, { 7353628266884669440u, 4172857038337333440u, 74920499170u }, { 2404693032470315008u, 5936867627376461659u, 226226211033u }, { 9191155893041889280u, 17856837443266866062u, 217321838238u }, { 6353946855033798656u, 8956297047799810807u, 158968021097u }, { 3767824038248841216u, 15356974049716912789u, 105485521835u }, { 7205759403792793600u, 6923608913322982854u, 171832503231u }, { 0u, 4855902993563955944u, 191375329591u }, { 0u, 13835893222288330752u, 55263239028u }, { 0u, 9114973913760137216u, 116750045274u }, { 0u, 17937099003422310400u, 90494123725u }, { 0u, 7007960010734960640u, 205972372085u }, { 0u, 7683422439270776832u, 117379902273u }, { 0u, 720575940379279360u, 65416519165u }, { 0u, 0u, 253039062500u }, { 0u, 0u, 228000000000u }, { 17063068157692817751u, 40783152u, 0u }, { 5385330256507239985u, 40783152924990778u, 0u }, { 3373050282752075748u, 2768933352715741194u, 2210859u }, { 4116064001262906061u, 15201941611824153390u, 43150104177u }, { 11306582046748043076u, 1418128541727000180u, 113824098906u }, { 17035410946089626406u, 5353350204565757408u, 90076876902u }, { 15618595715183448558u, 1721001680354286741u, 102290205696u }, { 5141740092277295680u, 637631411660453962u, 93295688u }, { 16973644291514990592u, 1630012588870568400u, 72034566068u }, { 14625255268443750400u, 9253063571656828156u, 180088363159u }, { 14021170507320131584u, 6029146854993203780u, 151501609581u }, { 4451355232865091584u, 16987401965352759896u, 109326840705u }, { 12891553933348044800u, 14499131620542087970u, 129920888905u }, { 1152921504606846976u, 1978417255298660539u, 73785999500u }, { 0u, 5790079354402454176u, 140107250214u }, { 0u, 13748918935842078720u, 38313880830u }, { 0u, 18047438014740692992u, 254745330388u }, { 0u, 3116889656839372800u, 212978353575u }, { 0u, 15995952446606147584u, 167168966926u }, { 0u, 12530140063251562496u, 14867142319u }, { 0u, 16717361816799281152u, 175679260253u }, { 0u, 0u, 93906250000u }, { 0u, 0u, 16000000000u }, { 5562205901560339855u, 622u, 0u }, { 2106077949367544134u, 622301527786u, 0u }, { 7496855998374373623u, 13558973353698967386u, 33u }, { 229183437194837004u, 6228991722850501890u, 33735033418u }, { 465169186276472889u, 16886831391703377787u, 74337674317u }, { 2152980561625316473u, 1181713637872883048u, 77915436964u }, { 2059790725449340402u, 12393932434925221726u, 164064060824u }, { 17891190926410198930u, 10684799845419711910u, 152671876423u }, { 9930696175609809814u, 4590318792215640843u, 71579224160u }, { 7276914261609005312u, 6383712187366189238u, 96248841680u }, { 10539762974036983808u, 1904270214927675016u, 208346061731u }, { 12851089458992250880u, 3711506775113308575u, 163103230695u }, { 9449311677678878720u, 8091219444738793995u, 231201201185u }, { 8699564697382289408u, 39436684991068052u, 33438625885u }, { 4224376450473525248u, 18025182908196512891u, 93002137866u }, { 4611686018427387904u, 7853924592034603138u, 10977147123u }, { 0u, 4815749283615688320u, 243425762105u }, { 0u, 14242399906544287744u, 57261062291u }, { 0u, 76242322576113664u, 147772082046u }, { 0u, 10858088421377703936u, 126004133104u }, { 0u, 14293835879041466368u, 240588618152u }, { 0u, 12182236992037191680u, 168774870395u }, { 0u, 11529215046068469760u, 123660400390u }, { 0u, 0u, 6625000000u }, { 0u, 0u, 64000000000u }, { 13756840147955779925u, 9495567u, 0u }, { 13788447602092505948u, 9495567745759798u, 0u }, { 4972540435632173670u, 14000097438505379162u, 514755u }, { 2844874687533091959u, 16451062686452429925u, 195758946802u }, { 15377573779532804095u, 4009347599785716645u, 242891813895u }, { 17824715805091194381u, 16544162347546196456u, 7217347168u }, { 18277569135638159711u, 17674258299745817187u, 96896860837u }, { 4254645803379752845u, 5215238411201214416u, 165958123462u }, { 2933643244178200621u, 14253990228345322571u, 198282718640u }, { 17188148801879487562u, 11214836553940194590u, 176772710358u }, { 11069762501163246592u, 14620711348380590101u, 214607957507u }, { 11676570643941818368u, 6638710787931587427u, 3792590350u }, { 17840016768744030208u, 17320000343692853250u, 14359885232u }, { 16463817321652158464u, 75147386268843646u, 176938919100u }, { 6954191143357644800u, 17938801582125480173u, 188004073747u }, { 5080060379673919488u, 6573358613626446145u, 19972464382u }, { 0u, 8688505427903736481u, 254356342484u }, { 0u, 539870168696556032u, 212471004823u }, { 0u, 9002861336394465280u, 151029266420u }, { 0u, 17989846818158018560u, 244488046090u }, { 0u, 2700938287723315200u, 10975231550u }, { 0u, 17800090499088908288u, 62146418157u }, { 0u, 8809040871136690176u, 237964944839u }, { 0u, 9223372036854775808u, 199477539062u }, { 0u, 0u, 246500000000u }, { 16433563478020213436u, 144u, 0u }, { 4194750497955655375u, 144890865261u, 0u }, { 2691539602252904735u, 15763656745260536568u, 7u }, { 3775467271962795241u, 8787336846248645550u, 7854549544u }, { 16980212613224918121u, 17584084447880694346u, 40476362484u }, { 4172857038337333440u, 18041672551129683938u, 244953235127u }, { 5936867627376461659u, 14025886302294509785u, 183978041028u }, { 17856837443266866062u, 18430498103283160734u, 196760344819u }, { 8956297047799810807u, 3292348826238025833u, 243999119304u }, { 15356974049716912789u, 9211721212658275243u, 200178478587u }, { 6923608913322982854u, 10233245872666307519u, 251499368407u }, { 4855902993563955944u, 6200995035623311671u, 215554745370u }, { 13835893222288330752u, 8480542380570450804u, 26336156614u }, { 9114973913760137216u, 11870363864499900506u, 198459731123u }, { 17937099003422310400u, 9301051379839581901u, 179643493714u }, { 7007960010734960640u, 11456694803569638005u, 82504211005u }, { 7683422439270776832u, 14327208890643983169u, 61621068669u }, { 720575940379279360u, 4510081789599866365u, 125776679550u }, { 0u, 13255356976020303332u, 126244492023u }, { 0u, 9658806854127314944u, 247718574341u }, { 0u, 13708435528809971712u, 5523604968u }, { 0u, 1580190652103131136u, 232743135779u }, { 0u, 16557336970347413504u, 35085662306u }, { 0u, 12751520132434493440u, 98897575035u }, { 0u, 9295429630892703744u, 123691261291u }, { 0u, 0u, 107503906250u }, { 0u, 0u, 202000000000u }, { 2768933352715741194u, 2210859u, 0u }, { 15201941611824153390u, 2210859150104177u, 0u }, { 1418128541727000180u, 16872870088062921306u, 119850u }, { 5353350204565757408u, 5112979788807802982u, 42914680120u }, { 1721001680354286741u, 13742728082020150272u, 56277175189u }, { 637631411660453962u, 2217110934613627976u, 149744994782u }, { 1630012588870568400u, 11021433940188610484u, 222120189824u }, { 9253063571656828156u, 1713669895470733463u, 128597473131u }, { 6029146854993203780u, 3313382510572018285u, 107092898231u }, { 16987401965352759896u, 14976595232784069505u, 183179618825u }, { 14499131620542087970u, 7213172372862496841u, 9811882854u }, { 1978417255298660539u, 15836474542502248588u, 102391026857u }, { 5790079354402454176u, 3221099285878340134u, 169858497005u }, { 13748918935842078720u, 3265814602578095358u, 237174616142u }, { 18047438014740692992u, 6502528252282225364u, 78177040164u }, { 3116889656839372800u, 16392476834556790183u, 36352502762u }, { 15995952446606147584u, 15167629413417091342u, 234888637949u }, { 12530140063251562496u, 1366763272626280111u, 253822238838u }, { 16717361816799281152u, 8720523635169216093u, 118074092385u }, { 0u, 9649171375767398672u, 97472740533u }, { 0u, 7647980704001073152u, 181523082628u }, { 0u, 13286434495608651776u, 132414597864u }, { 0u, 4358271637167013888u, 232720259057u }, { 0u, 15954987941890097152u, 241236262378u }, { 0u, 7911135695429697536u, 234864921629u }, { 0u, 7205759403792793600u, 29428863525u }, { 0u, 0u, 37390625000u }, { 0u, 0u, 232000000000u }, { 13558973353698967386u, 33u, 0u }, { 6228991722850501890u, 33735033418u, 0u }, { 16886831391703377787u, 15288289344628122701u, 1u }, { 1181713637872883048u, 952589339068938148u, 1828779826u }, { 12393932434925221726u, 10058155040190817688u, 50051639971u }, { 10684799845419711910u, 5322725640026584391u, 163545253677u }, { 4590318792215640843u, 2269982385930389600u, 45288545535u }, { 6383712187366189238u, 13216683679976310224u, 255123055991u }, { 1904270214927675016u, 17417440642083494819u, 119716477857u }, { 3711506775113308575u, 3029180749090900711u, 161944201349u }, { 8091219444738793995u, 8315443826261908513u, 133164212217u }, { 39436684991068052u, 1488962797247197277u, 249450781113u }, { 18025182908196512891u, 18009099634999034122u, 185080716834u }, { 7853924592034603138u, 8092455412807497971u, 34976275247u }, { 4815749283615688320u, 17808458047236758329u, 47438692886u }, { 14242399906544287744u, 3164591817527425171u, 22965398445u }, { 76242322576113664u, 3314036340472350590u, 173171552866u }, { 10858088421377703936u, 33234902404332784u, 98179654270u }, { 14293835879041466368u, 12349284717857274280u, 126001801667u }, { 12182236992037191680u, 18209607903013119355u, 195669456065u }, { 11529215046068469760u, 7891549145984268038u, 193987144822u }, { 0u, 7703609897518594624u, 118427801736u }, { 0u, 6336912652634587136u, 136417613529u }, { 0u, 4461621834659397632u, 217343524723u }, { 0u, 5484660635557953536u, 115241865004u }, { 0u, 15142619273265938432u, 44297324048u }, { 0u, 12170977992968765440u, 16820883035u }, { 0u, 1152921504606846976u, 91659790039u }, { 0u, 0u, 215062500000u }, { 0u, 0u, 160000000000u }, { 14000097438505379162u, 514755u, 0u }, { 16451062686452429925u, 514755758946802u, 0u }, { 4009347599785716645u, 17812314011563521031u, 27904u }, { 16544162347546196456u, 7684138864490314336u, 965607477u }, { 17674258299745817187u, 9740522787420029605u, 53416558002u }, { 5215238411201214416u, 6701109407732989894u, 178528034798u }, { 14253990228345322571u, 16534886227502443952u, 238363267868u }, { 11214836553940194590u, 8908667306968317910u, 28896357978u }, { 14620711348380590101u, 7531472173477105155u, 90482939822u }, { 6638710787931587427u, 11527371604834801166u, 174408281924u }, { 17320000343692853250u, 15688593496691078576u, 68624900066u }, { 75147386268843646u, 11394944804253312188u, 226850480357u }, { 17938801582125480173u, 11182279880854372627u, 229617721195u }, { 6573358613626446145u, 150579373068361470u, 107606192607u }, { 8688505427903736481u, 3147220002440857300u, 223008162924u }, { 539870168696556032u, 3630514817795505815u, 108170611138u }, { 9002861336394465280u, 11708796588334233588u, 194196810602u }, { 17989846818158018560u, 16844495466426369546u, 106634735134u }, { 2700938287723315200u, 17636655472325475902u, 30913141928u }, { 17800090499088908288u, 17038926655686645229u, 168956085008u }, { 8809040871136690176u, 15602838456783529415u, 16923682064u }, { 9223372036854775808u, 10869815869248876790u, 16845831567u }, { 0u, 18407124180939800832u, 143589253898u }, { 0u, 5705018517251293184u, 10997852201u }, { 0u, 9660452258743058432u, 41309269673u }, { 0u, 5646292272224927744u, 169523694166u }, { 0u, 7410409304047484928u, 86306086117u }, { 0u, 5953758707383795712u, 229401719093u }, { 0u, 4611686018427387904u, 53322753906u }, { 0u, 0u, 114250000000u }, { 0u, 0u, 128000000000u }, { 15763656745260536568u, 7u, 0u }, { 8787336846248645550u, 7854549544u, 0u }, { 17584084447880694346u, 7854549544476362484u, 0u }, { 18041672551129683938u, 15035424419724983u, 425795984u }, { 14025886302294509785u, 18280822466032836292u, 144000815071u }, { 18430498103283160734u, 11524250747302615283u, 223991005371u }, { 3292348826238025833u, 15212285943691810760u, 187624730884u }, { 9211721212658275243u, 7951804027551297019u, 4824659673u }, { 10233245872666307519u, 1706416229965221847u, 217431068160u }, { 6200995035623311671u, 3406023111930700826u, 92505009u }, { 8480542380570450804u, 16132696204133391302u, 177184640882u }, { 11870363864499900506u, 11593846688794356915u, 114874555213u }, { 9301051379839581901u, 6875759884161133906u, 77628503688u }, { 11456694803569638005u, 3593593325323835965u, 136372735690u }, { 14327208890643983169u, 9542049733257388925u, 202194809084u }, { 4510081789599866365u, 9926551925937787518u, 252517275552u }, { 13255356976020303332u, 3128491553219547895u, 160538119458u }, { 9658806854127314944u, 17158408656931354885u, 34169595866u }, { 13708435528809971712u, 2065169543154992616u, 218930159197u }, { 1580190652103131136u, 4832622393556232739u, 93111953065u }, { 16557336970347413504u, 16505930714733656162u, 169261976984u }, { 12751520132434493440u, 18270988073492888699u, 152894788296u }, { 9295429630892703744u, 2525111411519708523u, 200990472248u }, { 0u, 16728989342518570442u, 56136886563u }, { 0u, 7974052022039438336u, 35906880329u }, { 0u, 5356554962386550784u, 73432274226u }, { 0u, 6693869495028547584u, 50290379426u }, { 0u, 8157517147199766528u, 162362875392u }, { 0u, 12065776720423157760u, 442219890u }, { 0u, 11997589407315001344u, 114654087066u }, { 0u, 0u, 154650390625u }, { 0u, 0u, 97000000000u }, { 16872870088062921306u, 119850u, 0u }, { 5112979788807802982u, 119850914680120u, 0u }, { 13742728082020150272u, 2418433229320326037u, 6497u }, { 2217110934613627976u, 1143911773589293534u, 97131103528u }, { 11021433940188610484u, 9276183703610924928u, 40062011581u }, { 1713669895470733463u, 3532180128827684715u, 189502862926u }, { 3313382510572018285u, 8563997501322031543u, 78191479868u }, { 14976595232784069505u, 14843890409658460681u, 60464255234u }, { 7213172372862496841u, 9489417861634552678u, 2804688911u }, { 15836474542502248588u, 1113198223322322089u, 15514422373u }, { 3221099285878340134u, 11190777557146597869u, 101060346596u }, { 3265814602578095358u, 17764553645932638286u, 228606653266u }, { 6502528252282225364u, 14900777150991234852u, 82963018382u }, { 16392476834556790183u, 17364899863357893610u, 142807772747u }, { 15167629413417091342u, 15537570181590167037u, 75941353107u }, { 1366763272626280111u, 5558052627121307766u, 147842293367u }, { 8720523635169216093u, 12095241565795232609u, 119301302636u }, { 9649171375767398672u, 2187936505958366389u, 108655684359u }, { 7647980704001073152u, 12009203621325860228u, 7118608275u }, { 13286434495608651776u, 14814842834750302952u, 147651020232u }, { 4358271637167013888u, 5965296499605198833u, 200803114239u }, { 15954987941890097152u, 4051026394962148842u, 255323379371u }, { 7911135695429697536u, 16799526299141688349u, 171219606580u }, { 7205759403792793600u, 9460214166646215205u, 52910704145u }, { 0u, 10750736995029068008u, 17512839237u }, { 0u, 5377963045376430080u, 69582798620u }, { 0u, 15996910350253424640u, 28291539960u }, { 0u, 13651157529655246848u, 248867194247u }, { 0u, 9771305410219737088u, 135740030732u }, { 0u, 12709439623416250368u, 12529703527u }, { 0u, 9943947977234055168u, 103688980102u }, { 0u, 0u, 134539062500u }, { 0u, 0u, 228000000000u }, { 952589339068938148u, 1828779826u, 0u }, { 10058155040190817688u, 1828779826051639971u, 0u }, { 5322725640026584391u, 371564423966525229u, 99138353u }, { 2269982385930389600u, 14464859121514339583u, 49020142547u }, { 13216683679976310224u, 3913119023023056247u, 211784141584u }, { 17417440642083494819u, 5493396321716566945u, 16212130607u }, { 3029180749090900711u, 5837454566818211973u, 47297797611u }, { 8315443826261908513u, 2886670683193253881u, 235316449046u }, { 1488962797247197277u, 5504823105587173817u, 22156486731u }, { 18009099634999034122u, 9431834277334851106u, 75298417058u }, { 8092455412807497971u, 12921661346456247087u, 162511300760u }, { 17808458047236758329u, 3643076516404724246u, 152700484665u }, { 3164591817527425171u, 12559396953196866477u, 57197491573u }, { 3314036340472350590u, 1626880974916825698u, 117680846273u }, { 33234902404332784u, 6806994170946429566u, 193088193394u }, { 12349284717857274280u, 7596631230206896579u, 114369007893u }, { 18209607903013119355u, 3100480253729502401u, 21411814204u }, { 7891549145984268038u, 6310570748781063286u, 60168077371u }, { 7703609897518594624u, 14251867077375744136u, 59342096725u }, { 6336912652634587136u, 6701165793751570137u, 85772595262u }, { 4461621834659397632u, 10856833140463959923u, 62363270925u }, { 5484660635557953536u, 15867563727561248556u, 13588550103u }, { 15142619273265938432u, 5048961008671491600u, 215860182353u }, { 12170977992968765440u, 13278183119599849051u, 81273704724u }, { 1152921504606846976u, 4547591784941053655u, 20719811749u }, { 0u, 11815437715887182496u, 165246525444u }, { 0u, 398495392178782208u, 4640516162u }, { 0u, 9154841240825495552u, 66021602478u }, { 0u, 1902683298245640192u, 174496284938u }, { 0u, 5081900962138816512u, 10103144668u }, { 0u, 3234710432358858752u, 220275490403u }, { 0u, 16717361816799281152u, 99175354003u }, { 0u, 0u, 147906250000u }, { 0u, 0u, 16000000000u }, { 17812314011563521031u, 27904u, 0u }, { 7684138864490314336u, 27904965607477u, 0u }, { 9740522787420029605u, 13488568028574514610u, 1512u }, { 6701109407732989894u, 275784718433886190u, 232731216738u }, { 16534886227502443952u, 10020568880357102364u, 98014950319u }, { 8908667306968317910u, 8876397213146246746u, 175543216127u }, { 7531472173477105155u, 2155905919114811310u, 255481190457u }, { 11527371604834801166u, 1087100407155601220u, 57116871894u }, { 15688593496691078576u, 2903498381705011170u, 214058931831u }, { 11394944804253312188u, 12223476257006657765u, 119157398962u }, { 11182279880854372627u, 12148657163736735595u, 178662635975u }, { 150579373068361470u, 8951241323311673823u, 199658580024u }, { 3147220002440857300u, 8463862715901576300u, 56485247764u }, { 3630514817795505815u, 3873401978748963266u, 20458826917u }, { 11708796588334233588u, 248364795947002730u, 165209977542u }, { 16844495466426369546u, 10454378025404001822u, 198013463882u }, { 17636655472325475902u, 6574176865628265640u, 74566732968u }, { 17038926655686645229u, 16703315293848336u, 168356386842u }, { 15602838456783529415u, 9896033222450013456u, 26000905488u }, { 10869815869248876790u, 17311376269334085007u, 16536465035u }, { 18407124180939800832u, 18378511316495639306u, 139938451587u }, { 5705018517251293184u, 15120796393727584297u, 131996301094u }, { 9660452258743058432u, 18253447805740347049u, 38819700014u }, { 5646292272224927744u, 5842497225601731158u, 46989521388u }, { 7410409304047484928u, 4369968404176723173u, 236316722409u }, { 5953758707383795712u, 16142207253674488117u, 233236896461u }, { 4611686018427387904u, 12124259227391928178u, 205875070808u }, { 0u, 13019483264566077056u, 88657257409u }, { 0u, 74901376448135168u, 193705787602u }, { 0u, 13897060093813325824u, 210004060411u }, { 0u, 4495486210810052608u, 251753361137u }, { 0u, 14885496280087265280u, 241243700795u }, { 0u, 4976477588244398080u, 59806944370u }, { 0u, 11529215046068469760u, 114269775390u }, { 0u, 0u, 30625000000u }, { 0u, 0u, 64000000000u }, { 15035424419724983u, 425795984u, 0u }, { 18280822466032836292u, 425795984000815071u, 0u }, { 11524250747302615283u, 10043594327130472635u, 23082446u }, { 15212285943691810760u, 8336034337032909060u, 206544464339u }, { 7951804027551297019u, 16717215784895280857u, 211451897326u }, { 1706416229965221847u, 10968831263951212032u, 238906242083u }, { 3406023111930700826u, 5536629379734406065u, 35594621534u }, { 16132696204133391302u, 1618806894932332402u, 94300141280u }, { 11593846688794356915u, 11363331325254998861u, 224087755697u }, { 6875759884161133906u, 8775167772751754888u, 177616007425u }, { 3593593325323835965u, 2898202945316114122u, 1475702798u }, { 9542049733257388925u, 8868842714495185148u, 14157111896u }, { 9926551925937787518u, 17052094667531999136u, 88480780926u }, { 3128491553219547895u, 3658615537031138594u, 126924395904u }, { 17158408656931354885u, 12486952437987190746u, 128198333945u }, { 2065169543154992616u, 912079238520577629u, 249676919048u }, { 4832622393556232739u, 10960072898031888041u, 8049443914u }, { 16505930714733656162u, 6129550094334741912u, 74594146742u }, { 18270988073492888699u, 7965724516573729480u, 182332283576u }, { 2525111411519708523u, 5801761178810791992u, 184431822791u }, { 16728989342518570442u, 13197466483098446115u, 199314514103u }, { 7974052022039438336u, 11326268638393107273u, 183715436091u }, { 5356554962386550784u, 3597339351794947378u, 59613998253u }, { 6693869495028547584u, 353880726151383714u, 173195012157u }, { 8157517147199766528u, 11154818162602073600u, 61019183912u }, { 12065776720423157760u, 5141043976157511026u, 40604703904u }, { 11997589407315001344u, 7188225141808859034u, 160278696552u }, { 0u, 13894168943295705185u, 104389674465u }, { 0u, 12176538069834828288u, 225753204407u }, { 0u, 7994239409235165184u, 183660091451u }, { 0u, 13707777025480065024u, 59433368586u }, { 0u, 10120227247676719104u, 10743100081u }, { 0u, 7358494763030413312u, 177548618618u }, { 0u, 7656119366529843200u, 122398904800u }, { 0u, 9223372036854775808u, 224415039062u }, { 0u, 0u, 86500000000u }, { 2418433229320326037u, 6497u, 0u }, { 1143911773589293534u, 6497131103528u, 0u }, { 9276183703610924928u, 3877189582299842749u, 352u }, { 3532180128827684715u, 7625565791857948238u, 96210182868u }, { 8563997501322031543u, 16568435163612007484u, 212413382749u }, { 14843890409658460681u, 17592071940521808130u, 93898176669u }, { 9489417861634552678u, 15158637878035490831u, 157953668130u }, { 1113198223322322089u, 17789243229146401893u, 34821751405u }, { 11190777557146597869u, 14677686051252896484u, 109964356807u }, { 17764553645932638286u, 3531237481269211986u, 199795678955u }, { 14900777150991234852u, 8074435404989280910u, 235191428767u }, { 17364899863357893610u, 7086549341467684427u, 159437716020u }, { 15537570181590167037u, 10556134770918626963u, 52384162609u }, { 5558052627121307766u, 10772666134712966775u, 49572249212u }, { 12095241565795232609u, 6195173298198112620u, 124583987401u }, { 2187936505958366389u, 8144773843324250887u, 201335841017u }, { 12009203621325860228u, 14144284817150924691u, 249441529074u }, { 14814842834750302952u, 6464447844648863176u, 242766763216u }, { 5965296499605198833u, 15760468443293179135u, 208350438419u }, { 4051026394962148842u, 5172191224908322475u, 19854376706u }, { 16799526299141688349u, 2357554307308969012u, 2280385048u }, { 9460214166646215205u, 1602046917604361745u, 24127803275u }, { 10750736995029068008u, 7830970218109515845u, 139086847137u }, { 5377963045376430080u, 2899479134887821084u, 161424517746u }, { 15996910350253424640u, 15792042302392017912u, 114157181078u }, { 13651157529655246848u, 11286099112296056199u, 150856088328u }, { 9771305410219737088u, 15161477829153947404u, 8611820658u }, { 12709439623416250368u, 423831848142641767u, 114821905360u }, { 9943947977234055168u, 9707413321046312582u, 208022975970u }, { 0u, 10969483299803835620u, 226526239930u }, { 0u, 4326479556120930304u, 186594656881u }, { 0u, 12876227232041795584u, 113234538926u }, { 0u, 16967986827791171584u, 174698021676u }, { 0u, 1288146316538413056u, 44919836409u }, { 0u, 13715290452691779584u, 249069830551u }, { 0u, 4683743612465315840u, 151743507385u }, { 0u, 0u, 185253906250u }, { 0u, 0u, 74000000000u }, { 371564423966525229u, 99138353u, 0u }, { 14464859121514339583u, 99138353020142547u, 0u }, { 3913119023023056247u, 16344805304534272784u, 5374300u }, { 5493396321716566945u, 26429987091348271u, 92886053671u }, { 5837454566818211973u, 8691371289609838059u, 39001432772u }, { 2886670683193253881u, 12980168378493046550u, 196471160181u }, { 5504823105587173817u, 14010125458129496139u, 117703656337u }, { 9431834277334851106u, 17061829677031795106u, 145759490422u }, { 12921661346456247087u, 2227928323072698520u, 118924923640u }, { 3643076516404724246u, 7394752319272287289u, 248120776236u }, { 12559396953196866477u, 8805771303577744757u, 44400870326u }, { 1626880974916825698u, 16371027194302248385u, 182477361818u }, { 6806994170946429566u, 9114324123731231602u, 154887475162u }, { 7596631230206896579u, 14468189808746991893u, 218494088500u }, { 3100480253729502401u, 2376054557800684348u, 52784322141u }, { 6310570748781063286u, 12462238943546048571u, 93128806175u }, { 14251867077375744136u, 15334855370842605909u, 31675579326u }, { 6701165793751570137u, 7211347914013798462u, 190831304175u }, { 10856833140463959923u, 13763642332572548877u, 239390927953u }, { 15867563727561248556u, 16868268377740071383u, 81746128545u }, { 5048961008671491600u, 1120013377627684177u, 161914430661u }, { 13278183119599849051u, 15898107650717274388u, 197060716046u }, { 4547591784941053655u, 12281923376333274277u, 14861838142u }, { 11815437715887182496u, 6383530489286615044u, 62665804400u }, { 398495392178782208u, 4253822060257126466u, 112346051881u }, { 9154841240825495552u, 17614372438391501998u, 41230600155u }, { 1902683298245640192u, 4309951310554333450u, 219954877043u }, { 5081900962138816512u, 13106185988973773020u, 115233642928u }, { 3234710432358858752u, 2070134359761960547u, 176710487766u }, { 16717361816799281152u, 9399359914137865875u, 214112222208u }, { 0u, 17415053284723541264u, 509540321u }, { 0u, 4840502610448261120u, 225944071930u }, { 0u, 5690599259712258048u, 250262404172u }, { 0u, 114769594245185536u, 76308488004u }, { 0u, 3150620882578178048u, 68006221672u }, { 0u, 5136918324969472000u, 104170795500u }, { 0u, 7205759403792793600u, 236278472900u }, { 0u, 0u, 196390625000u }, { 0u, 0u, 232000000000u }, { 13488568028574514610u, 1512u, 0u }, { 275784718433886190u, 1512731216738u, 0u }, { 10020568880357102364u, 98202693831717807u, 82u }, { 8876397213146246746u, 12909287260170414079u, 82005323578u }, { 2155905919114811310u, 11728631949380786233u, 58699813864u }, { 1087100407155601220u, 18263701925522197718u, 232635810411u }, { 2903498381705011170u, 4868886449713321591u, 107990077265u }, { 12223476257006657765u, 5870139507184082354u, 81263942863u }, { 12148657163736735595u, 5978562500822661575u, 207318220900u }, { 8951241323311673823u, 10821136839630268472u, 100324098522u }, { 8463862715901576300u, 9490907630136752916u, 218586615003u }, { 3873401978748963266u, 10564005678001613989u, 219514503133u }, { 248364795947002730u, 5754050547468481222u, 221572675895u }, { 10454378025404001822u, 3833909949855542602u, 55311927705u }, { 6574176865628265640u, 15446538552665967784u, 153207836674u }, { 16703315293848336u, 14924837848804399130u, 2837358532u }, { 9896033222450013456u, 18140170340418344208u, 196809077080u }, { 17311376269334085007u, 11380424819825208971u, 88983380604u }, { 18378511316495639306u, 12416915664152252547u, 124616934065u }, { 15120796393727584297u, 17195282241626289958u, 177673122346u }, { 18253447805740347049u, 2649541045825281326u, 42932158118u }, { 5842497225601731158u, 16577429864268509676u, 166143631907u }, { 4369968404176723173u, 12051257060168107241u, 35898664273u }, { 16142207253674488117u, 5363884561143470797u, 81653299954u }, { 12124259227391928178u, 13054029903083620184u, 242290776764u }, { 13019483264566077056u, 566314952158634945u, 188707660379u }, { 74901376448135168u, 1329472079642345682u, 91030699995u }, { 13897060093813325824u, 15686237486658857211u, 219072070825u }, { 4495486210810052608u, 1069073549290598129u, 169850352638u }, { 14885496280087265280u, 4323599065125928507u, 254057954593u }, { 4976477588244398080u, 17861823329752681586u, 33234382774u }, { 11529215046068469760u, 17220149985412802078u, 182968291382u }, { 0u, 4344934572159429184u, 54933506201u }, { 0u, 2252927464837120000u, 153235539375u }, { 0u, 10910018171964489728u, 175122131442u }, { 0u, 3597328585515335680u, 242591433270u }, { 0u, 6972808074239148032u, 54195011573u }, { 0u, 2227030015734710272u, 245377996683u }, { 0u, 1152921504606846976u, 139120727539u }, { 0u, 0u, 243062500000u }, { 0u, 0u, 160000000000u }, { 10043594327130472635u, 23082446u, 0u }, { 8336034337032909060u, 23082446544464339u, 0u }, { 16717215784895280857u, 17238287503805244910u, 1251301u }, { 10968831263951212032u, 1434575446038410275u, 229934489438u }, { 5536629379734406065u, 14009569747841241694u, 94077768490u }, { 1618806894932332402u, 14938795732275951328u, 42759460297u }, { 11363331325254998861u, 6687653542888983473u, 201809833739u }, { 8775167772751754888u, 28238723295162625u, 11362538425u }, { 2898202945316114122u, 4745270274832691214u, 185001530824u }, { 8868842714495185148u, 926478968112308824u, 200257241617u }, { 17052094667531999136u, 9213681606604198526u, 17050224525u }, { 3658615537031138594u, 13346223820579313024u, 141499474680u }, { 12486952437987190746u, 691642518601291257u, 248723500243u }, { 912079238520577629u, 1153720150033789192u, 211037494016u }, { 10960072898031888041u, 12089015034721780810u, 62543294u }, { 6129550094334741912u, 3555868702841788854u, 190655346818u }, { 7965724516573729480u, 11708406782758214328u, 130192764028u }, { 5801761178810791992u, 9417497762905343943u, 124634714003u }, { 13197466483098446115u, 12838336066957615287u, 147510523576u }, { 11326268638393107273u, 13737708142128207419u, 184695967592u }, { 3597339351794947378u, 11683434809834695853u, 104744722650u }, { 353880726151383714u, 2689114340106315837u, 218633360270u }, { 11154818162602073600u, 8859225263374261032u, 142145777180u }, { 5141043976157511026u, 15761671984578600096u, 28480259563u }, { 7188225141808859034u, 7087267079878005352u, 235854441950u }, { 13894168943295705185u, 4601291730423121377u, 222384201518u }, { 12176538069834828288u, 9559411037059581623u, 46249436524u }, { 7994239409235165184u, 12969820289641388091u, 108518216710u }, { 13707777025480065024u, 13628239920285957130u, 6703095366u }, { 10120227247676719104u, 8049893933765800625u, 70738788366u }, { 7358494763030413312u, 10391755948840250234u, 14436385624u }, { 7656119366529843200u, 14454650777462444512u, 88563338218u }, { 9223372036854775808u, 14244638523341127254u, 234783588188u }, { 0u, 12246016810439753984u, 92772203401u }, { 0u, 9382741764551081984u, 137663857901u }, { 0u, 4608696190291148800u, 237508639450u }, { 0u, 1696483666416369664u, 218249837921u }, { 0u, 15416683541605384192u, 97091966563u }, { 0u, 7683140964294066176u, 99835740089u }, { 0u, 4611686018427387904u, 185416503906u }, { 0u, 0u, 98250000000u }, { 0u, 0u, 128000000000u }, { 3877189582299842749u, 352u, 0u }, { 7625565791857948238u, 352210182868u, 0u }, { 16568435163612007484u, 1722045467931902045u, 19u }, { 17592071940521808130u, 16095324008152856733u, 19093352271u }, { 15158637878035490831u, 15216188060094280738u, 79872529262u }, { 17789243229146401893u, 10793385929903030893u, 110824871207u }, { 14677686051252896484u, 12613277226875940039u, 39585110623u }, { 3531237481269211986u, 10644539625155600107u, 95683767128u }, { 8074435404989280910u, 6181262895644173983u, 88577041649u }, { 7086549341467684427u, 148914399627082292u, 241335086933u }, { 10556134770918626963u, 14379289774887985969u, 85008072665u }, { 10772666134712966775u, 11743339675582627452u, 217779502860u }, { 6195173298198112620u, 7841621929809463497u, 12636607719u }, { 8144773843324250887u, 11168944680251236601u, 231425095176u }, { 14144284817150924691u, 6178560202529287410u, 8605469704u }, { 6464447844648863176u, 13295243308201596112u, 8334940419u }, { 15760468443293179135u, 17040673746172470291u, 3720736583u }, { 5172191224908322475u, 14957442487039409922u, 71923776774u }, { 2357554307308969012u, 17778155426506992152u, 6810844581u }, { 1602046917604361745u, 14945404984219733899u, 165963755736u }, { 7830970218109515845u, 11590754866058681505u, 216810192027u }, { 2899479134887821084u, 6020790784469412466u, 155628336080u }, { 15792042302392017912u, 7934351824569522326u, 208326387722u }, { 11286099112296056199u, 5038361112172116744u, 10430122074u }, { 15161477829153947404u, 3305187319649924210u, 90273130103u }, { 423831848142641767u, 11470175511099161552u, 119179174563u }, { 9707413321046312582u, 7308362160352048610u, 163621799460u }, { 10969483299803835620u, 10666410671225576634u, 36396187106u }, { 4326479556120930304u, 2181639019945820785u, 226578227281u }, { 12876227232041795584u, 4615749499734847918u, 81118266888u }, { 16967986827791171584u, 14076159200958497580u, 8250220281u }, { 1288146316538413056u, 5470405257862074105u, 249763070119u }, { 13715290452691779584u, 4565741478181339543u, 167296551263u }, { 4683743612465315840u, 8901832997861862329u, 95247509341u }, { 0u, 14190141170191714122u, 93482569333u }, { 0u, 4240772322245764096u, 117769249094u }, { 0u, 4422842195340951552u, 70229892728u }, { 0u, 15448426386733137920u, 120239762755u }, { 0u, 9203504548935630848u, 67837460872u }, { 0u, 5936377627571912704u, 136498922981u }, { 0u, 468374361246531584u, 229321811676u }, { 0u, 0u, 220025390625u }, { 0u, 0u, 33000000000u }, { 16344805304534272784u, 5374300u, 0u }, { 26429987091348271u, 5374300886053671u, 0u }, { 8691371289609838059u, 8020875056524075716u, 291341u }, { 12980168378493046550u, 1400288714762747253u, 13434812508u }, { 14010125458129496139u, 6136037711314764689u, 92075909803u }, { 17061829677031795106u, 15735488086392394102u, 171332635270u }, { 2227928323072698520u, 7735094782793634552u, 134853022518u }, { 7394752319272287289u, 7273689191766726188u, 54419320328u }, { 8805771303577744757u, 3410634565056431030u, 8394307481u }, { 16371027194302248385u, 4600927904885215898u, 153184890870u }, { 9114324123731231602u, 9154871331680374746u, 246249416801u }, { 14468189808746991893u, 6117978272461042996u, 97496286569u }, { 2376054557800684348u, 13116904339287496285u, 105331656266u }, { 12462238943546048571u, 867037205615660831u, 74711068809u }, { 15334855370842605909u, 1802487145191504830u, 137047002181u }, { 7211347914013798462u, 17242009718457409007u, 69097713023u }, { 13763642332572548877u, 13620802355488468049u, 127934691219u }, { 16868268377740071383u, 4442227880594435745u, 147738385175u }, { 1120013377627684177u, 17354849212854314181u, 23240813655u }, { 15898107650717274388u, 18202319179831567886u, 87940808260u }, { 12281923376333274277u, 17568634016348874558u, 68986749699u }, { 6383530489286615044u, 7496925598312450672u, 3952397558u }, { 4253822060257126466u, 601870379496813865u, 246406409151u }, { 17614372438391501998u, 11995106565680728027u, 191032627458u }, { 4309951310554333450u, 16331071694764184179u, 2650256029u }, { 13106185988973773020u, 9665962217000524208u, 157885309170u }, { 2070134359761960547u, 13682661374415474390u, 242523992861u }, { 9399359914137865875u, 6940361789924260864u, 29741738559u }, { 17415053284723541264u, 9658039831644010465u, 63376237766u }, { 4840502610448261120u, 6843715893910236922u, 198523563388u }, { 5690599259712258048u, 47089792870595660u, 124370998582u }, { 114769594245185536u, 14510386192097156932u, 54002552742u }, { 3150620882578178048u, 12059931208360040296u, 166786609611u }, { 5136918324969472000u, 14877013468459184620u, 203653770180u }, { 7205759403792793600u, 2397668560671695044u, 196806484516u }, { 0u, 2195572305559232232u, 36129977873u }, { 0u, 3261686279425953792u, 17119022213u }, { 0u, 9333850662059900928u, 133176816367u }, { 0u, 5036522340217782272u, 239505989058u }, { 0u, 2800120215143186432u, 194273030423u }, { 0u, 441634238459019264u, 23151794821u }, { 0u, 720575940379279360u, 133023941040u }, { 0u, 0u, 176039062500u }, { 0u, 0u, 228000000000u }, { 98202693831717807u, 82u, 0u }, { 12909287260170414079u, 82005323578u, 0u }, { 11728631949380786233u, 8218347283861607400u, 4u }, { 18263701925522197718u, 17896200385973633643u, 4445517498u }, { 4868886449713321591u, 16333242102094352209u, 186970154966u }, { 5870139507184082354u, 9981905728606788815u, 214885426828u }, { 5978562500822661575u, 15219470018924839012u, 140541120193u }, { 10821136839630268472u, 17152070168529617370u, 193825049122u }, { 9490907630136752916u, 17841343440958328027u, 34929815586u }, { 10564005678001613989u, 17291078023923990493u, 34967181165u }, { 5754050547468481222u, 16744804581790759223u, 109937351217u }, { 3833909949855542602u, 5001622214111594905u, 49907737675u }, { 15446538552665967784u, 9676746897435398146u, 75271138483u }, { 14924837848804399130u, 8109025833995118532u, 179524577500u }, { 18140170340418344208u, 5495826424046694744u, 220439591171u }, { 11380424819825208971u, 7890288164365705852u, 3297929347u }, { 12416915664152252547u, 8616438349039895217u, 131427733378u }, { 17195282241626289958u, 15787154801788760618u, 130467098058u }, { 2649541045825281326u, 12418659311480782502u, 202855823376u }, { 16577429864268509676u, 4486988874116669987u, 16673216870u }, { 12051257060168107241u, 4828971301551875409u, 102243240154u }, { 5363884561143470797u, 14769106422014442226u, 218261779058u }, { 13054029903083620184u, 7763933466423188156u, 114800634863u }, { 566314952158634945u, 10449097116253839963u, 239420883676u }, { 1329472079642345682u, 12870692502472900571u, 220566446689u }, { 15686237486658857211u, 11597479481311003817u, 97697721638u }, { 1069073549290598129u, 8294994869530047486u, 38628700622u }, { 4323599065125928507u, 16879315829924478241u, 206449672572u }, { 17861823329752681586u, 11873324837601439670u, 124915029544u }, { 17220149985412802078u, 3277599055636107318u, 40643654229u }, { 4344934572159429184u, 15363467897354242201u, 85177679000u }, { 2252927464837120000u, 10351182204479784367u, 152832855263u }, { 10910018171964489728u, 12811517584931924466u, 223561138711u }, { 3597328585515335680u, 16988930699558748726u, 23694513759u }, { 6972808074239148032u, 11683499918824718325u, 95920971778u }, { 2227030015734710272u, 13119300691281647499u, 2633363799u }, { 1152921504606846976u, 10125549106595354099u, 87711198715u }, { 0u, 17505352699870800544u, 251548907116u }, { 0u, 6756039242241163264u, 108948967071u }, { 0u, 3537338758766526464u, 159366245621u }, { 0u, 6522626374119718912u, 245191759518u }, { 0u, 4733294203482669056u, 158353592284u }, { 0u, 16997710893603094528u, 220256592392u }, { 0u, 16717361816799281152u, 8921447753u }, { 0u, 0u, 73906250000u }, { 0u, 0u, 16000000000u }, { 17238287503805244910u, 1251301u, 0u }, { 1434575446038410275u, 1251301934489438u, 0u }, { 14009569747841241694u, 3943737498063000362u, 67833u }, { 14938795732275951328u, 2870731037991212489u, 249213790438u }, { 6687653542888983473u, 7389433400402095883u, 230155622641u }, { 28238723295162625u, 5675049236146197433u, 241400581987u }, { 4745270274832691214u, 9953779846262904264u, 99307645035u }, { 926478968112308824u, 12691978937179636241u, 107539595486u }, { 9213681606604198526u, 15523327331528198029u, 222688033556u }, { 13346223820579313024u, 15722603279568118520u, 20841521260u }, { 691642518601291257u, 11838632364171816147u, 108852324031u }, { 1153720150033789192u, 7832751832367143680u, 191641773546u }, { 12089015034721780810u, 12167724027162940862u, 234424614327u }, { 3555868702841788854u, 4108211144748152962u, 183659613641u }, { 11708406782758214328u, 7530983398136343676u, 201222706572u }, { 9417497762905343943u, 1117587133956542355u, 140408255428u }, { 12838336066957615287u, 17134748625149490872u, 196060584519u }, { 13737708142128207419u, 4039918359454207848u, 71928876584u }, { 11683434809834695853u, 1830218764589441242u, 40219004413u }, { 2689114340106315837u, 637895981480825742u, 253099216358u }, { 8859225263374261032u, 8246879226348334620u, 230034580410u }, { 15761671984578600096u, 12389239568142583275u, 186447064218u }, { 7087267079878005352u, 14041257178803154398u, 154671622022u }, { 4601291730423121377u, 16312515716494630702u, 134761178076u }, { 9559411037059581623u, 17088522799596987756u, 220884303248u }, { 12969820289641388091u, 3588932524637852678u, 144926370677u }, { 13628239920285957130u, 107218049069817414u, 117194556422u }, { 8049893933765800625u, 1596707240462008334u, 6005812302u }, { 10391755948840250234u, 17461913142391587672u, 78086557672u }, { 14454650777462444512u, 4366474266651610090u, 232946612208u }, { 14244638523341127254u, 5539304013194805084u, 240236707044u }, { 12246016810439753984u, 4762470619211987849u, 228300286272u }, { 9382741764551081984u, 10835638458986644717u, 64258174049u }, { 4608696190291148800u, 16141642290510052058u, 97587401137u }, { 1696483666416369664u, 17390568670756355425u, 177875040181u }, { 15416683541605384192u, 12536768491333867107u, 181942744616u }, { 7683140964294066176u, 13145148522871947193u, 40679619581u }, { 4611686018427387904u, 5665349945233068642u, 253712599929u }, { 0u, 17074607537751066240u, 121307119235u }, { 0u, 6241525660962062336u, 131925616329u }, { 0u, 1142860629783085056u, 201338353784u }, { 0u, 16287527416870469632u, 120061954598u }, { 0u, 9028002014738513920u, 38882948630u }, { 0u, 16217462258161156096u, 22489408969u }, { 0u, 11529215046068469760u, 201879150390u }, { 0u, 0u, 54625000000u }, { 0u, 0u, 64000000000u }, { 1722045467931902045u, 19u, 0u }, { 16095324008152856733u, 19093352271u, 0u }, { 15216188060094280738u, 646608198162977646u, 1u }, { 10793385929903030893u, 12170458846894708007u, 1035052700u }, { 12613277226875940039u, 1797330480103086687u, 156659761896u }, { 10644539625155600107u, 10332188564497263448u, 232097433480u }, { 6181262895644173983u, 7524259485079594225u, 136560109064u }, { 148914399627082292u, 62681109059153749u, 8407890924u }, { 14379289774887985969u, 13480636451804037081u, 236003397949u }, { 11743339675582627452u, 6948168233012789004u, 61730786766u }, { 7841621929809463497u, 12015502974041806055u, 206376660954u }, { 11168944680251236601u, 7343801660689004040u, 218651361721u }, { 6178560202529287410u, 13670580858640731144u, 185398108285u }, { 13295243308201596112u, 5605073897566574851u, 125741083673u }, { 17040673746172470291u, 15387788940505247559u, 25303851664u }, { 14957442487039409922u, 17565181499678113030u, 144834173709u }, { 17778155426506992152u, 1893743623847493029u, 13952210397u }, { 14945404984219733899u, 10243498996716269784u, 221102660047u }, { 11590754866058681505u, 5619675836950314139u, 207555301193u }, { 6020790784469412466u, 10224869737511515088u, 73304643237u }, { 7934351824569522326u, 2574495974386198538u, 165554291299u }, { 5038361112172116744u, 7825756347302873178u, 99139563706u }, { 3305187319649924210u, 12071550103794656887u, 186424235101u }, { 11470175511099161552u, 7195875213867606691u, 93654400042u }, { 7308362160352048610u, 18271364438406891044u, 42390089176u }, { 10666410671225576634u, 16966521933952564706u, 216990492650u }, { 2181639019945820785u, 289920862029570129u, 234919756997u }, { 4615749499734847918u, 7804199568098625032u, 197015716641u }, { 14076159200958497580u, 5758118571242446585u, 33423066506u }, { 5470405257862074105u, 4030788293606375591u, 138312148233u }, { 4565741478181339543u, 4387716460037196127u, 9218509471u }, { 8901832997861862329u, 16807506478881285981u, 159237858585u }, { 14190141170191714122u, 17033060604413529717u, 25911136751u }, { 4240772322245764096u, 10498418508292170054u, 239923364065u }, { 4422842195340951552u, 13237752038744465016u, 225569120407u }, { 15448426386733137920u, 17737618428304633155u, 151717619975u }, { 9203504548935630848u, 13546183833248825736u, 7961558221u }, { 5936377627571912704u, 826778452978976229u, 205734340097u }, { 468374361246531584u, 13728076626990147292u, 1044819749u }, { 0u, 2794860281883592225u, 37744200525u }, { 0u, 8680705720425908736u, 77151509679u }, { 0u, 731520517439488000u, 175470582000u }, { 0u, 13120812320768917504u, 240039655806u }, { 0u, 2722954908557901824u, 126711280661u }, { 0u, 6860847004205973504u, 21147611681u }, { 0u, 6503197861922996224u, 33371927261u }, { 0u, 9223372036854775808u, 221352539062u }, { 0u, 0u, 182500000000u }, { 8020875056524075716u, 291341u, 0u }, { 1400288714762747253u, 291341434812508u, 0u }, { 6136037711314764689u, 12005656413127238315u, 15793u }, { 15735488086392394102u, 4821130826186787462u, 177650827938u }, { 7735094782793634552u, 14377899467066168118u, 162261354025u }, { 7273689191766726188u, 16575613239625444872u, 41779427491u }, { 3410634565056431030u, 4317827099179284377u, 163898565794u }, { 4600927904885215898u, 1242354770412171254u, 162234069876u }, { 9154871331680374746u, 994838588328896609u, 116067348187u }, { 6117978272461042996u, 17283309862013060457u, 219053930307u }, { 13116904339287496285u, 124242522249856586u, 67936930105u }, { 867037205615660831u, 11564608014666985609u, 57006735200u }, { 1802487145191504830u, 12401028575581654085u, 96626918656u }, { 17242009718457409007u, 2490725392961465727u, 672261106u }, { 13620802355488468049u, 1949482237120640915u, 242135022494u }, { 4442227880594435745u, 15410502396166200087u, 158105681643u }, { 17354849212854314181u, 15694919529799920727u, 235835405008u }, { 18202319179831567886u, 10324869370171768388u, 208850823292u }, { 17568634016348874558u, 1631866459122189059u, 124559712290u }, { 7496925598312450672u, 172020494461226230u, 34088463658u }, { 601870379496813865u, 12734610307908856767u, 42009325249u }, { 11995106565680728027u, 1467513250829340930u, 193690344608u }, { 16331071694764184179u, 13558759428494307997u, 160079554052u }, { 9665962217000524208u, 7915355143999496434u, 4735021821u }, { 13682661374415474390u, 2876370200608797469u, 253429092262u }, { 6940361789924260864u, 343685370404989503u, 166155928341u }, { 9658039831644010465u, 4837266557407634630u, 21018631221u }, { 6843715893910236922u, 9622591415747161468u, 53262228745u }, { 47089792870595660u, 16503783814424220982u, 9521641725u }, { 14510386192097156932u, 5377083431343591334u, 253894671913u }, { 12059931208360040296u, 16508482371299291595u, 41291492276u }, { 14877013468459184620u, 10515883558812249028u, 180894926622u }, { 2397668560671695044u, 63492062913405476u, 30570067190u }, { 2195572305559232232u, 11571919759617799697u, 246003441911u }, { 3261686279425953792u, 2956602334970088581u, 247627315027u }, { 9333850662059900928u, 13604736747717849839u, 83160277733u }, { 5036522340217782272u, 16573540719338151362u, 229737514256u }, { 2800120215143186432u, 12620703004601168151u, 16898453442u }, { 441634238459019264u, 14649407809089591941u, 194684169680u }, { 720575940379279360u, 11290375247898624432u, 208794145988u }, { 0u, 11020319450292874212u, 196612052468u }, { 0u, 8754634933362354176u, 244597412714u }, { 0u, 12976319450332528640u, 106474589710u }, { 0u, 17447331119627239424u, 14703447686u }, { 0u, 3665184902673858560u, 134945821715u }, { 0u, 12949678516038795264u, 19198690071u }, { 0u, 72057594037927936u, 23702003479u }, { 0u, 0u, 23003906250u }, { 0u, 0u, 202000000000u }, { 8218347283861607400u, 4u, 0u }, { 17896200385973633643u, 4445517498u, 0u }, { 16333242102094352209u, 4445517498970154966u, 0u }, { 9981905728606788815u, 9413159735776077452u, 240991986u }, { 15219470018924839012u, 14279163482889998017u, 242510288411u }, { 17152070168529617370u, 8693044629541194274u, 27774075003u }, { 17841343440958328027u, 11863110253260222498u, 123471250893u }, { 17291078023923990493u, 8319293368489531245u, 205643100495u }, { 16744804581790759223u, 3376307525676489265u, 79450989797u }, { 5001622214111594905u, 13205662254759912523u, 229183029997u }, { 9676746897435398146u, 5276250334231686323u, 237715880385u }, { 8109025833995118532u, 13790198520922745052u, 193286026103u }, { 5495826424046694744u, 14195535250150996227u, 119747568159u }, { 7890288164365705852u, 16425228796427004035u, 31769541507u }, { 8616438349039895217u, 4295900841296269186u, 131890413437u }, { 15787154801788760618u, 4533952595483946442u, 125232881251u }, { 12418659311480782502u, 12885038019373447184u, 99245786062u }, { 4486988874116669987u, 12140736240487831910u, 206698499310u }, { 4828971301551875409u, 6927124077155322074u, 238658150630u }, { 14769106422014442226u, 12477788342407819890u, 230375520148u }, { 7763933466423188156u, 7980854329409711087u, 148676422261u }, { 10449097116253839963u, 2062671021810827996u, 117432642980u }, { 12870692502472900571u, 2739521363598172769u, 164111817620u }, { 11597479481311003817u, 12897585686593465638u, 148148509750u }, { 8294994869530047486u, 1127632646629044686u, 54699179521u }, { 16879315829924478241u, 4833775019274666364u, 1061129088u }, { 11873324837601439670u, 15867662672939849256u, 128262039468u }, { 3277599055636107318u, 2092350330982953557u, 172860187717u }, { 15363467897354242201u, 13330062299842493592u, 69113426538u }, { 10351182204479784367u, 4479193352178519263u, 106722624125u }, { 12811517584931924466u, 3149393938889064983u, 125242817558u }, { 16988930699558748726u, 9736379904070620767u, 22170728987u }, { 11683499918824718325u, 3816238703055069186u, 27527810212u }, { 13119300691281647499u, 11598915938798661975u, 164206878714u }, { 10125549106595354099u, 17821633264606555643u, 250628778492u }, { 17505352699870800544u, 2514623558764574316u, 252966112675u }, { 6756039242241163264u, 4976730480406253215u, 163136318016u }, { 3537338758766526464u, 17276563697191611637u, 64269789099u }, { 6522626374119718912u, 12524734095940998814u, 171936564394u }, { 4733294203482669056u, 15331551308930355164u, 170678967195u }, { 16997710893603094528u, 15417115581125943816u, 155831125061u }, { 16717361816799281152u, 6010750237807115593u, 69835763510u }, { 0u, 5624630987553628432u, 54325843423u }, { 0u, 14881848243837640704u, 223304911856u }, { 0u, 15281613886881529856u, 240806746609u }, { 0u, 14057902358273196032u, 241828417948u }, { 0u, 16075318494433902592u, 156762080413u }, { 0u, 13891916000577716224u, 157871444761u }, { 0u, 7205759403792793600u, 25753082275u }, { 0u, 0u, 163390625000u }, { 0u, 0u, 232000000000u }, { 3943737498063000362u, 67833u, 0u }, { 2870731037991212489u, 67833213790438u, 0u }, { 7389433400402095883u, 4535831408134330609u, 3677u }, { 5675049236146197433u, 6204770794376564579u, 93245887913u }, { 9953779846262904264u, 13869812122751887467u, 169336361298u }, { 12691978937179636241u, 14253229412394467550u, 82751884021u }, { 15523327331528198029u, 12776557610216045332u, 245772669114u }, { 15722603279568118520u, 16493640728678654060u, 186692618575u }, { 11838632364171816147u, 9434398296825833151u, 79894122055u }, { 7832751832367143680u, 8773374058285327850u, 71511439756u }, { 12167724027162940862u, 12932015276748029367u, 140475605560u }, { 4108211144748152962u, 16293958583527755209u, 56701045952u }, { 7530983398136343676u, 13511893936143127948u, 192883297264u }, { 1117587133956542355u, 18409936402005226436u, 240732481237u }, { 17134748625149490872u, 2189663026458466887u, 213998004652u }, { 4039918359454207848u, 9497725274248154664u, 172118701870u }, { 1830218764589441242u, 14766925481127792125u, 46514872718u }, { 637895981480825742u, 6982373971809635814u, 142800516634u }, { 8246879226348334620u, 8616702383006884794u, 26378515251u }, { 12389239568142583275u, 3059473300040871066u, 51467112372u }, { 14041257178803154398u, 17123843157031495558u, 180165854379u }, { 16312515716494630702u, 11210627174210626524u, 171928285397u }, { 17088522799596987756u, 15868067138625928592u, 213607729316u }, { 3588932524637852678u, 4467869511636937589u, 164860209643u }, { 107218049069817414u, 10052108125844341766u, 235242203691u }, { 1596707240462008334u, 7470588003218451534u, 43544925873u }, { 17461913142391587672u, 2613527085490786280u, 177404981387u }, { 4366474266651610090u, 3632919450036549616u, 139141679587u }, { 5539304013194805084u, 179367907231218916u, 227196940958u }, { 4762470619211987849u, 13553068184555874624u, 158009723553u }, { 10835638458986644717u, 8798774862365584481u, 161734713298u }, { 16141642290510052058u, 910911255817064881u, 210476982541u }, { 17390568670756355425u, 2304331144765093813u, 13049380598u }, { 12536768491333867107u, 12248937023083640360u, 246124918041u }, { 13145148522871947193u, 10206039550662130685u, 25664016206u }, { 5665349945233068642u, 12267881323837852537u, 78553270512u }, { 17074607537751066240u, 2858642007937891971u, 240665043179u }, { 6241525660962062336u, 14171330289750320841u, 235154967293u }, { 1142860629783085056u, 6601103619749017720u, 253768229354u }, { 16287527416870469632u, 4919573414486739494u, 234357846544u }, { 9028002014738513920u, 3401998285294974486u, 16266690609u }, { 16217462258161156096u, 10799436256515532233u, 49184422696u }, { 11529215046068469760u, 10083786644665753398u, 40585438612u }, { 0u, 6481194517685688896u, 148546643169u }, { 0u, 15104161756860547072u, 225351346258u }, { 0u, 9556039274244079616u, 82818798249u }, { 0u, 1376343134954323968u, 169518033927u }, { 0u, 15682488278596976640u, 7074611710u }, { 0u, 1506454075355430912u, 254850149393u }, { 0u, 1152921504606846976u, 17081665039u }, { 0u, 0u, 15062500000u }, { 0u, 0u, 160000000000u }, { 12170458846894708007u, 1035052700u, 0u }, { 1797330480103086687u, 1035052700659761896u, 0u }, { 10332188564497263448u, 6172559441576707976u, 56110319u }, { 7524259485079594225u, 15083329738554729992u, 239334615117u }, { 62681109059153749u, 10013126833549229036u, 77817668943u }, { 13480636451804037081u, 5817156823499936061u, 79542812693u }, { 6948168233012789004u, 5282692560913632718u, 21315348703u }, { 12015502974041806055u, 10252307034225766362u, 223286375337u }, { 7343801660689004040u, 17981881283247669689u, 169555778677u }, { 13670580858640731144u, 11689290159733383293u, 117974799737u }, { 5605073897566574851u, 5530668968487988249u, 121633677689u }, { 15387788940505247559u, 10083765740821947024u, 121299818165u }, { 17565181499678113030u, 2798423656816843533u, 181546642036u }, { 1893743623847493029u, 7614494481582904797u, 116151702850u }, { 10243498996716269784u, 17811318500083423695u, 66412782572u }, { 5619675836950314139u, 11641467412200329033u, 236965553510u }, { 10224869737511515088u, 17733593025296340645u, 102631085212u }, { 2574495974386198538u, 3689424000190644835u, 156961340004u }, { 7825756347302873178u, 14966634145516728506u, 100200004075u }, { 12071550103794656887u, 14171681941562070109u, 235811342862u }, { 7195875213867606691u, 8130575762882608170u, 14768248417u }, { 18271364438406891044u, 5234550794400656856u, 97440759395u }, { 16966521933952564706u, 3020576149360486378u, 99283765567u }, { 289920862029570129u, 3038675756589057221u, 63163745761u }, { 7804199568098625032u, 15470260187120878369u, 225164726942u }, { 5758118571242446585u, 3497929414841828746u, 158838644485u }, { 4030788293606375591u, 9935840636861015305u, 5189623133u }, { 4387716460037196127u, 3647355485153741471u, 93538623000u }, { 16807506478881285981u, 766100215038272793u, 24197723537u }, { 17033060604413529717u, 16128087474216800751u, 145041530375u }, { 10498418508292170054u, 16216631732633731297u, 7874305373u }, { 13237752038744465016u, 13760220872779997335u, 93879105367u }, { 17737618428304633155u, 3826276262374222087u, 87745943068u }, { 13546183833248825736u, 14938032745839181005u, 28207422851u }, { 826778452978976229u, 14479259995009508865u, 131809792377u }, { 13728076626990147292u, 2372033248156102437u, 121784922257u }, { 2794860281883592225u, 792005346826701645u, 145128588180u }, { 8680705720425908736u, 16278924527931792559u, 148042934695u }, { 731520517439488000u, 17442516423538940144u, 167882482266u }, { 13120812320768917504u, 13844184233048446u, 90945560710u }, { 2722954908557901824u, 13486193870480782357u, 134000750494u }, { 6860847004205973504u, 11931315179184648737u, 158731088034u }, { 6503197861922996224u, 16492562205587485405u, 162646797891u }, { 9223372036854775808u, 12128987217680380854u, 67894063588u }, { 0u, 10568123814189138176u, 228657513714u }, { 0u, 17007583519117541376u, 242572899139u }, { 0u, 143791533903052800u, 67921982950u }, { 0u, 12398714235792654336u, 230007794954u }, { 0u, 9659957317919047680u, 10672135645u }, { 0u, 9412523221204336640u, 221523667335u }, { 0u, 4611686018427387904u, 135510253906u }, { 0u, 0u, 82250000000u }, { 0u, 0u, 128000000000u }, { 12005656413127238315u, 15793u, 0u }, { 4821130826186787462u, 15793650827938u, 0u }, { 14377899467066168118u, 3237900842885170729u, 856u }, { 16575613239625444872u, 7515893506498066595u, 88175526956u }, { 4317827099179284377u, 7300206309181072546u, 44407437403u }, { 1242354770412171254u, 5999737279837044u, 91395744977u }, { 994838588328896609u, 7556839307242450651u, 209000325246u }, { 17283309862013060457u, 12946035041643640643u, 126409657079u }, { 124242522249856586u, 15885877642352740665u, 247701805965u }, { 11564608014666985609u, 10770818348246089568u, 141861175152u }, { 12401028575581654085u, 11635415503599551744u, 112583887232u }, { 2490725392961465727u, 6248053924100826098u, 128630757138u }, { 1949482237120640915u, 16894170802729859998u, 18338707681u }, { 15410502396166200087u, 6143589029651889899u, 225915834834u }, { 15694919529799920727u, 11812087701837886160u, 210333044628u }, { 10324869370171768388u, 7306705080150829180u, 148640334557u }, { 1631866459122189059u, 1485332570280714274u, 221396097276u }, { 172020494461226230u, 18042602303295630634u, 252080520039u }, { 12734610307908856767u, 13397029889257074369u, 103978091430u }, { 1467513250829340930u, 9948104869613411488u, 166726254445u }, { 13558759428494307997u, 10836066241170646532u, 109539287845u }, { 7915355143999496434u, 18330574781234459389u, 37587424327u }, { 2876370200608797469u, 666297360208433062u, 71993702450u }, { 343685370404989503u, 5035352224889324309u, 50036120052u }, { 4837266557407634630u, 1341745796439923765u, 244272966991u }, { 9622591415747161468u, 6846932182653803785u, 79072736185u }, { 16503783814424220982u, 6727685027257825533u, 185371172937u }, { 5377083431343591334u, 2168538874806877737u, 73364708536u }, { 16508482371299291595u, 17694936100676971444u, 184117556727u }, { 10515883558812249028u, 2163944241059563294u, 247959244408u }, { 63492062913405476u, 6727780864524301558u, 120117307652u }, { 11571919759617799697u, 8599551977795002615u, 4364713731u }, { 2956602334970088581u, 15428264807806859091u, 3466182646u }, { 13604736747717849839u, 2126771385339683557u, 246836367911u }, { 16573540719338151362u, 15094316562082972944u, 39115292507u }, { 12620703004601168151u, 8111300598225956802u, 91818264540u }, { 14649407809089591941u, 9481215200564260304u, 220439714486u }, { 11290375247898624432u, 16836674128623424708u, 182513977705u }, { 11020319450292874212u, 7087243115299722740u, 105912717933u }, { 8754634933362354176u, 2343560867338408810u, 109384200219u }, { 12976319450332528640u, 3431385749090422286u, 27127044689u }, { 17447331119627239424u, 3504545517469224582u, 81186015794u }, { 3665184902673858560u, 3333759805712094227u, 50189981793u }, { 12949678516038795264u, 3595183476205994775u, 97180723481u }, { 72057594037927936u, 14191566632569921303u, 25194895286u }, { 0u, 12917427671358095562u, 182769326368u }, { 0u, 3883793922738316288u, 32700255157u }, { 0u, 7857281689266421760u, 181210540890u }, { 0u, 15987081651486195712u, 90425944093u }, { 0u, 16827562156399525888u, 29866661432u }, { 0u, 7012737938513461248u, 56912223972u }, { 0u, 7385903388887613440u, 228380161285u }, { 0u, 0u, 5400390625u }, { 0u, 0u, 225000000000u }, { 9413159735776077452u, 240991986u, 0u }, { 14279163482889998017u, 240991986510288411u, 0u }, { 8693044629541194274u, 14135788013842776187u, 13064201u }, { 11863110253260222498u, 13284322918167594445u, 9766302603u }, { 8319293368489531245u, 7264587765474046287u, 139720144588u }, { 3376307525676489265u, 16176482219778368741u, 204393814091u }, { 13205662254759912523u, 5401983818872095469u, 75876928858u }, { 5276250334231686323u, 11208857446851049921u, 90292842129u }, { 13790198520922745052u, 13794690008281035639u, 145607633379u }, { 14195535250150996227u, 14519782740993303071u, 227747811643u }, { 16425228796427004035u, 10885858587044789123u, 59787118999u }, { 4295900841296269186u, 8710500938899914621u, 151590123576u }, { 4533952595483946442u, 1284182587483102819u, 56472197202u }, { 12885038019373447184u, 10346074482131502030u, 82069615677u }, { 12140736240487831910u, 9429804686255246574u, 61560861821u }, { 6927124077155322074u, 6412022633845121254u, 125511190736u }, { 12477788342407819890u, 8892351297529018260u, 208347596443u }, { 7980854329409711087u, 14098160105983060597u, 155482055329u }, { 2062671021810827996u, 13793833029739474340u, 161764262790u }, { 2739521363598172769u, 16367653765996977044u, 134747765186u }, { 12897585686593465638u, 10684788343333772342u, 194887292288u }, { 1127632646629044686u, 13272681218705145345u, 128579223536u }, { 4833775019274666364u, 11093568615497829248u, 240719513490u }, { 15867662672939849256u, 12488220765137758124u, 146601383559u }, { 2092350330982953557u, 3727114642519696453u, 135676987804u }, { 13330062299842493592u, 11549865375695057514u, 156202047289u }, { 4479193352178519263u, 11292809154908783229u, 57626119456u }, { 3149393938889064983u, 17723904861837310998u, 32612184410u }, { 9736379904070620767u, 14877674388187150875u, 90960814807u }, { 3816238703055069186u, 12178961950105734308u, 215806520344u }, { 11598915938798661975u, 4540604068069253114u, 24660222850u }, { 17821633264606555643u, 13832478722153359868u, 130246146639u }, { 2514623558764574316u, 1308046668730371491u, 79749860174u }, { 4976730480406253215u, 18400531023544756800u, 78070909351u }, { 17276563697191611637u, 9789823458621466539u, 167997494785u }, { 12524734095940998814u, 1924870562610267306u, 1530707393u }, { 15331551308930355164u, 5290016144582400923u, 193104347442u }, { 15417115581125943816u, 15162883663174059077u, 50286772349u }, { 6010750237807115593u, 8078086116520046390u, 125821981570u }, { 5624630987553628432u, 15731407332173190623u, 130437913925u }, { 14881848243837640704u, 5346389182763011056u, 69852801300u }, { 15281613886881529856u, 6368422217216252401u, 20289828338u }, { 14057902358273196032u, 2961453088119116188u, 242345232860u }, { 16075318494433902592u, 10932141691610170525u, 220160540693u }, { 13891916000577716224u, 11034016191361782553u, 21592632588u }, { 7205759403792793600u, 5455325785621453219u, 12598155216u }, { 0u, 7735615202566149352u, 208295733803u }, { 0u, 7502396497775759360u, 43419348540u }, { 0u, 1601286435751591936u, 60406705729u }, { 0u, 11449383158571597824u, 65086805911u }, { 0u, 13043944595690356736u, 151620672304u }, { 0u, 7773494431818186752u, 48707113653u }, { 0u, 9943947977234055168u, 181421401977u }, { 0u, 0u, 121539062500u }, { 0u, 0u, 228000000000u }, { 4535831408134330609u, 3677u, 0u }, { 6204770794376564579u, 3677245887913u, 0u }, { 13869812122751887467u, 6343817245135589714u, 199u }, { 14253229412394467550u, 17549323075660516085u, 199343899021u }, { 12776557610216045332u, 3948641822109421754u, 141951350710u }, { 16493640728678654060u, 1750739713693534543u, 182214056302u }, { 9434398296825833151u, 962163898128633415u, 110094907790u }, { 8773374058285327850u, 7967320249386531212u, 142052159009u }, { 12932015276748029367u, 3018466665533383224u, 33431909296u }, { 16293958583527755209u, 15076865731854945472u, 176163631405u }, { 13511893936143127948u, 691187172844604400u, 45817318529u }, { 18409936402005226436u, 13274492813370992341u, 129037469331u }, { 2189663026458466887u, 6364168818499152300u, 147719611697u }, { 9497725274248154664u, 17599380787401914158u, 49345002282u }, { 14766925481127792125u, 3782323149461692814u, 42954064344u }, { 6982373971809635814u, 14470163442442237466u, 216205040148u }, { 8616702383006884794u, 476109872130437939u, 20784429132u }, { 3059473300040871066u, 16330548844673355700u, 76025809967u }, { 17123843157031495558u, 14089158961463739563u, 47885280826u }, { 11210627174210626524u, 13385510793074798805u, 58763774837u }, { 15868067138625928592u, 1549401308746959012u, 117725629994u }, { 4467869511636937589u, 4607384943843027435u, 42083993213u }, { 10052108125844341766u, 5157353797716093483u, 125249766838u }, { 7470588003218451534u, 10846828782671550129u, 182279580709u }, { 2613527085490786280u, 9915857350819131531u, 37588007766u }, { 3632919450036549616u, 1673544973504317923u, 86537539704u }, { 179367907231218916u, 14780986291622785694u, 120090723054u }, { 13553068184555874624u, 8168111319515466401u, 238801278872u }, { 8798774862365584481u, 16345760387859734482u, 152442794201u }, { 910911255817064881u, 3177475373321281805u, 217886105446u }, { 2304331144765093813u, 2558676822419554038u, 102172251285u }, { 12248937023083640360u, 8813474062662382873u, 149138706148u }, { 10206039550662130685u, 5426294560236228430u, 228477779386u }, { 12267881323837852537u, 9919177474128333040u, 186294160017u }, { 2858642007937891971u, 6197383943089627371u, 145537719688u }, { 14171330289750320841u, 13673239314867423997u, 136335960856u }, { 6601103619749017720u, 9309584098968723946u, 24741227788u }, { 4919573414486739494u, 4647101757759615504u, 12504673565u }, { 3401998285294974486u, 1405809295505096753u, 29251919891u }, { 10799436256515532233u, 11332704079573859112u, 19076209074u }, { 10083786644665753398u, 2960072434514044308u, 178614347119u }, { 6481194517685688896u, 3887266602785432801u, 111160465848u }, { 15104161756860547072u, 14545546084687849554u, 184210729144u }, { 9556039274244079616u, 4617763804182385321u, 184788515633u }, { 1376343134954323968u, 7857823815580249095u, 49250329477u }, { 15682488278596976640u, 10939326736548364798u, 133425973482u }, { 1506454075355430912u, 12262012446566951953u, 234593022090u }, { 1152921504606846976u, 12555024338687723023u, 138664725026u }, { 0u, 3332969632922829472u, 34680609233u }, { 0u, 15535060143360327680u, 209180680645u }, { 0u, 15794322927987458048u, 197842157297u }, { 0u, 10571474314433921024u, 241856211961u }, { 0u, 16679514427547975680u, 249573080770u }, { 0u, 16925653299565166592u, 194904198288u }, { 0u, 16717361816799281152u, 144917541503u }, { 0u, 0u, 127906250000u }, { 0u, 0u, 16000000000u }, { 6172559441576707976u, 56110319u, 0u }, { 15083329738554729992u, 56110319334615117u, 0u }, { 10013126833549229036u, 9335385384027907407u, 3041746u }, { 5817156823499936061u, 13237828406194798613u, 210506072255u }, { 5282692560913632718u, 15667486867836528863u, 191717624115u }, { 10252307034225766362u, 17982325043592934313u, 51849336164u }, { 17981881283247669689u, 17159117626917379189u, 100974823793u }, { 11689290159733383293u, 8336208968408929657u, 113930197630u }, { 5530668968487988249u, 12767090573379150201u, 126451906793u }, { 10083765740821947024u, 14736070002412246709u, 233692105366u }, { 2798423656816843533u, 9697296975344560756u, 150798843955u }, { 7614494481582904797u, 7291706381199103298u, 51525691522u }, { 17811318500083423695u, 18098546597780825068u, 130395284194u }, { 11641467412200329033u, 132913902678533478u, 226981124177u }, { 17733593025296340645u, 1879347741692007580u, 81007205277u }, { 3689424000190644835u, 4056624629214083684u, 157101879645u }, { 14966634145516728506u, 14713227692042795499u, 93219910061u }, { 14171681941562070109u, 7366415124022528526u, 173797605671u }, { 8130575762882608170u, 825770353378039393u, 39399334164u }, { 5234550794400656856u, 10244023944395357795u, 20044765100u }, { 3020576149360486378u, 14302658294713551167u, 172555329650u }, { 3038675756589057221u, 14246653166206862817u, 114775348659u }, { 15470260187120878369u, 12404486258134291102u, 179772312615u }, { 3497929414841828746u, 8887442218637942533u, 39672448547u }, { 9935840636861015305u, 1186724038081863005u, 35481789208u }, { 3647355485153741471u, 211331772484951576u, 24064332439u }, { 766100215038272793u, 6311919513247413649u, 151011456318u }, { 16128087474216800751u, 8131780018703965703u, 62342169842u }, { 16216631732633731297u, 2262544347226725725u, 242440824678u }, { 13760220872779997335u, 15318188749880522583u, 102122652774u }, { 3826276262374222087u, 1073117094162650652u, 102830400676u }, { 14938032745839181005u, 4447950380665871747u, 164058173794u }, { 14479259995009508865u, 5373227185066463609u, 98241123873u }, { 2372033248156102437u, 6739731406934274193u, 33291283229u }, { 792005346826701645u, 12328812617001239444u, 29365361571u }, { 16278924527931792559u, 3246111484407310759u, 163668346271u }, { 17442516423538940144u, 3250825415176839770u, 159175972056u }, { 13844184233048446u, 16146270540000862342u, 216176227598u }, { 13486193870480782357u, 15686773375425916830u, 14875291079u }, { 11931315179184648737u, 11920791905793880226u, 199850381688u }, { 16492562205587485405u, 1853290561644080707u, 120646227424u }, { 12128987217680380854u, 12157689141506159076u, 224100467082u }, { 10568123814189138176u, 18100318838862562546u, 138659069648u }, { 17007583519117541376u, 7171257882533475139u, 208981220250u }, { 143791533903052800u, 14477550873015039462u, 154388754668u }, { 12398714235792654336u, 8109481182495403274u, 236784829605u }, { 9659957317919047680u, 14565395719337663965u, 165439615855u }, { 9412523221204336640u, 1860318978161305991u, 111789591684u }, { 4611686018427387904u, 16268646275151585618u, 132100848093u }, { 0u, 13759019338835519104u, 221881925081u }, { 0u, 17003783176010661888u, 217745877932u }, { 0u, 18357489540307877888u, 172921776932u }, { 0u, 905481790074912768u, 36995161502u }, { 0u, 3638882110636294144u, 158049086266u }, { 0u, 9011702854368362496u, 58197264194u }, { 0u, 11529215046068469760u, 66488525390u }, { 0u, 0u, 78625000000u }, { 0u, 0u, 64000000000u }, { 3237900842885170729u, 856u, 0u }, { 7515893506498066595u, 856175526956u, 0u }, { 7300206309181072546u, 7625299565768063067u, 46u }, { 5999737279837044u, 13889021769065194705u, 46413368317u }, { 7556839307242450651u, 14498170692313014398u, 253752925378u }, { 12946035041643640643u, 1541631360972245751u, 194785947408u }, { 15885877642352740665u, 9903958882920799117u, 16083572003u }, { 10770818348246089568u, 15744148547788062576u, 35536894686u }, { 11635415503599551744u, 17936061801321712000u, 222853492002u }, { 6248053924100826098u, 9986394078324430610u, 34972315858u }, { 16894170802729859998u, 13849561248103430369u, 210541363507u }, { 6143589029651889899u, 12142378807953854930u, 51750786219u }, { 11812087701837886160u, 2513847703931031444u, 171658239674u }, { 7306705080150829180u, 1752183758129038045u, 186136275957u }, { 1485332570280714274u, 15824833342220556540u, 245094986071u }, { 18042602303295630634u, 8168747198299470695u, 87857865934u }, { 13397029889257074369u, 17414799840149357478u, 206442828672u }, { 9948104869613411488u, 83147520704167789u, 128944058191u }, { 10836066241170646532u, 2383542703041471269u, 79004507436u }, { 18330574781234459389u, 15540952725549257799u, 44129212108u }, { 666297360208433062u, 6949835416232048690u, 204842476735u }, { 5035352224889324309u, 15398868937585367540u, 191376751332u }, { 1341745796439923765u, 14710915985268256079u, 228834774357u }, { 6846932182653803785u, 9665704836873335737u, 85797480353u }, { 6727685027257825533u, 2528789298740305993u, 161523978909u }, { 2168538874806877737u, 10562914675687726264u, 157137085942u }, { 17694936100676971444u, 17671658300096837111u, 246572616751u }, { 2163944241059563294u, 356471401631698552u, 47957982516u }, { 6727780864524301558u, 7450677157218003204u, 52019324353u }, { 8599551977795002615u, 317174560787152643u, 193403902018u }, { 15428264807806859091u, 7251937674440720374u, 66017194067u }, { 2126771385339683557u, 1252631516699038247u, 83393128329u }, { 15094316562082972944u, 10818009768860843867u, 137067905290u }, { 8111300598225956802u, 12330114194950162396u, 10586445484u }, { 9481215200564260304u, 15826681638261168822u, 172668416829u }, { 16836674128623424708u, 14240150078499211625u, 61857966130u }, { 7087243115299722740u, 10725372116242125421u, 50771960082u }, { 2343560867338408810u, 8434925524647833627u, 18581423587u }, { 3431385749090422286u, 17133902668520348241u, 227457258228u }, { 3504545517469224582u, 15093996047981365810u, 244928830724u }, { 3333759805712094227u, 6187974166976813153u, 4818247165u }, { 3595183476205994775u, 13946144707720259865u, 253335450751u }, { 14191566632569921303u, 9138079832881862582u, 127756022019u }, { 12917427671358095562u, 6600697628576225568u, 3495376300u }, { 3883793922738316288u, 8137099536646556597u, 172357824535u }, { 7857281689266421760u, 14169855543453903706u, 23441113049u }, { 15987081651486195712u, 3706403268650100765u, 217768149408u }, { 16827562156399525888u, 14736932266877982264u, 160200924523u }, { 7012737938513461248u, 18004795125138956004u, 107798890698u }, { 7385903388887613440u, 9068489270661002501u, 202976041899u }, { 0u, 7758835715193269217u, 171491603788u }, { 0u, 16943947811135261184u, 76420607326u }, { 0u, 6745843108403216384u, 94918533251u }, { 0u, 12338229654069444608u, 131365692887u }, { 0u, 14358176069683511296u, 215668856769u }, { 0u, 7083775185760813056u, 193778358284u }, { 0u, 5350276357316149248u, 12384012222u }, { 0u, 9223372036854775808u, 190290039062u }, { 0u, 0u, 22500000000u }, { 14135788013842776187u, 13064201u, 0u }, { 13284322918167594445u, 13064201766302603u, 0u }, { 7264587765474046287u, 14699116688460625612u, 708211u }, { 16176482219778368741u, 6684126021499623499u, 115796840712u }, { 5401983818872095469u, 12614606079692508506u, 8362347197u }, { 11208857446851049921u, 15358270276683001489u, 189683839165u }, { 13794690008281035639u, 18077126190953408995u, 189832573499u }, { 14519782740993303071u, 7864121581925945659u, 59979962974u }, { 10885858587044789123u, 3518026639210514839u, 94426314885u }, { 8710500938899914621u, 4698310163811252280u, 133190712606u }, { 1284182587483102819u, 6101155398200416338u, 30254695904u }, { 10346074482131502030u, 16049178580360033341u, 224330744296u }, { 9429804686255246574u, 3167464649127375997u, 232870027714u }, { 6412022633845121254u, 12778923935480989904u, 194171708602u }, { 8892351297529018260u, 11875553912612980379u, 186692746854u }, { 14098160105983060597u, 10628760849351697057u, 102643775067u }, { 13793833029739474340u, 3408944711673234310u, 91576186280u }, { 16367653765996977044u, 2102091496050506178u, 168184799263u }, { 10684788343333772342u, 6254611118630245760u, 31113954608u }, { 13272681218705145345u, 2647941151989776368u, 48339063148u }, { 11093568615497829248u, 8855437735410157458u, 108143545177u }, { 12488220765137758124u, 10184270603132180103u, 89480054241u }, { 3727114642519696453u, 12079083162535627164u, 225552090415u }, { 11549865375695057514u, 5952952868716156729u, 47654808410u }, { 11292809154908783229u, 11958907037815852320u, 90322710221u }, { 17723904861837310998u, 10101562137321697626u, 205648293649u }, { 14877674388187150875u, 13633527411279258327u, 17547606780u }, { 12178961950105734308u, 16555627393501768728u, 252739075001u }, { 4540604068069253114u, 6359650463500280706u, 185897482359u }, { 13832478722153359868u, 8093923611102181967u, 119344757342u }, { 1308046668730371491u, 2848827352928635726u, 94438772478u }, { 18400531023544756800u, 4686723431961561511u, 254154435240u }, { 9789823458621466539u, 6245554925867652609u, 168254067786u }, { 1924870562610267306u, 17527406820792516033u, 74338572210u }, { 5290016144582400923u, 12119966834653692210u, 178950162627u }, { 15162883663174059077u, 11606502845877928061u, 195657024718u }, { 8078086116520046390u, 424311496652297090u, 206629189780u }, { 15731407332173190623u, 5977664048034127173u, 148023001972u }, { 5346389182763011056u, 6702712461535947028u, 116324049817u }, { 6368422217216252401u, 11384349854055020018u, 153363354770u }, { 2961453088119116188u, 3782955013294836188u, 146617146842u }, { 10932141691610170525u, 3531805968821207061u, 218205074402u }, { 11034016191361782553u, 3867566898657193228u, 226191459585u }, { 5455325785621453219u, 12688734637425072080u, 1209661221u }, { 7735615202566149352u, 18435982764454619691u, 37687857682u }, { 7502396497775759360u, 4728836163964677692u, 18999416628u }, { 1601286435751591936u, 2120012917348838977u, 52256350722u }, { 11449383158571597824u, 9856965465824679831u, 2114926130u }, { 13043944595690356736u, 11217197671061248816u, 50534347168u }, { 7773494431818186752u, 3840562972677739189u, 160608085504u }, { 9943947977234055168u, 17104366978925258617u, 208197335u }, { 0u, 16177877219841993444u, 215927229591u }, { 0u, 7338522384267208704u, 151877004481u }, { 0u, 10935240458612244480u, 193397822095u }, { 0u, 1732868046462124032u, 143592800573u }, { 0u, 557965042578882560u, 61093938965u }, { 0u, 10454684322475540480u, 21030247345u }, { 0u, 13907115649320091648u, 177566749572u }, { 0u, 0u, 132753906250u }, { 0u, 0u, 74000000000u }, { 6343817245135589714u, 199u, 0u }, { 17549323075660516085u, 199343899021u, 0u }, { 3948641822109421754u, 14876458284855834550u, 10u }, { 1750739713693534543u, 10450704926982265198u, 10806454419u }, { 962163898128633415u, 5385653213018257806u, 147566533849u }, { 7967320249386531212u, 12735569669880147489u, 217291956845u }, { 3018466665533383224u, 3619762560577729456u, 109690396615u }, { 15076865731854945472u, 11123448126624084269u, 199196227721u }, { 691187172844604400u, 4072715118852885633u, 137603003331u }, { 13274492813370992341u, 18239087231420827283u, 195220782328u }, { 6364168818499152300u, 423431461216085297u, 248988742900u }, { 17599380787401914158u, 9360976716520160042u, 244022954265u }, { 3782323149461692814u, 11655927117263208920u, 25507459564u }, { 14470163442442237466u, 2646622721938364948u, 236631869075u }, { 476109872130437939u, 4496462484548171852u, 147143473705u }, { 16330548844673355700u, 13140258519803350063u, 41243753719u }, { 14089158961463739563u, 13089764333320627770u, 247712334841u }, { 13385510793074798805u, 6926286827289840501u, 249709597546u }, { 1549401308746959012u, 4985580225290866218u, 106375474761u }, { 4607384943843027435u, 10478790837359789693u, 73270268845u }, { 5157353797716093483u, 10041191967455692214u, 173568056389u }, { 10846828782671550129u, 5035461258013813797u, 69544334107u }, { 9915857350819131531u, 14208759661559249750u, 27272972901u }, { 1673544973504317923u, 12347272163241758840u, 101770258404u }, { 14780986291622785694u, 3372534174410277614u, 228669346965u }, { 8168111319515466401u, 17226704187274712984u, 149182825443u }, { 16345760387859734482u, 4250480179449852121u, 227933861505u }, { 3177475373321281805u, 4303723537755414374u, 129230418992u }, { 2558676822419554038u, 8680503847344854165u, 48233305320u }, { 8813474062662382873u, 8817608623911079652u, 232470571056u }, { 5426294560236228430u, 5692030448698539450u, 48478003521u }, { 9919177474128333040u, 16908836314686769809u, 65308565588u }, { 6197383943089627371u, 6073762347067727240u, 84916629853u }, { 13673239314867423997u, 10931066692585106200u, 93329259316u }, { 9309584098968723946u, 14466591364061539596u, 52592574312u }, { 4647101757759615504u, 4958077340960173341u, 104784235489u }, { 1405809295505096753u, 4076890037156765715u, 225268777911u }, { 11332704079573859112u, 14083973146609179058u, 183221008651u }, { 2960072434514044308u, 2565183738039805295u, 11763493714u }, { 3887266602785432801u, 1482420938751351224u, 82139058889u }, { 14545546084687849554u, 2151089495335413944u, 201080362200u }, { 4617763804182385321u, 3738604531753220913u, 216116610795u }, { 7857823815580249095u, 14195686514836005765u, 235202670157u }, { 10939326736548364798u, 17808833916231796970u, 77769549707u }, { 12262012446566951953u, 1302384553035657354u, 139965418821u }, { 12555024338687723023u, 1672033517974833698u, 69070602408u }, { 3332969632922829472u, 11673925532927662545u, 168090641118u }, { 15535060143360327680u, 3905334232240480709u, 222632844771u }, { 15794322927987458048u, 17411087320267472625u, 227211708592u }, { 10571474314433921024u, 16573305231063706617u, 176943856934u }, { 16679514427547975680u, 15481103236037148354u, 38898440676u }, { 16925653299565166592u, 907440704754420880u, 228839232288u }, { 16717361816799281152u, 3224970785139077759u, 32049192459u }, { 0u, 10560826509734608144u, 11174826016u }, { 0u, 4700940027512659968u, 32572503552u }, { 0u, 9733694683502084096u, 254838469u }, { 0u, 1995535635724632064u, 197527664646u }, { 0u, 10629833226245373952u, 6108178203u }, { 0u, 15729384648544878592u, 27576244413u }, { 0u, 7205759403792793600u, 189852691650u }, { 0u, 0u, 194390625000u }, { 0u, 0u, 232000000000u }, { 9335385384027907407u, 3041746u, 0u }, { 13237828406194798613u, 3041746506072255u, 0u }, { 15667486867836528863u, 7535526066623007027u, 164893u }, { 17982325043592934313u, 11302146918409311588u, 29408501686u }, { 17159117626917379189u, 2480833299122194801u, 182612690612u }, { 8336208968408929657u, 11513226205589330558u, 180134486242u }, { 12767090573379150201u, 4073957068281936105u, 226624133243u }, { 14736070002412246709u, 3729887061093812886u, 123220849655u }, { 9697296975344560756u, 13616911779739451443u, 247202197582u }, { 7291706381199103298u, 13039053282195777666u, 78738174266u }, { 18098546597780825068u, 14490756113210417890u, 58706848494u }, { 132913902678533478u, 17432486112977557585u, 238785545462u }, { 1879347741692007580u, 14308820825344039837u, 246945016965u }, { 4056624629214083684u, 4190949538817536349u, 133775682731u }, { 14713227692042795499u, 13616552502810964397u, 171227191829u }, { 7366415124022528526u, 4898145803694965031u, 21738154790u }, { 825770353378039393u, 1399036321001644308u, 38265529016u }, { 10244023944395357795u, 17170331128243738540u, 184075841910u }, { 14302658294713551167u, 10641321388205367410u, 118930805515u }, { 14246653166206862817u, 6648873641312572851u, 11576867188u }, { 12404486258134291102u, 5988456964560374823u, 116360436162u }, { 8887442218637942533u, 9972593758348346915u, 194324634902u }, { 1186724038081863005u, 16709668921872818968u, 22540615390u }, { 211331772484951576u, 6094829131503407767u, 222905832967u }, { 6311919513247413649u, 4892016478899926334u, 7330401349u }, { 8131780018703965703u, 13150857244079031538u, 69265196744u }, { 2262544347226725725u, 12983943395318785894u, 200712909399u }, { 15318188749880522583u, 15341644584614757478u, 87703860981u }, { 1073117094162650652u, 7507635124856644772u, 245831672219u }, { 4447950380665871747u, 11619655367084544354u, 155406989715u }, { 5373227185066463609u, 11553116952478783009u, 147629902779u }, { 6739731406934274193u, 17392150014233193245u, 187626295724u }, { 12328812617001239444u, 8877887560294980515u, 172942830341u }, { 3246111484407310759u, 18404180619915609503u, 5481271248u }, { 3250825415176839770u, 10079413095288181976u, 208997692630u }, { 16146270540000862342u, 14102802966539105550u, 214546406078u }, { 15686773375425916830u, 13333966026135891399u, 190764514480u }, { 11920791905793880226u, 12344968670173516152u, 176722835746u }, { 1853290561644080707u, 10577007819804726752u, 34669222092u }, { 12157689141506159076u, 15337041354031088010u, 204573380742u }, { 18100318838862562546u, 14333607285614673616u, 134831422677u }, { 7171257882533475139u, 17171597563219696538u, 213777026407u }, { 14477550873015039462u, 2849642930482147564u, 103930874169u }, { 8109481182495403274u, 14791248423979435173u, 57154479452u }, { 14565395719337663965u, 13882371364576310127u, 92801835183u }, { 1860318978161305991u, 11735995808941329540u, 175752564859u }, { 16268646275151585618u, 11376996674339273181u, 123636209607u }, { 13759019338835519104u, 9849638057168043481u, 199616748225u }, { 17003783176010661888u, 18241520229279361964u, 193533949948u }, { 18357489540307877888u, 1865852368526961444u, 252988874793u }, { 905481790074912768u, 10601487369276448158u, 41101148059u }, { 3638882110636294144u, 15999931310312762170u, 155574707781u }, { 9011702854368362496u, 5773775867713013570u, 69867358014u }, { 11529215046068469760u, 17726239863982547534u, 62312997016u }, { 0u, 9711316695888316992u, 152960941388u }, { 0u, 17872002620723724288u, 76526451532u }, { 0u, 7429694208660733952u, 76968843203u }, { 0u, 1782821038871019520u, 195402764530u }, { 0u, 3225250234313474048u, 242096646922u }, { 0u, 10009250171830927360u, 10174841165u }, { 0u, 1152921504606846976u, 77542602539u }, { 0u, 0u, 43062500000u }, { 0u, 0u, 160000000000u }, { 7625299565768063067u, 46u, 0u }, { 13889021769065194705u, 46413368317u, 0u }, { 14498170692313014398u, 9519880170333822146u, 2u }, { 1541631360972245751u, 2285186318012886800u, 2516073738u }, { 9903958882920799117u, 9706420951402272035u, 10123880198u }, { 15744148547788062576u, 2369632031840402142u, 6526186134u }, { 17936061801321712000u, 15599123897979399458u, 150128458009u }, { 9986394078324430610u, 17579576584023912658u, 25845630200u }, { 13849561248103430369u, 3480927339588501811u, 248952990756u }, { 12142378807953854930u, 3547346616671294635u, 36188701449u }, { 2513847703931031444u, 7705317123868384954u, 9192302045u }, { 1752183758129038045u, 4969425237478353909u, 221417706078u }, { 15824833342220556540u, 17043246700132217175u, 94269393081u }, { 8168747198299470695u, 17053788362783499470u, 185923916254u }, { 17414799840149357478u, 11102988228454224768u, 222924487719u }, { 83147520704167789u, 16944305387801685839u, 39601894197u }, { 2383542703041471269u, 11725142977459199276u, 53918552635u }, { 15540952725549257799u, 8175984171998533324u, 59635621274u }, { 6949835416232048690u, 1372352885142856895u, 154443220990u }, { 15398868937585367540u, 17975093466502888164u, 254074395398u }, { 14710915985268256079u, 6467823391459085653u, 6974431769u }, { 9665704836873335737u, 11319386883146885025u, 25350621408u }, { 2528789298740305993u, 9141999262922068637u, 224613625192u }, { 10562914675687726264u, 1587330393383478774u, 104495588773u }, { 17671658300096837111u, 884187548095712303u, 165086049353u }, { 356471401631698552u, 488841225726377268u, 73047931903u }, { 7450677157218003204u, 17462624199405856193u, 255026500135u }, { 317174560787152643u, 13183677579115583554u, 39946650754u }, { 7251937674440720374u, 11645015818917277779u, 130714688593u }, { 1252631516699038247u, 8760523002035971977u, 81631277572u }, { 10818009768860843867u, 10068817678491468042u, 4474908903u }, { 12330114194950162396u, 1273658177787418284u, 231545831700u }, { 15826681638261168822u, 3100019384328057661u, 20069045148u }, { 14240150078499211625u, 10363063568089458738u, 156168052387u }, { 10725372116242125421u, 13030756371481403666u, 163561782801u }, { 8434925524647833627u, 6538878900684195299u, 17706398718u }, { 17133902668520348241u, 8984884716779098868u, 254354473335u }, { 15093996047981365810u, 8728727397070363908u, 119487071576u }, { 6187974166976813153u, 6398650562917867005u, 88473185260u }, { 13946144707720259865u, 1190873176164938879u, 236346871542u }, { 9138079832881862582u, 4383628525805121795u, 246064557364u }, { 6600697628576225568u, 10189374699734119852u, 52237636978u }, { 8137099536646556597u, 5276291920541626391u, 114552367109u }, { 14169855543453903706u, 2692252373800386521u, 5286028358u }, { 3706403268650100765u, 11578684995169173920u, 70145947293u }, { 14736932266877982264u, 5799408022254132587u, 157627681771u }, { 18004795125138956004u, 15548569837712345290u, 235314386538u }, { 9068489270661002501u, 15763030464322902955u, 106842889659u }, { 7758835715193269217u, 13257749746581255500u, 187854515593u }, { 16943947811135261184u, 16152470009188707678u, 137718704053u }, { 6745843108403216384u, 13806790848493904003u, 181875627153u }, { 12338229654069444608u, 11981226523265951191u, 145748467631u }, { 14358176069683511296u, 5133628726077003713u, 175649503591u }, { 7083775185760813056u, 16183955741910833164u, 103278294570u }, { 5350276357316149248u, 13640425554331371454u, 42877333998u }, { 9223372036854775808u, 18108120906868035862u, 238739448950u }, { 0u, 6324011669895037184u, 118981643201u }, { 0u, 10444437689515769856u, 193342825359u }, { 0u, 12324712543665782784u, 143566194101u }, { 0u, 13928941951563857920u, 181668124005u }, { 0u, 3975288688270639104u, 101755089456u }, { 0u, 11141905478114607104u, 48215500831u }, { 0u, 4611686018427387904u, 31604003906u }, { 0u, 0u, 66250000000u }, { 0u, 0u, 128000000000u }, { 14699116688460625612u, 708211u, 0u }, { 6684126021499623499u, 708211796840712u, 0u }, { 12614606079692508506u, 4398362855256705725u, 38392u }, { 15358270276683001489u, 2812083125569302717u, 248238435728u }, { 18077126190953408995u, 12868509142973100603u, 144152443331u }, { 7864121581925945659u, 8726243776748165726u, 195697603278u }, { 3518026639210514839u, 358304413426858117u, 206473050623u }, { 4698310163811252280u, 3180720351566429470u, 255019423721u }, { 6101155398200416338u, 14053818240400098784u, 233172427195u }, { 16049178580360033341u, 7340140541492429288u, 187761859013u }, { 3167464649127375997u, 1323571167904965058u, 197397909816u }, { 12778923935480989904u, 14463851737583396026u, 56071750936u }, { 11875553912612980379u, 15122784818916048486u, 24784086973u }, { 10628760849351697057u, 13557974621377508955u, 189819807807u }, { 3408944711673234310u, 17525172074563876264u, 63734979276u }, { 2102091496050506178u, 15148880683074215967u, 204950041481u }, { 6254611118630245760u, 6744828147558597936u, 137821222467u }, { 2647941151989776368u, 9799290779647971692u, 67365637866u }, { 8855437735410157458u, 11170890203898678105u, 234531220617u }, { 10184270603132180103u, 7068779781287527905u, 137605575171u }, { 12079083162535627164u, 14474741922505540911u, 3383199319u }, { 5952952868716156729u, 17107062680405191514u, 87784677331u }, { 11958907037815852320u, 2712598571300237005u, 211927375726u }, { 10101562137321697626u, 3767556054903418641u, 110147050263u }, { 13633527411279258327u, 18158239681706277628u, 23204239622u }, { 16555627393501768728u, 10531652712128330681u, 6984360145u }, { 6359650463500280706u, 9548395326934120567u, 209570922037u }, { 8093923611102181967u, 15875647850297719390u, 53517619547u }, { 2848827352928635726u, 8215825295203192574u, 91860620594u }, { 4686723431961561511u, 12747310908260543144u, 50445380781u }, { 6245554925867652609u, 77706528053613642u, 173691033109u }, { 17527406820792516033u, 6024737704056756146u, 21004212479u }, { 12119966834653692210u, 6819452388570089667u, 255326601685u }, { 11606502845877928061u, 13695926775373186254u, 213369683254u }, { 424311496652297090u, 3746531715392682132u, 54742457678u }, { 5977664048034127173u, 4717376233154528116u, 78203099891u }, { 6702712461535947028u, 385190957950313369u, 243255729478u }, { 11384349854055020018u, 12388374310648616082u, 70020881243u }, { 3782955013294836188u, 1078067332084407770u, 91671575117u }, { 3531805968821207061u, 3257295319358714850u, 77058442147u }, { 3867566898657193228u, 1545453099660723457u, 163176578333u }, { 12688734637425072080u, 7495477664653506341u, 29083779180u }, { 18435982764454619691u, 7225503732673614354u, 108406330658u }, { 4728836163964677692u, 3935478326103643956u, 34391695342u }, { 2120012917348838977u, 10082240682742686210u, 238213342707u }, { 9856965465824679831u, 10838712705567897138u, 243546559362u }, { 11217197671061248816u, 2142546572501643680u, 130587567793u }, { 3840562972677739189u, 7893042119150331392u, 177116147682u }, { 17104366978925258617u, 12084811642251302615u, 226427882670u }, { 16177877219841993444u, 15317234482572954775u, 174655118951u }, { 7338522384267208704u, 2283226355108359361u, 103830348945u }, { 10935240458612244480u, 13359725152575722127u, 145123773948u }, { 1732868046462124032u, 13126551011491594557u, 252724232151u }, { 557965042578882560u, 3598021288691861269u, 215711591756u }, { 10454684322475540480u, 16462621795896662961u, 76195049124u }, { 13907115649320091648u, 14682112756964627332u, 164892440515u }, { 0u, 7174112100896070218u, 195795918927u }, { 0u, 5023109019590616064u, 79388909396u }, { 0u, 10765223023086141440u, 84272303285u }, { 0u, 8228137177297453056u, 181583583909u }, { 0u, 2891199497780592640u, 165446048210u }, { 0u, 15294857653247803392u, 210156732238u }, { 0u, 14303432416528695296u, 78829135894u }, { 0u, 0u, 22775390625u }, { 0u, 0u, 161000000000u }, { 14876458284855834550u, 10u, 0u }, { 10450704926982265198u, 10806454419u, 0u }, { 5385653213018257806u, 10806454419566533849u, 0u }, { 12735569669880147489u, 17118225092618494573u, 585819067u }, { 3619762560577729456u, 13385738875341807559u, 187927980841u }, { 11123448126624084269u, 8272682717439277193u, 41725642358u }, { 4072715118852885633u, 13402436483369350083u, 118448463028u }, { 18239087231420827283u, 10946328903241612536u, 180726547537u }, { 423431461216085297u, 16265808923426731252u, 81593401678u }, { 9360976716520160042u, 11080374459871185177u, 78881771268u }, { 11655927117263208920u, 1240761893433831916u, 4600668303u }, { 2646622721938364948u, 367264070493390483u, 143067261837u }, { 4496462484548171852u, 2863675693461092905u, 141019909425u }, { 13140258519803350063u, 7511929581752138999u, 49155240170u }, { 13089764333320627770u, 11154557789993845753u, 234407222518u }, { 6926286827289840501u, 8325416539745948522u, 246604689789u }, { 4985580225290866218u, 17745129874679852617u, 125451321734u }, { 10478790837359789693u, 1074820986392253357u, 134961965418u }, { 10041191967455692214u, 7820952682162838597u, 106058266162u }, { 5035461258013813797u, 8215518006273528603u, 50423974694u }, { 14208759661559249750u, 9680426791089900133u, 38445364123u }, { 12347272163241758840u, 16128495723604797412u, 155524776987u }, { 3372534174410277614u, 2264789053583348885u, 27874327505u }, { 17226704187274712984u, 11175458488686298083u, 209122774460u }, { 4250480179449852121u, 11026777810412287617u, 188605822818u }, { 4303723537755414374u, 16199890034895598640u, 98597762822u }, { 8680503847344854165u, 9094320719494763752u, 6878197798u }, { 8817608623911079652u, 1250835564687222832u, 38493004114u }, { 5692030448698539450u, 15362466642459337025u, 82067807931u }, { 16908836314686769809u, 7831109835595423828u, 187832800985u }, { 6073762347067727240u, 15426237284335022429u, 217424525314u }, { 10931066692585106200u, 15636308361455434548u, 2836257998u }, { 14466591364061539596u, 13967173875944980328u, 206847645974u }, { 4958077340960173341u, 18245979923595824097u, 22757162012u }, { 4076890037156765715u, 11335054479675278263u, 28989116553u }, { 14083973146609179058u, 11165339882630461707u, 137614474534u }, { 2565183738039805295u, 15944437408299395922u, 38605274287u }, { 1482420938751351224u, 15806416348777321161u, 175864349683u }, { 2151089495335413944u, 4201030477408556248u, 243856867547u }, { 3738604531753220913u, 9485474942554588907u, 219227738318u }, { 14195686514836005765u, 18238757647663230541u, 206514208626u }, { 17808833916231796970u, 4642199687824746379u, 114988725033u }, { 1302384553035657354u, 6134575894869364037u, 41251654149u }, { 1672033517974833698u, 11524208547121316008u, 5332556025u }, { 11673925532927662545u, 2734683241527878366u, 249624728597u }, { 3905334232240480709u, 10629223456178675171u, 21148247475u }, { 17411087320267472625u, 2788042336985254064u, 179576211358u }, { 16573305231063706617u, 17285498758066142502u, 158151140077u }, { 15481103236037148354u, 5525538192421886436u, 237937048765u }, { 907440704754420880u, 11414325503043801888u, 189299540025u }, { 3224970785139077759u, 7246608114685173259u, 57618771825u }, { 10560826509734608144u, 1007884269852184608u, 113392839413u }, { 4700940027512659968u, 13823717876510029312u, 245054637515u }, { 9733694683502084096u, 12487410768239429317u, 203749385247u }, { 1995535635724632064u, 3361062421598631942u, 31676943894u }, { 10629833226245373952u, 17853337379088328475u, 22182203558u }, { 15729384648544878592u, 11551561037491869885u, 166967831358u }, { 7205759403792793600u, 11480877996635204802u, 62626211378u }, { 0u, 5527488381934471912u, 50622379643u }, { 0u, 11143438404407726080u, 123299645745u }, { 0u, 6472279730688098304u, 49604087006u }, { 0u, 4561816853579563008u, 222350862987u }, { 0u, 2888714464062865408u, 139247296587u }, { 0u, 16258276129784201216u, 75156597524u }, { 0u, 720575940379279360u, 20881362915u }, { 0u, 0u, 227039062500u }, { 0u, 0u, 228000000000u }, { 7535526066623007027u, 164893u, 0u }, { 11302146918409311588u, 164893408501686u, 0u }, { 2480833299122194801u, 16409970870640346804u, 8938u }, { 11513226205589330558u, 7721907286269370594u, 234889586303u }, { 4073957068281936105u, 14300743897882155131u, 127418605432u }, { 3729887061093812886u, 2068482633821123575u, 120775244880u }, { 13616911779739451443u, 4922882895416406094u, 80112132668u }, { 13039053282195777666u, 9317632875623428410u, 60266870016u }, { 14490756113210417890u, 5693844901999766254u, 505109890u }, { 17432486112977557585u, 11569484900262102262u, 130308663950u }, { 14308820825344039837u, 3138170119352085637u, 142627183033u }, { 4190949538817536349u, 950584692575235243u, 185170120543u }, { 13616552502810964397u, 8136430299747162645u, 95051531299u }, { 4898145803694965031u, 6698711700804594470u, 35441076770u }, { 1399036321001644308u, 17401191571004302008u, 34363137888u }, { 17170331128243738540u, 4721732028538188150u, 96943320485u }, { 10641321388205367410u, 2984214103553086219u, 165255965606u }, { 6648873641312572851u, 13128675202005662068u, 166161774570u }, { 5988456964560374823u, 14638512997670672834u, 234711706908u }, { 9972593758348346915u, 12942085665769692438u, 28793555379u }, { 16709668921872818968u, 14131134357119205086u, 179701591869u }, { 6094829131503407767u, 8921946894736102919u, 61766050328u }, { 4892016478899926334u, 5601522560505809989u, 24483659710u }, { 13150857244079031538u, 8602606493507716808u, 190303659146u }, { 12983943395318785894u, 8576789731078566487u, 138466348232u }, { 15341644584614757478u, 17881118138842658549u, 200464948702u }, { 7507635124856644772u, 11624372674432704923u, 222969337356u }, { 11619655367084544354u, 6826284072848095635u, 12630158505u }, { 11553116952478783009u, 1646466632033733563u, 169370053601u }, { 17392150014233193245u, 17871081657060299180u, 225089255134u }, { 8877887560294980515u, 15910893124677544709u, 222968793277u }, { 18404180619915609503u, 11031217459450580944u, 189862531244u }, { 10079413095288181976u, 13554987390037243094u, 172598003496u }, { 14102802966539105550u, 15026714590903687870u, 40734817338u }, { 13333966026135891399u, 4406379654994689200u, 58814599830u }, { 12344968670173516152u, 13596329092861950242u, 150238870319u }, { 10577007819804726752u, 284812388227373260u, 47737058477u }, { 15337041354031088010u, 9285079159392309382u, 173015439710u }, { 14333607285614673616u, 15046108141952711893u, 94503345149u }, { 17171597563219696538u, 13795366909944958311u, 253815651156u }, { 2849642930482147564u, 12909920641180059961u, 84747848338u }, { 14791248423979435173u, 5333762939889788252u, 146699848200u }, { 13882371364576310127u, 6411331390005944495u, 8289143868u }, { 11735995808941329540u, 1447104583224217723u, 60347558971u }, { 11376996674339273181u, 11940049226167932871u, 59078447696u }, { 9849638057168043481u, 9772290783590472385u, 80647271365u }, { 18241520229279361964u, 16351989577831528444u, 197529756944u }, { 1865852368526961444u, 4376738725895725097u, 16886443131u }, { 10601487369276448158u, 13851276297739812763u, 123237263481u }, { 15999931310312762170u, 12641996203470333509u, 121750879192u }, { 5773775867713013570u, 7707081716407945022u, 216685323987u }, { 17726239863982547534u, 417638323657040024u, 211417801737u }, { 9711316695888316992u, 16438047707692449100u, 9022640218u }, { 17872002620723724288u, 14850108107043306316u, 90891108351u }, { 7429694208660733952u, 10423290807904720835u, 255805025973u }, { 1782821038871019520u, 16951162310302339314u, 181565047726u }, { 3225250234313474048u, 2752437506572397322u, 174918924350u }, { 10009250171830927360u, 3925815842962784589u, 62149209936u }, { 1152921504606846976u, 5274166674003605291u, 80212818903u }, { 0u, 5538963350863452832u, 215285913148u }, { 0u, 16900671634439028736u, 60300267804u }, { 0u, 2326997710751662080u, 28916187245u }, { 0u, 12327726161625874432u, 109126146798u }, { 0u, 5756455743825903616u, 238668287374u }, { 0u, 3018537650245074944u, 142312058091u }, { 0u, 16717361816799281152u, 235163635253u }, { 0u, 0u, 53906250000u }, { 0u, 0u, 16000000000u }, { 2285186318012886800u, 2516073738u, 0u }, { 9706420951402272035u, 2516073738123880198u, 0u }, { 2369632031840402142u, 11997425759292732054u, 136396630u }, { 15599123897979399458u, 11491152661270395161u, 86650381753u }, { 17579576584023912658u, 18181063258234881272u, 185622936633u }, { 3480927339588501811u, 2466921813123869732u, 57985597414u }, { 3547346616671294635u, 8430880678232179465u, 230133732099u }, { 7705317123868384954u, 6738034873677997533u, 3457038957u }, { 4969425237478353909u, 7678250951042929246u, 109365269602u }, { 17043246700132217175u, 1853560606315563193u, 98416238818u }, { 17053788362783499470u, 14942676593409905118u, 226100481721u }, { 11102988228454224768u, 4909892170837638183u, 185810044121u }, { 16944305387801685839u, 16871149368312132405u, 217266165787u }, { 11725142977459199276u, 16096130589333770811u, 27914586839u }, { 8175984171998533324u, 12512479187631824282u, 215872572987u }, { 1372352885142856895u, 16980304980540557310u, 59678302855u }, { 17975093466502888164u, 8640919162749295366u, 135920504177u }, { 6467823391459085653u, 7862382415464063513u, 113468425166u }, { 11319386883146885025u, 14534157903009925344u, 206426220604u }, { 9141999262922068637u, 12627464554215107944u, 60787898278u }, { 1587330393383478774u, 2456849734836299173u, 166684536225u }, { 884187548095712303u, 18428252197697827913u, 161133186090u }, { 488841225726377268u, 7244734215936736255u, 42998997553u }, { 17462624199405856193u, 14756175050504770087u, 49392737828u }, { 13183677579115583554u, 6764116534566945922u, 36799933852u }, { 11645015818917277779u, 1588822142405565521u, 156366683492u }, { 8760523002035971977u, 17053265624843842052u, 100086130220u }, { 10068817678491468042u, 16996891591759999207u, 44924459381u }, { 1273658177787418284u, 8565556232370585876u, 117921403339u }, { 3100019384328057661u, 14464960359145886620u, 203464339733u }, { 10363063568089458738u, 5813189542048784035u, 21784147072u }, { 13030756371481403666u, 9739241026882027025u, 128315133636u }, { 6538878900684195299u, 18175068535675302910u, 196527965313u }, { 8984884716779098868u, 10562697212061761911u, 129985272439u }, { 8728727397070363908u, 4264834835660801368u, 119572604963u }, { 6398650562917867005u, 13019066443690126316u, 35231197159u }, { 1190873176164938879u, 1828040177823321846u, 231705765006u }, { 4383628525805121795u, 11240369830376975668u, 142099098256u }, { 10189374699734119852u, 8886938465302549874u, 144609341669u }, { 5276291920541626391u, 9985240313589688325u, 229481761899u }, { 2692252373800386521u, 722909126956573766u, 107541300962u }, { 11578684995169173920u, 5493363474638452381u, 226039188982u }, { 5799408022254132587u, 12410535279213120491u, 246297795830u }, { 15548569837712345290u, 10543108918366869098u, 246672776465u }, { 15763030464322902955u, 12953909016524823995u, 17571543079u }, { 13257749746581255500u, 16505942145872588169u, 39702232814u }, { 16152470009188707678u, 12428594380392015797u, 238894788916u }, { 13806790848493904003u, 7528259605829768337u, 52673755451u }, { 11981226523265951191u, 18147447600042811311u, 59408107770u }, { 5133628726077003713u, 12021069431116183911u, 250983775105u }, { 16183955741910833164u, 11819985069665662506u, 129651663479u }, { 13640425554331371454u, 10401877114068152814u, 119640762674u }, { 18108120906868035862u, 4611631138117837942u, 50563886888u }, { 6324011669895037184u, 17200813398607252417u, 40249997024u }, { 10444437689515769856u, 14100466137553658767u, 224932457962u }, { 12324712543665782784u, 17887776768825509301u, 234764387800u }, { 13928941951563857920u, 12632656857970087269u, 216969698321u }, { 3975288688270639104u, 8923681664054686256u, 17684817700u }, { 11141905478114607104u, 6213926103737837599u, 36483753752u }, { 4611686018427387904u, 1233118281776157762u, 24336857609u }, { 0u, 30716279628678784u, 9066847476u }, { 0u, 15775734650898546688u, 244001665132u }, { 0u, 976806005729918976u, 108855204289u }, { 0u, 12460098853279891456u, 193052952759u }, { 0u, 5635665595421687808u, 183675463312u }, { 0u, 1805943450575568896u, 144305510044u }, { 0u, 11529215046068469760u, 156097900390u }, { 0u, 0u, 102625000000u }, { 0u, 0u, 64000000000u }, { 4398362855256705725u, 38392u, 0u }, { 2812083125569302717u, 38392238435728u, 0u }, { 12868509142973100603u, 4564018338575530435u, 2081u }, { 8726243776748165726u, 16553437246451512014u, 33247415929u }, { 358304413426858117u, 4339777136957372927u, 121897363631u }, { 3180720351566429470u, 18439463366554654697u, 175235259789u }, { 14053818240400098784u, 1370067356680643003u, 141999605312u }, { 7340140541492429288u, 4210124040914115013u, 64074271500u }, { 1323571167904965058u, 10692225626142609720u, 12228231281u }, { 14463851737583396026u, 11592856673895384344u, 113579626712u }, { 15122784818916048486u, 10284479231227406269u, 216628450019u }, { 13557974621377508955u, 4961071383534266431u, 227557522736u }, { 17525172074563876264u, 10960611551445686988u, 48268940218u }, { 15148880683074215967u, 14616396723115619209u, 186594175942u }, { 6744828147558597936u, 1025604265437492803u, 198792356454u }, { 9799290779647971692u, 11711588454892179178u, 102055598118u }, { 11170890203898678105u, 5580373263251565705u, 38634886482u }, { 7068779781287527905u, 14109334653033148931u, 82302512640u }, { 14474741922505540911u, 2899414033769399895u, 764868564u }, { 17107062680405191514u, 13233457234892808147u, 212157177549u }, { 2712598571300237005u, 3287946691509034862u, 205717387154u }, { 3767556054903418641u, 5488480288717445911u, 146178239947u }, { 18158239681706277628u, 11687233053874362630u, 203297531112u }, { 10531652712128330681u, 6783772100089274577u, 232633566173u }, { 9548395326934120567u, 7898291058728402485u, 221367749022u }, { 15875647850297719390u, 4423684977486598491u, 158428167216u }, { 8215825295203192574u, 2750833684599526706u, 48239808443u }, { 12747310908260543144u, 15669689830489025709u, 187149122992u }, { 77706528053613642u, 15117307274214954517u, 176849455587u }, { 6024737704056756146u, 8148639818575698175u, 227819510869u }, { 6819452388570089667u, 13006484426078994901u, 85441738649u }, { 13695926775373186254u, 10287496057845513526u, 153705082933u }, { 3746531715392682132u, 14159876032966532430u, 53557686278u }, { 4717376233154528116u, 15742212196465548019u, 6767608417u }, { 385190957950313369u, 2892220461917134150u, 97853387033u }, { 12388374310648616082u, 7487151560715393883u, 25156787585u }, { 1078067332084407770u, 7245756744165177933u, 129405879299u }, { 3257295319358714850u, 3067122860671533987u, 3392793260u }, { 1545453099660723457u, 8135043905834122525u, 172166269063u }, { 7495477664653506341u, 14730019368921022572u, 135441001613u }, { 7225503732673614354u, 495969939682055458u, 141798515950u }, { 3935478326103643956u, 5617761407265775598u, 238026886584u }, { 10082240682742686210u, 2087044847072781811u, 184304539456u }, { 10838712705567897138u, 15929674232061203330u, 64113138927u }, { 2142546572501643680u, 8658086469608285873u, 239863549370u }, { 7893042119150331392u, 18369871790780313570u, 186469355807u }, { 12084811642251302615u, 3545648451947416750u, 31995832745u }, { 15317234482572954775u, 13347376792767929959u, 169192209987u }, { 2283226355108359361u, 14482164459838203025u, 67723562745u }, { 13359725152575722127u, 8899577765623565820u, 249785079708u }, { 13126551011491594557u, 7095320096604405719u, 156482447077u }, { 3598021288691861269u, 2968593824439315788u, 229384638073u }, { 16462621795896662961u, 12621408323612585636u, 121160927793u }, { 14682112756964627332u, 3954422936414648259u, 49684207916u }, { 7174112100896070218u, 17143730087577690191u, 44214369696u }, { 5023109019590616064u, 5033045529399041876u, 160929363470u }, { 10765223023086141440u, 15857648521994521781u, 14272841944u }, { 8228137177297453056u, 16655573486499109541u, 216859644848u }, { 2891199497780592640u, 16652154439190075858u, 176902900447u }, { 15294857653247803392u, 18016950600164130638u, 223902715100u }, { 14303432416528695296u, 2086292996072613910u, 220976700849u }, { 0u, 17324462585194799521u, 177113098169u }, { 0u, 11079151463184927232u, 185939160998u }, { 0u, 5239846817488961536u, 166600602004u }, { 0u, 2778806963520143360u, 148284052665u }, { 0u, 6240890740138835968u, 185150639427u }, { 0u, 17250651344549707776u, 67338319364u }, { 0u, 4197354852709302272u, 4935159683u }, { 0u, 9223372036854775808u, 131227539062u }, { 0u, 0u, 118500000000u }, { 17118225092618494573u, 585819067u, 0u }, { 13385738875341807559u, 585819067927980841u, 0u }, { 8272682717439277193u, 5654803392547571318u, 31757315u }, { 13402436483369350083u, 2931628102185393332u, 3306547506u }, { 10946328903241612536u, 15964697617980212305u, 50158923877u }, { 16265808923426731252u, 450380868305846606u, 101865447992u }, { 11080374459871185177u, 14631133530814566148u, 56024415195u }, { 1240761893433831916u, 31969822783742095u, 219793155338u }, { 367264070493390483u, 10437269029385743245u, 10001733087u }, { 2863675693461092905u, 15196146496377392433u, 223565805487u }, { 7511929581752138999u, 4409099735137480938u, 175823784752u }, { 11154557789993845753u, 10644987914903248118u, 48239017775u }, { 8325416539745948522u, 3154431617534062973u, 47577065951u }, { 17745129874679852617u, 11702056331247960454u, 223171002080u }, { 1074820986392253357u, 15575315065965259114u, 224634369744u }, { 7820952682162838597u, 10759747609480050226u, 208844339521u }, { 8215518006273528603u, 12538236653960743718u, 65583287086u }, { 9680426791089900133u, 17857942663978005403u, 46679699170u }, { 16128495723604797412u, 11443004154750813211u, 226968081011u }, { 2264789053583348885u, 4004313188770806737u, 115620326498u }, { 11175458488686298083u, 17134872954824183228u, 98217074252u }, { 11026777810412287617u, 2659553912986171234u, 76928883324u }, { 16199890034895598640u, 9501854300969137926u, 124144174706u }, { 9094320719494763752u, 14528169966301018150u, 114515096553u }, { 1250835564687222832u, 18172091996515901778u, 233787573671u }, { 15362466642459337025u, 1133541705604751035u, 167985111081u }, { 7831109835595423828u, 18280349987988641497u, 41061449418u }, { 15426237284335022429u, 9936015874712336386u, 202990979758u }, { 15636308361455434548u, 15876720399740689614u, 174538632499u }, { 13967173875944980328u, 8618117825152456982u, 51860678737u }, { 18245979923595824097u, 8085525680745921564u, 81467189103u }, { 11335054479675278263u, 8072355444669730953u, 111438317225u }, { 11165339882630461707u, 9395030504766848294u, 169437603265u }, { 15944437408299395922u, 3537903114058185903u, 193509305624u }, { 15806416348777321161u, 2126094743961928691u, 24191790112u }, { 4201030477408556248u, 289185362555601115u, 32115255827u }, { 9485474942554588907u, 16909937501450129614u, 19015676769u }, { 18238757647663230541u, 14449642060360499058u, 97916689548u }, { 4642199687824746379u, 12433818908498244393u, 140783316665u }, { 6134575894869364037u, 11884444034578008581u, 185674038673u }, { 11524208547121316008u, 988625838444140793u, 145644257002u }, { 2734683241527878366u, 1675370907158909973u, 234053593514u }, { 10629223456178675171u, 15920186275316934067u, 170090822038u }, { 2788042336985254064u, 5600921198503757726u, 150863035027u }, { 17285498758066142502u, 10457357161776341741u, 147303626546u }, { 5525538192421886436u, 12225356765775740093u, 50566894467u }, { 11414325503043801888u, 4486633318598164537u, 131662737918u }, { 7246608114685173259u, 10302486602879381361u, 254243220879u }, { 1007884269852184608u, 15536428611301239541u, 143558498917u }, { 13823717876510029312u, 12026126645955462603u, 101842231482u }, { 12487410768239429317u, 14877968141142123551u, 186651937631u }, { 3361062421598631942u, 734560801645383190u, 95806536269u }, { 17853337379088328475u, 15648943144911081638u, 77039820620u }, { 11551561037491869885u, 13664182862003235646u, 76848330907u }, { 11480877996635204802u, 3895127525902132786u, 155740736837u }, { 5527488381934471912u, 5249187334214137467u, 69211155286u }, { 11143438404407726080u, 10642260063359027505u, 86284559015u }, { 6472279730688098304u, 783598951897779422u, 167576918074u }, { 4561816853579563008u, 5538576558607624843u, 58042478984u }, { 2888714464062865408u, 15974581187564609611u, 136300246836u }, { 16258276129784201216u, 7474269406918257428u, 52865983781u }, { 720575940379279360u, 8045286838779138019u, 37405180956u }, { 0u, 8184246376556341732u, 28436135873u }, { 0u, 1493267152679331840u, 193443668885u }, { 0u, 10179074811222818816u, 149080950174u }, { 0u, 3892499202005008384u, 158551808751u }, { 0u, 10341173215925108736u, 239211012804u }, { 0u, 6230307872002015232u, 196560596123u }, { 0u, 9295429630892703744u, 155337745666u }, { 0u, 0u, 2503906250u }, { 0u, 0u, 202000000000u }, { 16409970870640346804u, 8938u, 0u }, { 7721907286269370594u, 8938889586303u, 0u }, { 14300743897882155131u, 10665454627995623288u, 484u }, { 2068482633821123575u, 16803537892767562832u, 228578175453u }, { 4922882895416406094u, 8099123106849104444u, 221910921614u }, { 9317632875623428410u, 7077413686679401728u, 142439054343u }, { 5693844901999766254u, 13536636358372449666u, 7383667364u }, { 11569484900262102262u, 7280632235418610318u, 164733822527u }, { 3138170119352085637u, 6187823673116858809u, 63394683864u }, { 950584692575235243u, 8624343686231740255u, 216335442593u }, { 8136430299747162645u, 806211610822132771u, 161467526608u }, { 6698711700804594470u, 18388078233202190882u, 208043704818u }, { 17401191571004302008u, 7628864426595573600u, 242996819718u }, { 4721732028538188150u, 4530799784343874981u, 6413561569u }, { 2984214103553086219u, 8561580552078486438u, 225245615148u }, { 13128675202005662068u, 13349114951221999594u, 44464124211u }, { 14638512997670672834u, 10029144738508991772u, 51723656971u }, { 12942085665769692438u, 12601907197916268979u, 11543681025u }, { 14131134357119205086u, 1329580921391066941u, 1683150758u }, { 8921946894736102919u, 3198179786356761112u, 166072076726u }, { 5601522560505809989u, 11406753413634654142u, 182173373673u }, { 8602606493507716808u, 11131812960525182090u, 233618361341u }, { 8576789731078566487u, 14299636753645227208u, 253603456789u }, { 17881118138842658549u, 12964114684643663326u, 21775184861u }, { 11624372674432704923u, 5019257593846306316u, 221702786065u }, { 6826284072848095635u, 6929086798159998121u, 17272094499u }, { 1646466632033733563u, 18359765766933703649u, 35375626547u }, { 17871081657060299180u, 9993076234752063198u, 51995284896u }, { 15910893124677544709u, 3257189215046584509u, 160541725748u }, { 11031217459450580944u, 2905234736672690348u, 52176572581u }, { 13554987390037243094u, 12064985302079670056u, 165157493090u }, { 15026714590903687870u, 14315096064942799930u, 98654044163u }, { 4406379654994689200u, 11943971043551974038u, 3776022912u }, { 13596329092861950242u, 12472773152119929647u, 128647483967u }, { 284812388227373260u, 7791259796982183085u, 63676150387u }, { 9285079159392309382u, 16866829442051086686u, 115422365039u }, { 15046108141952711893u, 3702498393844653053u, 111914352656u }, { 13795366909944958311u, 2057239613841701716u, 16200712840u }, { 12909920641180059961u, 17201969976738286226u, 136111523182u }, { 5333762939889788252u, 18271566505443461640u, 110932520660u }, { 6411331390005944495u, 18368509115417119804u, 212990503604u }, { 1447104583224217723u, 7613923684154518587u, 180995758874u }, { 11940049226167932871u, 17984805084714865232u, 26412751629u }, { 9772290783590472385u, 4220802739051410373u, 13974958237u }, { 16351989577831528444u, 17812459042810815760u, 157228810174u }, { 4376738725895725097u, 10629526089664605307u, 190965615339u }, { 13851276297739812763u, 17437443267816548473u, 235576227763u }, { 12641996203470333509u, 12506371893701049304u, 179945285693u }, { 7707081716407945022u, 15737221540003030739u, 61677971778u }, { 417638323657040024u, 2358380859011605513u, 66853116489u }, { 16438047707692449100u, 10042972713837039706u, 73127848082u }, { 14850108107043306316u, 13424397272769642495u, 146544430641u }, { 10423290807904720835u, 6867102315755663029u, 49727738034u }, { 16951162310302339314u, 8690748404825506734u, 178372266362u }, { 2752437506572397322u, 956229930815387710u, 122471126415u }, { 3925815842962784589u, 7734449506297687888u, 143051837328u }, { 5274166674003605291u, 16332184961683848151u, 144419285347u }, { 5538963350863452832u, 15580777817612768828u, 99885369520u }, { 16900671634439028736u, 17404245271944696092u, 176844635657u }, { 2326997710751662080u, 13201420160494469229u, 9943486026u }, { 12327726161625874432u, 16511717657124068078u, 74715650420u }, { 5756455743825903616u, 14131292492116594062u, 116895102007u }, { 3018537650245074944u, 18429136031865875691u, 55766058900u }, { 16717361816799281152u, 2563978348305862197u, 148999045466u }, { 0u, 14239974392147482896u, 90138993544u }, { 0u, 11164201396098998272u, 136771950558u }, { 0u, 7116971104932986880u, 222605212570u }, { 0u, 12437629862867369984u, 154385811776u }, { 0u, 16501893821638901760u, 64674245265u }, { 0u, 10649324268870959104u, 145894569456u }, { 0u, 7205759403792793600u, 240577301025u }, { 0u, 0u, 33390625000u }, { 0u, 0u, 232000000000u }, { 11997425759292732054u, 136396630u, 0u }, { 11491152661270395161u, 136396630650381753u, 0u }, { 18181063258234881272u, 3016823727048309817u, 7394076u }, { 2466921813123869732u, 17405973192644624358u, 28163542341u }, { 8430880678232179465u, 8937219978302591747u, 69943579697u }, { 6738034873677997533u, 15178463196824222317u, 49484487665u }, { 7678250951042929246u, 11979404627460330594u, 241822826138u }, { 1853560606315563193u, 2006448052689740002u, 154649404826u }, { 14942676593409905118u, 16330465320863239865u, 154108769766u }, { 4909892170837638183u, 17136208883957646553u, 230885276298u }, { 16871149368312132405u, 140455118208931867u, 138928955745u }, { 16096130589333770811u, 3964972929179372247u, 97007614087u }, { 12512479187631824282u, 3378050330022776379u, 135214941613u }, { 16980304980540557310u, 6065353437512901255u, 173183124475u }, { 8640919162749295366u, 12768753059854699889u, 251328803468u }, { 7862382415464063513u, 6848720690951013326u, 140692195490u }, { 14534157903009925344u, 10953228058585475132u, 162371269892u }, { 12627464554215107944u, 15539127852083296166u, 4593775682u }, { 2456849734836299173u, 14534853647735598497u, 66842377808u }, { 18428252197697827913u, 1506909603576368170u, 80787935995u }, { 7244734215936736255u, 5475702579938239025u, 251081689733u }, { 14756175050504770087u, 12039747373985783332u, 133296838431u }, { 6764116534566945922u, 17572399137760898460u, 31652676012u }, { 1588822142405565521u, 869552790852091236u, 172952601666u }, { 17053265624843842052u, 4549585778048181804u, 66047138551u }, { 16996891591759999207u, 4121918231767210357u, 247246633539u }, { 8565556232370585876u, 1558397953312543179u, 67223449635u }, { 14464960359145886620u, 6067524298738069781u, 35084480922u }, { 5813189542048784035u, 5811095224555517056u, 154328921151u }, { 9739241026882027025u, 6440894514158997188u, 63315020103u }, { 18175068535675302910u, 4612748874388784257u, 71349161591u }, { 10562697212061761911u, 9908101430749813367u, 119250057617u }, { 4264834835660801368u, 15150017990912190499u, 145537119254u }, { 13019066443690126316u, 17470426264690059239u, 22821284120u }, { 1828040177823321846u, 9615161096851907726u, 24947073705u }, { 11240369830376975668u, 9227932132124142224u, 169521238927u }, { 8886938465302549874u, 4794113194321211621u, 143500247203u }, { 9985240313589688325u, 391512698859146347u, 163259889397u }, { 722909126956573766u, 17209658878068655842u, 245021223945u }, { 5493363474638452381u, 3077364726606876150u, 9932937477u }, { 12410535279213120491u, 1952989567673965814u, 5166824276u }, { 10543108918366869098u, 11172860676923186449u, 84105871776u }, { 12953909016524823995u, 17338078544784947239u, 160605681990u }, { 16505942145872588169u, 4593380466519703278u, 70939899121u }, { 12428594380392015797u, 786884753602720052u, 241249007654u }, { 7528259605829768337u, 17848875822468020539u, 38042657107u }, { 18147447600042811311u, 2899664567187130618u, 83967589497u }, { 12021069431116183911u, 2973178834961857409u, 121157191131u }, { 11819985069665662506u, 11117453141176836727u, 219161176347u }, { 10401877114068152814u, 7535238370146462002u, 27602678342u }, { 4611631138117837942u, 10246175467290865448u, 70408486090u }, { 17200813398607252417u, 1203128834127050464u, 202555446285u }, { 14100466137553658767u, 14518048959078919658u, 13065221744u }, { 17887776768825509301u, 1553474987376920024u, 112787025011u }, { 12632656857970087269u, 14956572380830948369u, 115084214047u }, { 8923681664054686256u, 7594162606042048292u, 31810797413u }, { 6213926103737837599u, 14461296147288811288u, 101411680379u }, { 1233118281776157762u, 18305427728131488265u, 123783948434u }, { 30716279628678784u, 10253208939347909876u, 146992339225u }, { 15775734650898546688u, 6446028915490812012u, 25555827570u }, { 976806005729918976u, 12986063676957432257u, 114349439927u }, { 12460098853279891456u, 9769714697972762807u, 183703975922u }, { 5635665595421687808u, 97429465146664592u, 242529617295u }, { 1805943450575568896u, 16395571728207795868u, 143005281661u }, { 11529215046068469760u, 6331668478323650406u, 125888805724u }, { 0u, 18129911846294207040u, 92343240435u }, { 0u, 9890094564876124160u, 243982824490u }, { 0u, 12290856656987750400u, 42536143100u }, { 0u, 8498454992640802816u, 252666288674u }, { 0u, 5341660584200896512u, 34460702168u }, { 0u, 9288674231451648000u, 216289572000u }, { 0u, 1152921504606846976u, 160503540039u }, { 0u, 0u, 71062500000u }, { 0u, 0u, 160000000000u }, { 4564018338575530435u, 2081u, 0u }, { 16553437246451512014u, 2081247415929u, 0u }, { 4339777136957372927u, 15212079674427582639u, 112u }, { 18439463366554654697u, 10179808126814248333u, 112824648491u }, { 1370067356680643003u, 6066766544199222848u, 43551848504u }, { 4210124040914115013u, 6625308131806923532u, 56328880073u }, { 10692225626142609720u, 9122786786400665713u, 201359158673u }, { 11592856673895384344u, 11932880778639151320u, 145494547262u }, { 10284479231227406269u, 3884040911779255011u, 62646882763u }, { 4961071383534266431u, 13441817515637357872u, 203210554279u }, { 10960611551445686988u, 11628577856022352826u, 167728682387u }, { 14616396723115619209u, 13296656925520243654u, 147630386468u }, { 1025604265437492803u, 5020720704545399398u, 36720813216u }, { 11711588454892179178u, 14121973606499014694u, 160272173814u }, { 5580373263251565705u, 3642481034345420114u, 246765553723u }, { 14109334653033148931u, 9845536238569696768u, 59197459292u }, { 2899414033769399895u, 17655403572195686356u, 92533727588u }, { 13233457234892808147u, 8377495365136654029u, 100957101345u }, { 3287946691509034862u, 13713682649609025426u, 33454144933u }, { 5488480288717445911u, 1367709905452854731u, 165743420226u }, { 11687233053874362630u, 9981467701727208680u, 66074143702u }, { 6783772100089274577u, 6277920117543306205u, 214541096448u }, { 7898291058728402485u, 9344111460418701726u, 340326731u }, { 4423684977486598491u, 4918507011364617264u, 75506545297u }, { 2750833684599526706u, 6554777203830755259u, 145266632799u }, { 15669689830489025709u, 4198262173120265648u, 95355335184u }, { 15117307274214954517u, 8080325935698446819u, 16227588248u }, { 8148639818575698175u, 12797633874200091733u, 152438035346u }, { 13006484426078994901u, 8376502502208665497u, 146693761122u }, { 10287496057845513526u, 9891973386793349173u, 98454091110u }, { 14159876032966532430u, 14877430279003795462u, 102536244951u }, { 15742212196465548019u, 8759933935842067041u, 215806507111u }, { 2892220461917134150u, 3753418510388703513u, 103474876970u }, { 7487151560715393883u, 2961383332545305985u, 42203473225u }, { 7245756744165177933u, 2497674184068629507u, 73160536912u }, { 3067122860671533987u, 15244544070742305452u, 80135399188u }, { 8135043905834122525u, 45953573565810823u, 20826408390u }, { 14730019368921022572u, 3960077421351906445u, 198002491148u }, { 495969939682055458u, 3173330011013883118u, 12214676227u }, { 5617761407265775598u, 11026266219545759160u, 3172026564u }, { 2087044847072781811u, 8886757764964685632u, 196597735089u }, { 15929674232061203330u, 13952322129918090479u, 177481752103u }, { 8658086469608285873u, 4127250666614902202u, 39756356898u }, { 18369871790780313570u, 17649958504065306911u, 34223738706u }, { 3545648451947416750u, 13269305359002216873u, 82956806167u }, { 13347376792767929959u, 16236593433831947843u, 23719330484u }, { 14482164459838203025u, 13580930396682424057u, 180880187493u }, { 8899577765623565820u, 421976357197961116u, 101736223712u }, { 7095320096604405719u, 2962130818798626533u, 224022875384u }, { 2968593824439315788u, 8234383947306356345u, 248160577433u }, { 12621408323612585636u, 4380469931801381425u, 153446386848u }, { 3954422936414648259u, 15279887469027055916u, 160237465750u }, { 17143730087577690191u, 8534542821713755552u, 150828324359u }, { 5033045529399041876u, 7814613482565088782u, 7462658493u }, { 15857648521994521781u, 13771954404705323224u, 189423631045u }, { 16655573486499109541u, 4568173274762548144u, 197746579144u }, { 16652154439190075858u, 8105292616250821343u, 200247641169u }, { 18016950600164130638u, 2923678426777275612u, 81439388793u }, { 2086292996072613910u, 1808633176918384049u, 121158492925u }, { 17324462585194799521u, 18118642609460438969u, 253098046200u }, { 11079151463184927232u, 18138164175864360870u, 248982213583u }, { 5239846817488961536u, 4031433690465792404u, 207983271850u }, { 2778806963520143360u, 5012226396942308537u, 170218544458u }, { 6240890740138835968u, 7889712298793536835u, 74271713337u }, { 17250651344549707776u, 13500762396543628804u, 57427702160u }, { 4197354852709302272u, 501020624068841347u, 144731877796u }, { 9223372036854775808u, 8370653768288261750u, 164027160382u }, { 0u, 647579990023635200u, 62453774050u }, { 0u, 11106569307181154304u, 226035105381u }, { 0u, 10797461613892861952u, 101602088328u }, { 0u, 17627230675448889344u, 136585331566u }, { 0u, 12197735707942322176u, 110955574089u }, { 0u, 12871287735024877568u, 73661240577u }, { 0u, 4611686018427387904u, 1697753906u }, { 0u, 0u, 50250000000u }, { 0u, 0u, 128000000000u }, { 5654803392547571318u, 31757315u, 0u }, { 2931628102185393332u, 31757315306547506u, 0u }, { 15964697617980212305u, 9451803574512021605u, 1721567u }, { 450380868305846606u, 8662766454758138424u, 223512383298u }, { 14631133530814566148u, 9207992007314947035u, 66469609510u }, { 31969822783742095u, 17118602861291201802u, 38499166246u }, { 10437269029385743245u, 11186560605745599967u, 38928001320u }, { 15196146496377392433u, 10505549821532796847u, 40606424665u }, { 4409099735137480938u, 18133667530488679216u, 89569506996u }, { 10644987914903248118u, 10778135771244330799u, 180983028086u }, { 3154431617534062973u, 17087985777033767391u, 118584283910u }, { 11702056331247960454u, 2639185991757283040u, 6926341565u }, { 15575315065965259114u, 5401720287293896400u, 189143070559u }, { 10759747609480050226u, 9816495392633895233u, 95292827843u }, { 12538236653960743718u, 10042051500090034990u, 195532153281u }, { 17857942663978005403u, 11629689537856384738u, 193544380702u }, { 11443004154750813211u, 2099086731766010483u, 30630446733u }, { 4004313188770806737u, 13665537898516458594u, 141113791719u }, { 17134872954824183228u, 16375672064669490764u, 231740810293u }, { 2659553912986171234u, 7770550512184564348u, 53887726961u }, { 9501854300969137926u, 6197048880720627314u, 113421242387u }, { 14528169966301018150u, 17963594118523106281u, 19335942692u }, { 18172091996515901778u, 8255454642407818663u, 36973808388u }, { 1133541705604751035u, 16744201957549498409u, 4447529092u }, { 18280349987988641497u, 17442505417202859722u, 132907705006u }, { 9936015874712336386u, 6383975767786687150u, 174945560113u }, { 15876720399740689614u, 15245442964998335795u, 49346076019u }, { 8618117825152456982u, 2910016124519524433u, 115826457119u }, { 8085525680745921564u, 3847913871169988463u, 31157752290u }, { 8072355444669730953u, 17210451512590059177u, 226208595828u }, { 9395030504766848294u, 17899408909991454145u, 116932980445u }, { 3537903114058185903u, 5920601932753251608u, 221970328901u }, { 2126094743961928691u, 16521781895108979744u, 69320956473u }, { 289185362555601115u, 3697493405554698771u, 57895647591u }, { 16909937501450129614u, 2816108280295732065u, 103200441519u }, { 14449642060360499058u, 14251078772056398988u, 175152661535u }, { 12433818908498244393u, 4543066550096031417u, 31772552528u }, { 11884444034578008581u, 3099369389734296977u, 80246280131u }, { 988625838444140793u, 5243484113636490986u, 195168017151u }, { 1675370907158909973u, 6823370511605197226u, 255284249843u }, { 15920186275316934067u, 11396290277624641942u, 243369895656u }, { 5600921198503757726u, 15934361408437566099u, 232617794133u }, { 10457357161776341741u, 14939272230935131954u, 85863803462u }, { 12225356765775740093u, 7500666177940329347u, 70809859570u }, { 4486633318598164537u, 4806714453065462270u, 242406611928u }, { 10302486602879381361u, 11557851247268441487u, 216260572512u }, { 15536428611301239541u, 10655523157206817381u, 96626552371u }, { 12026126645955462603u, 14769600176490881210u, 51577637067u }, { 14877968141142123551u, 16688495540925795167u, 203800661629u }, { 734560801645383190u, 909793965395524173u, 125904685156u }, { 15648943144911081638u, 12724590949761703756u, 100049320029u }, { 13664182862003235646u, 10810739657314826395u, 93689801457u }, { 3895127525902132786u, 2431218615388671301u, 241586051371u }, { 5249187334214137467u, 4235001167959059286u, 43131796625u }, { 10642260063359027505u, 6253317787396334247u, 145229579873u }, { 783598951897779422u, 9534525563070371898u, 97338993036u }, { 5538576558607624843u, 8392783992374030728u, 140516867666u }, { 15974581187564609611u, 16356257019231647540u, 82454973731u }, { 7474269406918257428u, 12896334001521091877u, 35886674469u }, { 8045286838779138019u, 1427636373320877084u, 37699111667u }, { 8184246376556341732u, 16116755731295043521u, 243077392322u }, { 1493267152679331840u, 15945633911163986837u, 194873691078u }, { 10179074811222818816u, 7510154241072743838u, 198864414546u }, { 3892499202005008384u, 3571560509790395119u, 82407126277u }, { 10341173215925108736u, 3576991649007035076u, 5193614683u }, { 6230307872002015232u, 15509961892750732443u, 91193909105u }, { 9295429630892703744u, 17789791359353349378u, 113840796718u }, { 0u, 18331227331079738314u, 46964386521u }, { 0u, 15386712883100476416u, 217993737824u }, { 0u, 14082462055028752384u, 96834115376u }, { 0u, 12919043128765186048u, 48763411797u }, { 0u, 6125373368465096704u, 85700342731u }, { 0u, 12335992698065387520u, 203332057155u }, { 0u, 2774217370460225536u, 67668735504u }, { 0u, 0u, 16150390625u }, { 0u, 0u, 97000000000u }, { 10665454627995623288u, 484u, 0u }, { 16803537892767562832u, 484578175453u, 0u }, { 8099123106849104444u, 4962829537462579598u, 26u }, { 7077413686679401728u, 5711259460785241095u, 26269035528u }, { 13536636358372449666u, 13845894607204897444u, 8309607995u }, { 7280632235418610318u, 12116633056637003327u, 59750587450u }, { 6187823673116858809u, 2965791047992089560u, 58656843994u }, { 8624343686231740255u, 16021997451315962529u, 218160775854u }, { 806211610822132771u, 3942052271663803856u, 174868554222u }, { 18388078233202190882u, 15669876414782439922u, 238213699081u }, { 7628864426595573600u, 10594415915406145286u, 9849465702u }, { 4530799784343874981u, 10789820553031921377u, 102574324437u }, { 8561580552078486438u, 3989990218583987244u, 213584917344u }, { 13349114951221999594u, 2937341169808224563u, 96216297803u }, { 10029144738508991772u, 16267436558584536843u, 75159233583u }, { 12601907197916268979u, 16221580362814625793u, 47881859502u }, { 1329580921391066941u, 9695437602320209830u, 174879373633u }, { 3198179786356761112u, 10729753156793715126u, 65525590725u }, { 11406753413634654142u, 2609241432056861929u, 197581661084u }, { 11131812960525182090u, 8462663743997037565u, 156141447261u }, { 14299636753645227208u, 14993422143908194069u, 93458761920u }, { 12964114684643663326u, 1307443894537745373u, 192812795043u }, { 5019257593846306316u, 10017257439419829265u, 163070876675u }, { 6929086798159998121u, 16754772009970777891u, 3543036613u }, { 18359765766933703649u, 11722573031602862387u, 197908278010u }, { 9993076234752063198u, 7363764277467092384u, 250635481957u }, { 3257189215046584509u, 6733958494847390772u, 101399190461u }, { 2905234736672690348u, 8799796600227451045u, 189365048621u }, { 12064985302079670056u, 10512023194742249826u, 45477037929u }, { 14315096064942799930u, 4572542132337197059u, 105569857919u }, { 11943971043551974038u, 12600500455757416832u, 127247878005u }, { 12472773152119929647u, 7873789864743195199u, 117683074498u }, { 7791259796982183085u, 15724851676325671539u, 194426839003u }, { 16866829442051086686u, 8748017220462413167u, 219852445917u }, { 3702498393844653053u, 14172589522760466448u, 221474230963u }, { 2057239613841701716u, 9520545591489413768u, 179768297617u }, { 17201969976738286226u, 12488551088392570222u, 145516109810u }, { 18271566505443461640u, 1135798823651241684u, 242677005711u }, { 18368509115417119804u, 11168725610120161972u, 143061571777u }, { 7613923684154518587u, 9580104948718508826u, 193605457828u }, { 17984805084714865232u, 16638722716909738765u, 164519338529u }, { 4220802739051410373u, 15732724012348272797u, 33901986965u }, { 17812459042810815760u, 12269722190021214142u, 149852872677u }, { 10629526089664605307u, 13110655916311972587u, 229665142972u }, { 17437443267816548473u, 6618112997062866867u, 188710730081u }, { 12506371893701049304u, 8457936459015989309u, 97358768624u }, { 15737221540003030739u, 3329167139937134914u, 240458505654u }, { 2358380859011605513u, 5245511557216705097u, 182180474512u }, { 10042972713837039706u, 5655931353280440466u, 144284359751u }, { 13424397272769642495u, 604622132328697393u, 71306608653u }, { 6867102315755663029u, 8673282619234652338u, 13032776631u }, { 8690748404825506734u, 16929477433058445690u, 183470179592u }, { 956229930815387710u, 11036952409253549455u, 8917748810u }, { 7734449506297687888u, 18199392190170386320u, 74598314388u }, { 16332184961683848151u, 9683116091880335715u, 148986591027u }, { 15580777817612768828u, 2993913337608915120u, 51524922775u }, { 17404245271944696092u, 4490779842162392585u, 151162300367u }, { 13201420160494469229u, 946849923353644618u, 207243445663u }, { 16511717657124068078u, 3613491058474899828u, 159051328837u }, { 14131292492116594062u, 14624054199004410935u, 69195887742u }, { 18429136031865875691u, 12088470271991908244u, 126792771566u }, { 2563978348305862197u, 10071980927725011290u, 238655317286u }, { 14239974392147482896u, 2833441711428854664u, 38546003180u }, { 11164201396098998272u, 17655572411864340446u, 236153601182u }, { 7116971104932986880u, 4997642792058747802u, 158957110498u }, { 12437629862867369984u, 11489200787635734848u, 226270922758u }, { 16501893821638901760u, 12983586226429536913u, 6622830822u }, { 10649324268870959104u, 12311150768725063152u, 230703841619u }, { 7205759403792793600u, 8530052476845967905u, 83667388820u }, { 0u, 6282736361499820264u, 148462415071u }, { 0u, 11337164765929082880u, 223340587820u }, { 0u, 8343856200414134272u, 44614588933u }, { 0u, 17889330377156198400u, 5452321350u }, { 0u, 17730714064155312128u, 70969782542u }, { 0u, 7449235258647511040u, 14961183935u }, { 0u, 9943947977234055168u, 191403823852u }, { 0u, 0u, 236539062500u }, { 0u, 0u, 228000000000u }, { 3016823727048309817u, 7394076u, 0u }, { 17405973192644624358u, 7394076163542341u, 0u }, { 8937219978302591747u, 12396245121240683569u, 400833u }, { 15178463196824222317u, 10248996648596888561u, 193672001794u }, { 11979404627460330594u, 11257495103713935002u, 2555599221u }, { 2006448052689740002u, 7555396579247433114u, 117610270032u }, { 16330465320863239865u, 4805022328730367462u, 80409578869u }, { 17136208883957646553u, 7056637817080232586u, 117260480782u }, { 140455118208931867u, 10811411483818434913u, 14382541102u }, { 3964972929179372247u, 16962406704495245447u, 46586087790u }, { 3378050330022776379u, 18074517319117194669u, 110919533909u }, { 6065353437512901255u, 3702019776117654523u, 85979821547u }, { 12768753059854699889u, 3551977551381082764u, 235200686894u }, { 6848720690951013326u, 16442608985936005282u, 46192553088u }, { 10953228058585475132u, 3580046275479139588u, 128891355619u }, { 15539127852083296166u, 8737412692712715330u, 227194074697u }, { 14534853647735598497u, 3082033243045084752u, 73473656091u }, { 1506909603576368170u, 16401023756841128699u, 27167077356u }, { 5475702579938239025u, 7520296082779572869u, 236889101279u }, { 12039747373985783332u, 9854104766152464159u, 223407676067u }, { 17572399137760898460u, 14169188802648310188u, 163534192089u }, { 869552790852091236u, 2018609909210367042u, 217768113264u }, { 4549585778048181804u, 8270271948267674359u, 112109429062u }, { 4121918231767210357u, 12320338602894572099u, 70448332340u }, { 1558397953312543179u, 17538536685990080547u, 52667886893u }, { 6067524298738069781u, 15833914616956760474u, 45950765978u }, { 5811095224555517056u, 6137696141415969855u, 154858358231u }, { 6440894514158997188u, 9757490468419438919u, 215332725174u }, { 4612748874388784257u, 3566639201356598903u, 182528954618u }, { 9908101430749813367u, 9760900035773954449u, 250193347898u }, { 15150017990912190499u, 3873778773990716438u, 58529139451u }, { 17470426264690059239u, 2295668377270167832u, 251209997968u }, { 9615161096851907726u, 1791721710912807593u, 144124448432u }, { 9227932132124142224u, 10571009006922683279u, 176097129428u }, { 4794113194321211621u, 9840791932778184867u, 212573055546u }, { 391512698859146347u, 11525464956561274613u, 58533470399u }, { 17209658878068655842u, 4435781488897895433u, 191624796707u }, { 3077364726606876150u, 6395563367070996741u, 35240464196u }, { 1952989567673965814u, 15538690795135662932u, 68346704184u }, { 11172860676923186449u, 16294558813563371936u, 56842354115u }, { 17338078544784947239u, 4942096228426070342u, 195883329803u }, { 4593380466519703278u, 6910116424372647153u, 11267911573u }, { 786884753602720052u, 17923400669760829478u, 149374598161u }, { 17848875822468020539u, 4134686917293039955u, 17971629497u }, { 2899664567187130618u, 16857102463116098681u, 185224141826u }, { 2973178834961857409u, 11364321508775167451u, 2913825355u }, { 11117453141176836727u, 7966947780972783899u, 75616061103u }, { 7535238370146462002u, 11261055695926686278u, 175431889104u }, { 10246175467290865448u, 9227040437353594058u, 208610463052u }, { 1203128834127050464u, 7185344074282882061u, 76500198864u }, { 14518048959078919658u, 14197856148610578032u, 208389518282u }, { 1553474987376920024u, 885688687260429427u, 202769667324u }, { 14956572380830948369u, 17407816160380305183u, 252048013279u }, { 7594162606042048292u, 17812728703806357349u, 223943679604u }, { 14461296147288811288u, 17120198191964319867u, 116965629957u }, { 18305427728131488265u, 12091952048375408786u, 5928087803u }, { 10253208939347909876u, 405056939269888281u, 251655506034u }, { 6446028915490812012u, 12485440679452408690u, 114021958180u }, { 12986063676957432257u, 8394369900823444407u, 36676837095u }, { 9769714697972762807u, 2877421667354294258u, 231455059704u }, { 97429465146664592u, 2676980714750756239u, 248155985341u }, { 16395571728207795868u, 6119309228579057021u, 189145119415u }, { 6331668478323650406u, 18203256146533333852u, 183331728417u }, { 18129911846294207040u, 351919978865493747u, 33986800493u }, { 9890094564876124160u, 5190010931882390570u, 109019077620u }, { 12290856656987750400u, 6982466386088036604u, 244281351056u }, { 8498454992640802816u, 4707293888784996898u, 144378520261u }, { 5341660584200896512u, 690306801165964760u, 197255182913u }, { 9288674231451648000u, 12456770961278956704u, 65037421606u }, { 1152921504606846976u, 16946092489294063943u, 38675282906u }, { 0u, 11098404173866185376u, 218918649514u }, { 0u, 15152070965853306880u, 170601645695u }, { 0u, 17370091362040414208u, 127821395412u }, { 0u, 10141938552171134976u, 212941634539u }, { 0u, 10586988556645826560u, 235549795590u }, { 0u, 12169852093061922816u, 6573921799u }, { 0u, 16717361816799281152u, 7659729003u }, { 0u, 0u, 107906250000u }, { 0u, 0u, 16000000000u }, { 15212079674427582639u, 112u, 0u }, { 10179808126814248333u, 112824648491u, 0u }, { 6066766544199222848u, 2144184049294538808u, 6u }, { 6625308131806923532u, 4108002197393276873u, 6116236450u }, { 9122786786400665713u, 6446230217393892753u, 162222695245u }, { 11932880778639151320u, 5571068025259989822u, 77349450840u }, { 3884040911779255011u, 14804812668872528331u, 88302008202u }, { 13441817515637357872u, 17369928488562523047u, 138802570502u }, { 11628577856022352826u, 2967474173531035027u, 6941625710u }, { 13296656925520243654u, 5291425437992807716u, 110160867097u }, { 5020720704545399398u, 14219547193739388064u, 25286848747u }, { 14121973606499014694u, 17720313647158217462u, 235770843197u }, { 3642481034345420114u, 12334850628290578491u, 61960620127u }, { 9845536238569696768u, 7818499847417334620u, 95668673592u }, { 17655403572195686356u, 136007040922198372u, 56423841726u }, { 8377495365136654029u, 8523477092112604449u, 190007372956u }, { 13713682649609025426u, 367934822655966629u, 156462058619u }, { 1367709905452854731u, 12964987687054730050u, 123019945786u }, { 9981467701727208680u, 15267036012420885462u, 58702833390u }, { 6277920117543306205u, 11142900264750765568u, 238827627680u }, { 9344111460418701726u, 13680181547777718603u, 160604057833u }, { 4918507011364617264u, 13001922925761426065u, 233741604127u }, { 6554777203830755259u, 2397730045956515935u, 31704835654u }, { 4198262173120265648u, 4482395522588406288u, 70129981206u }, { 8080325935698446819u, 3255525722490493080u, 22242991148u }, { 12797633874200091733u, 836222287193822098u, 44176482403u }, { 8376502502208665497u, 420898743993182306u, 99045331701u }, { 9891973386793349173u, 11652649973356574054u, 245022816966u }, { 14877430279003795462u, 15058402726661910231u, 198631691420u }, { 8759933935842067041u, 9600134495208339559u, 156816317647u }, { 3753418510388703513u, 14626343323989004842u, 207520424333u }, { 2961383332545305985u, 6813981265331086665u, 141792895660u }, { 2497674184068629507u, 10281745288790487888u, 172369386664u }, { 15244544070742305452u, 17569829347075761940u, 168557374528u }, { 45953573565810823u, 7654580675237889478u, 64952462357u }, { 3960077421351906445u, 16194838649686212364u, 21414955649u }, { 3173330011013883118u, 6495102772252453635u, 129877923962u }, { 11026266219545759160u, 14935159852819761348u, 122352100226u }, { 8886757764964685632u, 17381879863441579697u, 130809636637u }, { 13952322129918090479u, 9062335510435372583u, 29942273595u }, { 4127250666614902202u, 7569219009130126626u, 59491270192u }, { 17649958504065306911u, 12652124168176193362u, 48410328184u }, { 13269305359002216873u, 8940200224697247767u, 120685873025u }, { 16236593433831947843u, 5600570701927432884u, 129484649225u }, { 13580930396682424057u, 2018432801986093157u, 9303607546u }, { 421976357197961116u, 8235849749361824736u, 250109419461u }, { 2962130818798626533u, 9705097287982370040u, 197446466309u }, { 8234383947306356345u, 3517483139049842585u, 5526114378u }, { 4380469931801381425u, 958281614186777760u, 74190683143u }, { 15279887469027055916u, 7336473432636108950u, 7051948550u }, { 8534542821713755552u, 12955383920176764423u, 6397711021u }, { 7814613482565088782u, 10735469126281273789u, 173702312769u }, { 13771954404705323224u, 8637888232514730693u, 65581970947u }, { 4568173274762548144u, 6806336737533581000u, 3468260859u }, { 8105292616250821343u, 16142569672872330321u, 251368972253u }, { 2923678426777275612u, 8141285259947963513u, 221875090455u }, { 1808633176918384049u, 5220241098754220797u, 23441339958u }, { 18118642609460438969u, 154438799943119608u, 54282989837u }, { 18138164175864360870u, 2226876628677628879u, 13008372144u }, { 4031433690465792404u, 17219557081221357482u, 176120719223u }, { 5012226396942308537u, 15401507148161015114u, 119933474059u }, { 7889712298793536835u, 8842629766613985337u, 11834917375u }, { 13500762396543628804u, 3180100571546071440u, 255479359920u }, { 501020624068841347u, 7740848704392475044u, 176172393597u }, { 8370653768288261750u, 2014314126623495998u, 125419632249u }, { 647579990023635200u, 11209566016506885858u, 121109196187u }, { 11106569307181154304u, 7117166613733441125u, 155607671791u }, { 10797461613892861952u, 4197646860931880328u, 239385822375u }, { 17627230675448889344u, 5487263271238026094u, 167227554892u }, { 12197735707942322176u, 18148076225293562697u, 76297465137u }, { 12871287735024877568u, 9127276943027950849u, 49983809183u }, { 4611686018427387904u, 9691696125379324722u, 159494790674u }, { 0u, 13102362262487705216u, 18525387899u }, { 0u, 8929385439893192704u, 123710280481u }, { 0u, 11891353410743566336u, 33484062954u }, { 0u, 1587423090877399040u, 234644631560u }, { 0u, 3489137423026225152u, 8086054378u }, { 0u, 13046928120492326912u, 234189146518u }, { 0u, 11529215046068469760u, 150707275390u }, { 0u, 0u, 126625000000u }, { 0u, 0u, 64000000000u }, { 9451803574512021605u, 1721567u, 0u }, { 8662766454758138424u, 1721567512383298u, 0u }, { 9207992007314947035u, 6674960280855494694u, 93326u }, { 17118602861291201802u, 16378845781483497510u, 142361850321u }, { 11186560605745599967u, 17606907750956804392u, 209887899008u }, { 10505549821532796847u, 13225609159240506969u, 128954472381u }, { 18133667530488679216u, 2668084873338435252u, 189716961709u }, { 10778135771244330799u, 14802814305275861366u, 173144637170u }, { 17087985777033767391u, 8005510553372365574u, 242802462171u }, { 2639185991757283040u, 12748500143273514429u, 219433979596u }, { 5401720287293896400u, 10393733905569036127u, 204691097577u }, { 9816495392633895233u, 603389089974790339u, 233563445444u }, { 10042051500090034990u, 2033494532597735873u, 196032709788u }, { 11629689537856384738u, 9204796763694620958u, 156110235959u }, { 2099086731766010483u, 7826260310402107021u, 55498993032u }, { 13665537898516458594u, 10122690201685169383u, 136424262421u }, { 16375672064669490764u, 7438455564568110133u, 21548752135u }, { 7770550512184564348u, 2805412574380520817u, 7403239484u }, { 6197048880720627314u, 7250965427231182867u, 60152081720u }, { 17963594118523106281u, 8136242944826085924u, 56393075623u }, { 8255454642407818663u, 15357191647956011780u, 167441066613u }, { 16744201957549498409u, 7369614426695395460u, 117832515027u }, { 17442505417202859722u, 10886957545142526638u, 211399507598u }, { 6383975767786687150u, 2030047207417538097u, 142590183151u }, { 15245442964998335795u, 11557093828502314355u, 239110049079u }, { 2910016124519524433u, 15201062539664128543u, 55626511311u }, { 3847913871169988463u, 8846936323343880674u, 207824051251u }, { 17210451512590059177u, 1485291750116245364u, 51479593379u }, { 17899408909991454145u, 2076024439668322013u, 163080517827u }, { 5920601932753251608u, 7029497773682748741u, 195112541510u }, { 16521781895108979744u, 16333533921668749881u, 70381069837u }, { 3697493405554698771u, 2065057316131928423u, 13885442648u }, { 2816108280295732065u, 7800502648925570223u, 88111946981u }, { 14251078772056398988u, 17011619967093802015u, 229422866095u }, { 4543066550096031417u, 5368819344429198672u, 175922201766u }, { 3099369389734296977u, 15598879366754275267u, 166291044279u }, { 5243484113636490986u, 16393893486035835647u, 183845616944u }, { 6823370511605197226u, 12042046205096920307u, 48888714746u }, { 11396290277624641942u, 15437070428008474344u, 250652800632u }, { 15934361408437566099u, 13704569163204647509u, 120836845264u }, { 14939272230935131954u, 18192483750856993350u, 208742926182u }, { 7500666177940329347u, 5152535865317963250u, 102986216520u }, { 4806714453065462270u, 17512614083933854680u, 72279319528u }, { 11557851247268441487u, 14481918350603613536u, 232949360711u }, { 10655523157206817381u, 16124419709964004915u, 71785066366u }, { 14769600176490881210u, 18088011566435813579u, 126874106543u }, { 16688495540925795167u, 15008862380698848893u, 175980553071u }, { 909793965395524173u, 18160498644611827812u, 111813632059u }, { 12724590949761703756u, 3604680497457231965u, 59984482604u }, { 10810739657314826395u, 5957615565551495921u, 44195410121u }, { 2431218615388671301u, 17528455034961565995u, 201322962986u }, { 4235001167959059286u, 8503772325120113809u, 42950219451u }, { 6253317787396334247u, 8501492578048509537u, 187460990421u }, { 9534525563070371898u, 2296237701094386060u, 213460866836u }, { 8392783992374030728u, 3753593040591076946u, 20124479295u }, { 16356257019231647540u, 8518075399775653155u, 63203482686u }, { 12896334001521091877u, 12757855675959554597u, 62461765792u }, { 1427636373320877084u, 121631169379748595u, 160691604742u }, { 16116755731295043521u, 16679062494579173314u, 6006593638u }, { 15945633911163986837u, 10739912744743898054u, 102904173789u }, { 7510154241072743838u, 9367340677776287570u, 221582211836u }, { 3571560509790395119u, 12227321512794715397u, 252507804555u }, { 3576991649007035076u, 7241061891859170651u, 139662844427u }, { 15509961892750732443u, 13148571323079237489u, 11392538751u }, { 17789791359353349378u, 12509763434355012654u, 127712785479u }, { 18331227331079738314u, 11812768946960181977u, 71678155634u }, { 15386712883100476416u, 14170358803552564832u, 114640371487u }, { 14082462055028752384u, 18179989524780635952u, 31768176689u }, { 12919043128765186048u, 17091718978514754901u, 49985539206u }, { 6125373368465096704u, 7394768384359232459u, 134926543942u }, { 12335992698065387520u, 6778628272692852803u, 70400871197u }, { 2774217370460225536u, 18193335045875234320u, 29367470174u }, { 0u, 1378519212560967521u, 94986262669u }, { 0u, 4677732610631043584u, 141074729676u }, { 0u, 17296098591070486528u, 204253580392u }, { 0u, 7343735382392963072u, 104937623383u }, { 0u, 14525996728454217728u, 87398104692u }, { 0u, 9691359370008330240u, 116787455860u }, { 0u, 3044433348102455296u, 116525369644u }, { 0u, 9223372036854775808u, 44165039062u }, { 0u, 0u, 214500000000u }, { 4962829537462579598u, 26u, 0u }, { 5711259460785241095u, 26269035528u, 0u }, { 13845894607204897444u, 7822291454600056379u, 1u }, { 12116633056637003327u, 8201586317771250746u, 1424047269u }, { 2965791047992089560u, 3278889188817135834u, 165444608885u }, { 16021997451315962529u, 1710725240251040430u, 117177748939u }, { 3942052271663803856u, 1850175733663425006u, 203092738601u }, { 15669876414782439922u, 9147599666163914249u, 41100298227u }, { 10594415915406145286u, 10221885933644344166u, 243495892371u }, { 10789820553031921377u, 14901479793736678101u, 147554129546u }, { 3989990218583987244u, 5181831442059703136u, 138807810838u }, { 2937341169808224563u, 6396246577759793483u, 22280907645u }, { 16267436558584536843u, 14167229556464870447u, 125346741221u }, { 16221580362814625793u, 2969982933326311854u, 229768007053u }, { 9695437602320209830u, 7892677766222018881u, 141161003097u }, { 10729753156793715126u, 798698968922663621u, 89427862919u }, { 2609241432056861929u, 15926812109043458972u, 135043297557u }, { 8462663743997037565u, 8663842590352697437u, 21863394214u }, { 14993422143908194069u, 17093523026636671168u, 166469667847u }, { 1307443894537745373u, 839764004742743203u, 7926641740u }, { 10017257439419829265u, 16894643909298232323u, 76045523697u }, { 16754772009970777891u, 9066702926218949317u, 241915860481u }, { 11722573031602862387u, 9119392417260546810u, 1491506950u }, { 7363764277467092384u, 9723021096578315109u, 6494363253u }, { 6733958494847390772u, 14787464248751217597u, 117527086029u }, { 8799796600227451045u, 3733434565920249133u, 205801630043u }, { 10512023194742249826u, 6643788868836820841u, 91202389893u }, { 4572542132337197059u, 4729646697422664063u, 133360160516u }, { 12600500455757416832u, 4090144564201555829u, 4256394661u }, { 7873789864743195199u, 2109480737093400002u, 165221727181u }, { 15724851676325671539u, 16577155033369419739u, 205114355179u }, { 8748017220462413167u, 745377248603805917u, 235898649375u }, { 14172589522760466448u, 11305561465807999667u, 31040406981u }, { 9520545591489413768u, 2211245518782892177u, 197612875715u }, { 12488551088392570222u, 14170095199249735666u, 195119871859u }, { 1135798823651241684u, 17849973668116118927u, 115768162399u }, { 11168725610120161972u, 9020960204585720001u, 95967649011u }, { 9580104948718508826u, 10807134002871850916u, 243489027232u }, { 16638722716909738765u, 3925122626254791201u, 160585855908u }, { 15732724012348272797u, 17208463291312718997u, 164212781323u }, { 12269722190021214142u, 5145077219589447653u, 11932872664u }, { 13110655916311972587u, 17602397765035489468u, 216278915194u }, { 6618112997062866867u, 16422643262490753377u, 122954227894u }, { 8457936459015989309u, 2902509461400906224u, 182890273275u }, { 3329167139937134914u, 3422418805967265206u, 251157345353u }, { 5245511557216705097u, 4228874576277237392u, 73185529695u }, { 5655931353280440466u, 2553488530807495751u, 95229247750u }, { 604622132328697393u, 11546099176912486413u, 6138424890u }, { 8673282619234652338u, 10460791037534167991u, 58625915290u }, { 16929477433058445690u, 8127117908566000904u, 154567080618u }, { 11036952409253549455u, 11541304458088287306u, 170440571944u }, { 18199392190170386320u, 6249718665174839700u, 40625655368u }, { 9683116091880335715u, 13102508413386290995u, 72338797927u }, { 2993913337608915120u, 6274675218640661911u, 103710288404u }, { 4490779842162392585u, 3404497118599817167u, 20340150825u }, { 946849923353644618u, 11258566093988562335u, 41184558158u }, { 3613491058474899828u, 16762592482501635397u, 78610328090u }, { 14624054199004410935u, 5550125446725071998u, 26908701959u }, { 12088470271991908244u, 6370033225258510318u, 7300872903u }, { 10071980927725011290u, 1503521728674735398u, 199345320193u }, { 2833441711428854664u, 4250415082606384364u, 1081506076u }, { 17655572411864340446u, 6020091901030562974u, 28230415463u }, { 4997642792058747802u, 16288222967151527138u, 103326349835u }, { 11489200787635734848u, 6377016228656203782u, 11882986336u }, { 12983586226429536913u, 8378856515587563750u, 96345698742u }, { 12311150768725063152u, 15812881490200838483u, 182454218721u }, { 8530052476845967905u, 4548570371183413652u, 225857218023u }, { 6282736361499820264u, 16731431495283420383u, 231246578493u }, { 11337164765929082880u, 14737727629551135532u, 61907012718u }, { 8343856200414134272u, 12413722258104293893u, 110798933815u }, { 17889330377156198400u, 800899742400762438u, 55672949232u }, { 17730714064155312128u, 603197008376033550u, 240043416862u }, { 7449235258647511040u, 6380777281587743935u, 30032699375u }, { 9943947977234055168u, 10001440249018225388u, 239345902629u }, { 0u, 5505914461980436708u, 37542179162u }, { 0u, 1105464290051876864u, 90298476221u }, { 0u, 4500443576769970176u, 189059927339u }, { 0u, 2843045143185981440u, 43243969535u }, { 0u, 660949699682893824u, 255154121786u }, { 0u, 276549164618219520u, 58035830155u }, { 0u, 4683743612465315840u, 139014991760u }, { 0u, 0u, 144253906250u }, { 0u, 0u, 74000000000u }, { 12396245121240683569u, 400833u, 0u }, { 10248996648596888561u, 400833672001794u, 0u }, { 11257495103713935002u, 4370024159708535157u, 21729u }, { 7555396579247433114u, 7166684413908503888u, 225236899484u }, { 4805022328730367462u, 10217286283215687029u, 156388506740u }, { 7056637817080232586u, 4767369911989629198u, 116553880199u }, { 10811411483818434913u, 14407999214182082862u, 135258439640u }, { 16962406704495245447u, 8472271297615317358u, 216781059202u }, { 18074517319117194669u, 6236024012584764757u, 130459282747u }, { 3702019776117654523u, 1951826556984620523u, 59338055539u }, { 3551977551381082764u, 12357130551551830830u, 115105808729u }, { 16442608985936005282u, 8927758011099278464u, 89669881389u }, { 3580046275479139588u, 10199854049407140323u, 45483974731u }, { 8737412692712715330u, 17895455027038549577u, 75552935195u }, { 3082033243045084752u, 16539200343720527131u, 27970114560u }, { 16401023756841128699u, 3536976106235802604u, 896591847u }, { 7520296082779572869u, 16980391644793590751u, 231191739858u }, { 9854104766152464159u, 10090294316609084067u, 210920508875u }, { 14169188802648310188u, 17603457857266236889u, 203546995950u }, { 2018609909210367042u, 11164962743035868272u, 238954285362u }, { 8270271948267674359u, 1585686890718568774u, 50605253843u }, { 12320338602894572099u, 10882524700472655412u, 211085960258u }, { 17538536685990080547u, 2194808754940947757u, 66589942846u }, { 15833914616956760474u, 274100791137209242u, 62118980821u }, { 6137696141415969855u, 12203404582981010903u, 213014859033u }, { 9757490468419438919u, 541940706340938166u, 25661547888u }, { 3566639201356598903u, 10305434016011833594u, 112029378664u }, { 9760900035773954449u, 7900783531944543546u, 104558658697u }, { 3873778773990716438u, 8920818625012419323u, 137428302333u }, { 2295668377270167832u, 12532363335400447632u, 253483598546u }, { 1791721710912807593u, 13483507182924762800u, 210679380777u }, { 10571009006922683279u, 415911049779278804u, 41730942389u }, { 9840791932778184867u, 3441628281170127418u, 181022546583u }, { 11525464956561274613u, 17830811568183566527u, 151186571042u }, { 4435781488897895433u, 17897295813176613411u, 34966610231u }, { 6395563367070996741u, 2086148701331574596u, 55970214350u }, { 15538690795135662932u, 13015567826878853432u, 206113090347u }, { 16294558813563371936u, 12944531121587846595u, 43705575345u }, { 4942096228426070342u, 3534180912913737995u, 177701724438u }, { 6910116424372647153u, 3447584022400118677u, 22191588331u }, { 17923400669760829478u, 6375676813770849297u, 235186893904u }, { 4134686917293039955u, 11580694081479200185u, 80345626132u }, { 16857102463116098681u, 1872134358882196482u, 20627790684u }, { 11364321508775167451u, 17602652840520938059u, 92101488606u }, { 7966947780972783899u, 10331040597716338351u, 222954241722u }, { 11261055695926686278u, 73785407041056976u, 186560046833u }, { 9227040437353594058u, 17166209109167902028u, 241003999914u }, { 7185344074282882061u, 8762475644006589904u, 170930582060u }, { 14197856148610578032u, 8839001228645872586u, 44475014756u }, { 885688687260429427u, 13558262784529110268u, 100479163216u }, { 17407816160380305183u, 5640853896420358111u, 80734994898u }, { 17812728703806357349u, 8459930353450835572u, 210305791302u }, { 17120198191964319867u, 7643830211500171269u, 70458613743u }, { 12091952048375408786u, 1308629115231236347u, 239414372866u }, { 405056939269888281u, 8957268500971669618u, 2070940926u }, { 12485440679452408690u, 7645679094277669412u, 254485574498u }, { 8394369900823444407u, 3821107497040617191u, 98414473094u }, { 2877421667354294258u, 8847137191985934072u, 134207142652u }, { 2676980714750756239u, 3531126524756088253u, 252479604268u }, { 6119309228579057021u, 8726915034124352183u, 44191422752u }, { 18203256146533333852u, 17611136727168068641u, 32473087011u }, { 351919978865493747u, 18017743272784259949u, 35954701634u }, { 5190010931882390570u, 18113575006829616116u, 66976743819u }, { 6982466386088036604u, 12805550441678740368u, 139981938868u }, { 4707293888784996898u, 8061966093393027781u, 180694190280u }, { 690306801165964760u, 11954593141554100801u, 200437040057u }, { 12456770961278956704u, 14068656112359197734u, 185648059792u }, { 16946092489294063943u, 895878255770467290u, 144762663376u }, { 11098404173866185376u, 10319906489512197802u, 208048565657u }, { 15152070965853306880u, 14551142616794302079u, 153559443251u }, { 17370091362040414208u, 15933181735739307476u, 51788819021u }, { 10141938552171134976u, 11524527334398983147u, 77863739512u }, { 10586988556645826560u, 11828012606225556742u, 120624745878u }, { 12169852093061922816u, 3556238869349799431u, 150641197848u }, { 16717361816799281152u, 7403090230513381483u, 24192784095u }, { 0u, 10172292854665622800u, 223401322325u }, { 0u, 11240746576366182400u, 85551441100u }, { 0u, 17021927826892259328u, 204609362092u }, { 0u, 9046328496309141504u, 172922760556u }, { 0u, 8038996803112140800u, 108490402450u }, { 0u, 17098478935265509376u, 146435794889u }, { 0u, 7205759403792793600u, 201926910400u }, { 0u, 0u, 192390625000u }, { 0u, 0u, 232000000000u }, { 2144184049294538808u, 6u, 0u }, { 4108002197393276873u, 6116236450u, 0u }, { 6446230217393892753u, 6116236450222695245u, 0u }, { 5571068025259989822u, 6240972538554414168u, 331561842u }, { 14804812668872528331u, 4356262642990299018u, 114338323799u }, { 17369928488562523047u, 1335108558830511366u, 87236153471u }, { 2967474173531035027u, 18435704923261947246u, 127072376379u }, { 5291425437992807716u, 8395401931972636441u, 59999401566u }, { 14219547193739388064u, 12482665946362458347u, 94455115650u }, { 17720313647158217462u, 16101242875289374781u, 130676686676u }, { 12334850628290578491u, 4708983440241068127u, 84872850125u }, { 7818499847417334620u, 14856666972541426744u, 205255274503u }, { 136007040922198372u, 6938795288315789246u, 7805381530u }, { 8523477092112604449u, 5556307628265073820u, 154376152846u }, { 367934822655966629u, 1441404248927865979u, 14301208040u }, { 12964987687054730050u, 16710378912353838906u, 232078138680u }, { 15267036012420885462u, 18289940136919312110u, 56905871455u }, { 11142900264750765568u, 10217414145292657824u, 95991499641u }, { 13680181547777718603u, 12461165826430955753u, 121553887130u }, { 13001922925761426065u, 662762458988270879u, 154675521153u }, { 2397730045956515935u, 16488546856395302470u, 129035928424u }, { 4482395522588406288u, 2612816787977180950u, 104893845916u }, { 3255525722490493080u, 16446616379327454252u, 156141641081u }, { 836222287193822098u, 7842178508581740643u, 121891572860u }, { 420898743993182306u, 14779029861369369333u, 124425125348u }, { 11652649973356574054u, 2697664446153849542u, 228801172814u }, { 15058402726661910231u, 12135106444393649308u, 78146240682u }, { 9600134495208339559u, 9550285041205189839u, 170657845438u }, { 14626343323989004842u, 8790318168586740109u, 190517721989u }, { 6813981265331086665u, 14038474217155846828u, 133476524102u }, { 10281745288790487888u, 4263144264274812072u, 70761027212u }, { 17569829347075761940u, 11940456333341715520u, 140231105513u }, { 7654580675237889478u, 15751110736831573013u, 233647293434u }, { 16194838649686212364u, 18384528705472318081u, 250853869423u }, { 6495102772252453635u, 2393654818032310394u, 111996627298u }, { 14935159852819761348u, 12812209822018626434u, 98129760287u }, { 17381879863441579697u, 3110778569433458461u, 31694551286u }, { 9062335510435372583u, 2860264756226872891u, 246168635644u }, { 7569219009130126626u, 2384146980060315184u, 252155055263u }, { 12652124168176193362u, 14117430062880324728u, 159129244866u }, { 8940200224697247767u, 3769610173216737153u, 194765307417u }, { 5600570701927432884u, 17731974340232672009u, 25204350976u }, { 2018432801986093157u, 1971479303384713466u, 961252255u }, { 8235849749361824736u, 3449462959779012549u, 159106874107u }, { 9705097287982370040u, 13743454852043766533u, 251186995761u }, { 3517483139049842585u, 7417711187131879498u, 49745034180u }, { 958281614186777760u, 3650992383501007879u, 196402114929u }, { 7336473432636108950u, 12838770342493958662u, 113197920693u }, { 12955383920176764423u, 16025068246546338477u, 181695991134u }, { 10735469126281273789u, 6579965938260177729u, 94868720690u }, { 8637888232514730693u, 4742939430174291459u, 50356700668u }, { 6806336737533581000u, 13062256857527449083u, 252257115261u }, { 16142569672872330321u, 2301174570202439645u, 125708106363u }, { 8141285259947963513u, 7638687886069412887u, 123124746923u }, { 5220241098754220797u, 936322449610274358u, 171414094100u }, { 154438799943119608u, 12926010544311283981u, 20050758141u }, { 2226876628677628879u, 12647854908989899184u, 253700720435u }, { 17219557081221357482u, 8862093163358513015u, 51685641588u }, { 15401507148161015114u, 444784343917630731u, 116480415033u }, { 8842629766613985337u, 11033952249213387263u, 57024111807u }, { 3180100571546071440u, 18168634046363183536u, 191598151749u }, { 7740848704392475044u, 3837904761417065597u, 69984923625u }, { 2014314126623495998u, 111459007020906105u, 233208053234u }, { 11209566016506885858u, 16191761957496794523u, 242006042204u }, { 7117166613733441125u, 9856250800340378607u, 92877757174u }, { 4197646860931880328u, 9491800102275105959u, 246534308426u }, { 5487263271238026094u, 10777328578953608268u, 74514551514u }, { 18148076225293562697u, 17424440628313779505u, 218584240152u }, { 9127276943027950849u, 3285814872419755679u, 24944580819u }, { 9691696125379324722u, 2824823424107240978u, 211178124381u }, { 13102362262487705216u, 12271707680713669755u, 93153133984u }, { 8929385439893192704u, 6951481875178001185u, 160665250606u }, { 11891353410743566336u, 10202522487003824362u, 46376840587u }, { 1587423090877399040u, 4834668463880990728u, 139553079852u }, { 3489137423026225152u, 10871520987687904746u, 44262087902u }, { 13046928120492326912u, 12057698794225322390u, 222589346333u }, { 11529215046068469760u, 7263351819222681214u, 29653649161u }, { 0u, 1778055686910650944u, 9393747091u }, { 0u, 17108187120491986944u, 147096388591u }, { 0u, 3067636961549221888u, 239927436682u }, { 0u, 16702141595163557888u, 138166296932u }, { 0u, 2432053749942845440u, 100905424910u }, { 0u, 17791470327927144448u, 14131841897u }, { 0u, 1152921504606846976u, 105964477539u }, { 0u, 0u, 99062500000u }, { 0u, 0u, 160000000000u }, { 6674960280855494694u, 93326u, 0u }, { 16378845781483497510u, 93326361850321u, 0u }, { 17606907750956804392u, 4283581425266273664u, 5059u }, { 13225609159240506969u, 6725911039793895357u, 195232213414u }, { 2668084873338435252u, 1188689198788975021u, 166364612368u }, { 14802814305275861366u, 10825527435847761650u, 16064438970u }, { 8005510553372365574u, 3917696829526085083u, 186586853018u }, { 12748500143273514429u, 12646861173976387276u, 154212378770u }, { 10393733905569036127u, 18398576063183996905u, 146685587717u }, { 603389089974790339u, 16919251228485834948u, 5997388806u }, { 2033494532597735873u, 17296019588687185052u, 6917194446u }, { 9204796763694620958u, 12365301604512770359u, 206937619100u }, { 7826260310402107021u, 2814271599679204744u, 156670324343u }, { 10122690201685169383u, 2154994415780170517u, 119152561969u }, { 7438455564568110133u, 6717373824370072839u, 49116822481u }, { 2805412574380520817u, 12709155755801344060u, 209364149564u }, { 7250965427231182867u, 826847911966403896u, 60688964714u }, { 8136242944826085924u, 2277322703890025383u, 106044823515u }, { 15357191647956011780u, 2774508958389496437u, 219123453911u }, { 7369614426695395460u, 245697774950120915u, 215150406432u }, { 10886957545142526638u, 1268929063431863950u, 32013319303u }, { 2030047207417538097u, 6735665673159411439u, 135068788782u }, { 11557093828502314355u, 14734771742997073207u, 46365141167u }, { 15201062539664128543u, 13683287077957612495u, 175798773576u }, { 8846936323343880674u, 15370263741354826803u, 72741772478u }, { 1485291750116245364u, 48035913070297507u, 190833223667u }, { 2076024439668322013u, 1206547475966802115u, 243002604032u }, { 7029497773682748741u, 13512340386605768006u, 65407069u }, { 16333533921668749881u, 2325760467700278797u, 93732505440u }, { 2065057316131928423u, 10848110652847753816u, 96126079727u }, { 7800502648925570223u, 15846378960784301285u, 239588077256u }, { 17011619967093802015u, 14121839924449844911u, 200859033924u }, { 5368819344429198672u, 5147613424753296550u, 68765546476u }, { 15598879366754275267u, 16817040482828810167u, 236279052682u }, { 16393893486035835647u, 5773528746119363888u, 138911653591u }, { 12042046205096920307u, 8716201595536184826u, 215312983620u }, { 15437070428008474344u, 5259122109038474872u, 68472506235u }, { 13704569163204647509u, 14744540084230155984u, 123285097580u }, { 18192483750856993350u, 10719345477982635878u, 108799303119u }, { 5152535865317963250u, 13698037261310555208u, 207581096882u }, { 17512614083933854680u, 16141171632951976936u, 178742572087u }, { 14481918350603613536u, 10060790174955808839u, 55875014667u }, { 16124419709964004915u, 4250043307981877118u, 11545396528u }, { 18088011566435813579u, 7075646198054337199u, 48230395309u }, { 15008862380698848893u, 18141738384245531503u, 173383571548u }, { 18160498644611827812u, 8174370508376809531u, 92983465608u }, { 3604680497457231965u, 3581964982731575596u, 136443133513u }, { 5957615565551495921u, 14798509948722114761u, 73194178710u }, { 17528455034961565995u, 14713923334885122090u, 150802228831u }, { 8503772325120113809u, 5042978054260414139u, 95797643382u }, { 8501492578048509537u, 2052996319372883413u, 118273380388u }, { 2296237701094386060u, 8825683007899981588u, 36111293153u }, { 3753593040591076946u, 9992196755378745151u, 225478441234u }, { 8518075399775653155u, 9301073417573669950u, 18541678071u }, { 12757855675959554597u, 5331614769144850592u, 247504212200u }, { 121631169379748595u, 14354009428310052102u, 232289027415u }, { 16679062494579173314u, 5581221063029119078u, 87778132410u }, { 10739912744743898054u, 1529260335339476189u, 186302558600u }, { 9367340677776287570u, 16483061525949201148u, 136082901368u }, { 12227321512794715397u, 14431217812333089675u, 120893548555u }, { 7241061891859170651u, 3452349151135392267u, 11782317885u }, { 13148571323079237489u, 9075317899834447999u, 61187152222u }, { 12509763434355012654u, 2764331337978901575u, 94491973969u }, { 11812768946960181977u, 1942890683708857202u, 81149854702u }, { 14170358803552564832u, 165089169728028447u, 238105324315u }, { 18179989524780635952u, 15193620741871233073u, 27008949501u }, { 17091718978514754901u, 14995000835194145926u, 253823647830u }, { 7394768384359232459u, 1788823614552255558u, 86812880624u }, { 6778628272692852803u, 8384901184618498845u, 240096972322u }, { 18193335045875234320u, 405511217862281310u, 34454546404u }, { 1378519212560967521u, 3111530463755196557u, 228021982807u }, { 4677732610631043584u, 7893558450035460812u, 87168676404u }, { 17296098591070486528u, 156573858237402216u, 52427910661u }, { 7343735382392963072u, 15915324019419451223u, 5008487885u }, { 14525996728454217728u, 16293363012778802804u, 205862771443u }, { 9691359370008330240u, 14342105318291351412u, 243883264978u }, { 3044433348102455296u, 3788398842525387052u, 210777487087u }, { 9223372036854775808u, 14118764407048307670u, 239205369512u }, { 0u, 2705021334614720768u, 168765379752u }, { 0u, 7017988973805568000u, 168146639500u }, { 0u, 10956732053634154496u, 140380445944u }, { 0u, 14657517938546835456u, 248593965634u }, { 0u, 11268868284797157376u, 66794585639u }, { 0u, 14600669991935148032u, 39610886573u }, { 0u, 4611686018427387904u, 173791503906u }, { 0u, 0u, 34250000000u }, { 0u, 0u, 128000000000u }, { 8201586317771250746u, 1424047269u, 0u }, { 3278889188817135834u, 1424047269444608885u, 0u }, { 1710725240251040430u, 3001188830946823627u, 77197757u }, { 1850175733663425006u, 9732296932705387049u, 189162694772u }, { 9147599666163914249u, 16337535782679529459u, 116527588873u }, { 10221885933644344166u, 7969742269895046547u, 9885659589u }, { 14901479793736678101u, 2923592083903829642u, 197432040594u }, { 5181831442059703136u, 8144196241160608534u, 146158488244u }, { 6396246577759793483u, 16431078457793424253u, 180441497762u }, { 14167229556464870447u, 202362949592775653u, 162890730548u }, { 2969982933326311854u, 8835125248522947981u, 52010970117u }, { 7892677766222018881u, 7959873808777345113u, 5478953099u }, { 798698968922663621u, 14929747122315126151u, 139431505623u }, { 15926812109043458972u, 4310328817360515349u, 215809343213u }, { 8663842590352697437u, 7294899422760201126u, 237233663393u }, { 17093523026636671168u, 2047461597291187207u, 161395457290u }, { 839764004742743203u, 10942374468813517900u, 10110993115u }, { 16894643909298232323u, 10364795403063433969u, 219593187308u }, { 9066702926218949317u, 12330859528790939137u, 236561876684u }, { 9119392417260546810u, 8973160144879916806u, 204668457234u }, { 9723021096578315109u, 2895354388547509877u, 18486435986u }, { 14787464248751217597u, 16766844772497556429u, 146156957475u }, { 3733434565920249133u, 7442407174620948827u, 35908932476u }, { 6643788868836820841u, 6683013428676659077u, 124403453701u }, { 4729646697422664063u, 16713703375071907588u, 5362286883u }, { 4090144564201555829u, 8791044883080637861u, 35906051675u }, { 2109480737093400002u, 602844107089214413u, 91476563498u }, { 16577155033369419739u, 9754832281172880875u, 42032680244u }, { 745377248603805917u, 10587846778003503903u, 52528810517u }, { 11305561465807999667u, 17206244172922947013u, 21573968323u }, { 2211245518782892177u, 11620628420699303875u, 195932752365u }, { 14170095199249735666u, 17864732368219338611u, 237629955528u }, { 17849973668116118927u, 4146383014621345887u, 200968449082u }, { 9020960204585720001u, 11445705075042688243u, 58224775873u }, { 10807134002871850916u, 7369147888966546592u, 193620472915u }, { 3925122626254791201u, 9762476865090597796u, 83399482307u }, { 17208463291312718997u, 5507001428194242827u, 195529224931u }, { 5145077219589447653u, 11371471148365328344u, 227298535145u }, { 17602397765035489468u, 3148788104946538618u, 233616448686u }, { 16422643262490753377u, 3762722308424507574u, 174170696145u }, { 2902509461400906224u, 1156171244825745915u, 209203977585u }, { 3422418805967265206u, 14208921674868257865u, 113062676168u }, { 4228874576277237392u, 7903080886897905503u, 200770267187u }, { 2553488530807495751u, 6367240794154270982u, 51428426873u }, { 11546099176912486413u, 1623672396662369850u, 121345168815u }, { 10460791037534167991u, 18323231215381674394u, 175088019456u }, { 8127117908566000904u, 9842279843006544554u, 993304354u }, { 11541304458088287306u, 7376839231308610600u, 34533551059u }, { 6249718665174839700u, 609751749293657672u, 211399899256u }, { 13102508413386290995u, 10386457966860989799u, 120033054708u }, { 6274675218640661911u, 11160336020836149780u, 244563051014u }, { 3404497118599817167u, 17947559933847409193u, 6605003027u }, { 11258566093988562335u, 10229787001712704590u, 19972939173u }, { 16762592482501635397u, 10441677090043619866u, 165554557864u }, { 5550125446725071998u, 4996681336392922375u, 168566044449u }, { 6370033225258510318u, 124497102381021895u, 33270870638u }, { 1503521728674735398u, 8180812057779384577u, 110006749001u }, { 4250415082606384364u, 5294232873532946716u, 73443482710u }, { 6020091901030562974u, 2885620189169448039u, 86287000939u }, { 16288222967151527138u, 16662526875008170507u, 107156429783u }, { 6377016228656203782u, 15663095032402672480u, 215903277391u }, { 8378856515587563750u, 1824281504410546614u, 79849098083u }, { 15812881490200838483u, 9506565509584809953u, 99098894498u }, { 4548570371183413652u, 16941136942345070055u, 162515351948u }, { 16731431495283420383u, 15924115693705937725u, 140918380873u }, { 14737727629551135532u, 9247807690406628462u, 73863248041u }, { 12413722258104293893u, 7993916633864834871u, 169501324659u }, { 800899742400762438u, 1018504409177639408u, 115433351089u }, { 603197008376033550u, 12097800686634130718u, 177055213234u }, { 6380777281587743935u, 6221488888422637551u, 178655823089u }, { 10001440249018225388u, 8229322865256080421u, 241337267588u }, { 5505914461980436708u, 7927745108183101786u, 132446112486u }, { 1105464290051876864u, 8488683721235326653u, 230429763923u }, { 4500443576769970176u, 11165516518170922283u, 83460172466u }, { 2843045143185981440u, 5463648141113596927u, 178605283863u }, { 660949699682893824u, 3958440403860778042u, 23296184959u }, { 276549164618219520u, 5091534813990256011u, 127214587484u }, { 4683743612465315840u, 6100166970623291280u, 92276012655u }, { 0u, 1913011027739012426u, 111330690714u }, { 0u, 11310957650604221440u, 154103704535u }, { 0u, 16303817257009020928u, 215613168242u }, { 0u, 9090406322154766336u, 114883831704u }, { 0u, 3003279315069566976u, 152492791914u }, { 0u, 16582887146675765248u, 106162808097u }, { 0u, 9691746398101307392u, 33898960113u }, { 0u, 0u, 241525390625u }, { 0u, 0u, 33000000000u }, }; #endif // RYU_D2FIXED_FULL_TABLE_H
0
repos/ryu
repos/ryu/ryu/ryu.h
// Copyright 2018 Ulf Adams // // The contents of this file may be used under the terms of the Apache License, // Version 2.0. // // (See accompanying file LICENSE-Apache or copy at // http://www.apache.org/licenses/LICENSE-2.0) // // Alternatively, the contents of this file may be used under the terms of // the Boost Software License, Version 1.0. // (See accompanying file LICENSE-Boost or copy at // https://www.boost.org/LICENSE_1_0.txt) // // Unless required by applicable law or agreed to in writing, this software // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. #ifndef RYU_H #define RYU_H #ifdef __cplusplus extern "C" { #endif #include <inttypes.h> int d2s_buffered_n(double f, char* result); void d2s_buffered(double f, char* result); char* d2s(double f); int f2s_buffered_n(float f, char* result); void f2s_buffered(float f, char* result); char* f2s(float f); int d2fixed_buffered_n(double d, uint32_t precision, char* result); void d2fixed_buffered(double d, uint32_t precision, char* result); char* d2fixed(double d, uint32_t precision); int d2exp_buffered_n(double d, uint32_t precision, char* result); void d2exp_buffered(double d, uint32_t precision, char* result); char* d2exp(double d, uint32_t precision); #ifdef __cplusplus } #endif #endif // RYU_H
0
repos/ryu/ryu
repos/ryu/ryu/benchmark/benchmark_fixed.c
// Copyright 2018 Ulf Adams // // The contents of this file may be used under the terms of the Apache License, // Version 2.0. // // (See accompanying file LICENSE-Apache or copy at // http://www.apache.org/licenses/LICENSE-2.0) // // Alternatively, the contents of this file may be used under the terms of // the Boost Software License, Version 1.0. // (See accompanying file LICENSE-Boost or copy at // https://www.boost.org/LICENSE_1_0.txt) // // Unless required by applicable law or agreed to in writing, this software // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. #if defined(__linux__) #define _GNU_SOURCE #endif #include <math.h> #include <stdbool.h> #include <inttypes.h> #include <time.h> #include <string.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #if defined(__linux__) #include <sys/types.h> #include <unistd.h> #include <sched.h> #endif #include "ryu/ryu.h" #include "third_party/mersenne/random.h" #define BUFFER_SIZE 2000 static double int64Bits2Double(uint64_t bits) { double f; memcpy(&f, &bits, sizeof(double)); return f; } struct mean_and_variance { int64_t n; double mean; double m2; }; typedef struct mean_and_variance mean_and_variance; void init(mean_and_variance* mv) { mv->n = 0; mv->mean = 0; mv->m2 = 0; } void update(mean_and_variance* mv, double x) { ++mv->n; double d = x - mv->mean; mv->mean += d / mv->n; double d2 = x - mv->mean; mv->m2 += d * d2; } double variance(mean_and_variance* mv) { return mv->m2 / (mv->n - 1); } double stddev(mean_and_variance* mv) { return sqrt(variance(mv)); } double generate_double(uint64_t* r) { *r = RandomU64(); double f = int64Bits2Double(*r); return f; } static int bench64_fixed(const uint32_t samples, const uint32_t iterations, const int32_t precision, const bool verbose) { char bufferown[BUFFER_SIZE]; char buffer[BUFFER_SIZE]; char fmt[100]; snprintf(fmt, 100, "%%.%df", precision); RandomInit(12345); mean_and_variance mv1; init(&mv1); mean_and_variance mv2; init(&mv2); int throwaway = 0; for (int i = 0; i < samples; ++i) { uint64_t r = 0; const double f = generate_double(&r); // printf("%f\n", f); clock_t t1 = clock(); for (int j = 0; j < iterations; ++j) { d2fixed_buffered(f, precision, bufferown); throwaway += bufferown[2]; } clock_t t2 = clock(); double delta1 = ((t2 - t1) * 1000000000.0) / ((double) iterations) / ((double) CLOCKS_PER_SEC); update(&mv1, delta1); double delta2 = 0.0; t1 = clock(); for (int j = 0; j < iterations; ++j) { snprintf(buffer, BUFFER_SIZE, fmt, f); throwaway += buffer[2]; } t2 = clock(); delta2 = ((t2 - t1) * 1000000000.0) / ((double) iterations) / ((double) CLOCKS_PER_SEC); update(&mv2, delta2); if (verbose) { printf("%s,%" PRIu64 ",%f,%f\n", bufferown, r, delta1, delta2); } // printf("For %16" PRIX64 " %28s %28s\n", r, bufferown, buffer); if (strcmp(bufferown, buffer) != 0) { printf("For %16" PRIX64 " %28s %28s\n", r, bufferown, buffer); } } if (!verbose) { printf("64: %8.3f %8.3f", mv1.mean, stddev(&mv1)); printf(" %8.3f %8.3f", mv2.mean, stddev(&mv2)); printf("\n"); } return throwaway; } static int bench64_exp(const uint32_t samples, const uint32_t iterations, const int32_t precision, const bool verbose) { char bufferown[BUFFER_SIZE]; char buffer[BUFFER_SIZE]; char fmt[100]; snprintf(fmt, 100, "%%.%de", precision); RandomInit(12345); mean_and_variance mv1; init(&mv1); mean_and_variance mv2; init(&mv2); int throwaway = 0; for (int i = 0; i < samples; ++i) { uint64_t r = 0; const double f = generate_double(&r); // printf("%.20e\n", f); // printf("For %16" PRIX64 "\n", r); clock_t t1 = clock(); for (int j = 0; j < iterations; ++j) { d2exp_buffered(f, precision, bufferown); throwaway += bufferown[2]; } clock_t t2 = clock(); double delta1 = (t2 - t1) / (double) iterations / CLOCKS_PER_SEC * 1000000000.0; update(&mv1, delta1); double delta2 = 0.0; t1 = clock(); for (int j = 0; j < iterations; ++j) { snprintf(buffer, BUFFER_SIZE, fmt, f); throwaway += buffer[2]; } t2 = clock(); delta2 = (t2 - t1) / (double) iterations / CLOCKS_PER_SEC * 1000000000.0; update(&mv2, delta2); if (verbose) { printf("%s,%" PRIu64 ",%f,%f\n", bufferown, r, delta1, delta2); } // printf("For %16" PRIX64 " %28s %28s\n", r, bufferown, buffer); if ((strcmp(bufferown, buffer) != 0) && !verbose) { printf("For %16" PRIX64 " %28s %28s\n", r, bufferown, buffer); } } if (!verbose) { printf("64: %8.3f %8.3f", mv1.mean, stddev(&mv1)); printf(" %8.3f %8.3f", mv2.mean, stddev(&mv2)); printf("\n"); } return throwaway; } int main(int argc, char** argv) { #if defined(__linux__) // Also disable hyperthreading with something like this: // cat /sys/devices/system/cpu/cpu*/topology/core_id // sudo /bin/bash -c "echo 0 > /sys/devices/system/cpu/cpu6/online" cpu_set_t my_set; CPU_ZERO(&my_set); CPU_SET(2, &my_set); sched_setaffinity(getpid(), sizeof(cpu_set_t), &my_set); #endif int32_t samples = 10000; int32_t iterations = 1000; int32_t precision = 6; bool verbose = false; bool fixed = true; for (int i = 1; i < argc; i++) { char* arg = argv[i]; if (strcmp(arg, "-v") == 0) { verbose = true; } else if (strncmp(arg, "-samples=", 9) == 0) { sscanf(arg, "-samples=%i", &samples); } else if (strncmp(arg, "-iterations=", 12) == 0) { sscanf(arg, "-iterations=%i", &iterations); } else if (strncmp(arg, "-precision=", 11) == 0) { sscanf(arg, "-precision=%i", &precision); } else if (strcmp(arg, "-exp") == 0) { fixed = false; } } if (false) { // double d = int64Bits2Double(0x426E5FDA4A181F94); // double d = int64Bits2Double(0xC27EF2838AD07A1A); double d = int64Bits2Double(0x426C19FD2EFA7294); printf("%.10f\n", 1043657281728.98681640625); printf("%.10f\n", -2126683614471.63134765625); printf("%.10f\n", 965560858579.58056640625); printf("%s\n", d2fixed(d, precision)); return 0; } if (!verbose) { // No need to buffer the output if we're just going to print three lines. setbuf(stdout, NULL); } if (verbose) { printf("ryu_output,float_bits_as_int,ryu_time_in_ns,snprintf_time_in_ns\n"); } else { printf(" Average & Stddev Ryu%s\n", " Average & Stddev snprintf"); } int throwaway = 0; if (fixed) { throwaway += bench64_fixed(samples, iterations, precision, verbose); } else { throwaway += bench64_exp(samples, iterations, precision, verbose); } if (argc == 1000) { // Prevent the compiler from optimizing the code away. printf("%d\n", throwaway); } return 0; }
0
repos/ryu
repos/ryu/scripts/double.template
set title "" set datafile separator "," set linetype 1 lc rgb '#396AB1' set linetype 2 lc rgb '#DA7C30' set linetype 3 lc rgb '#3E9651' set term pdf size 25cm, 15cm set key above left horizontal Left reverse samplen 0.1 set ylabel "Time in ns" set xrange [0:18446744073709551616.0] set xtics ("0" 0, "2^{62}" 4611686018427387904.0, "2^{63}" 9223372036854775808.0, "2^{63}+2^{62}" 13835058055282163712.0, "2^{64}" 18446744073709551616.0) plot "INPUT_FILE" using 2:3 with points ps 0.5 title "Ryū", \ "INPUT_FILE" using 2:4 with points ps 0.5 title "COMPARISON_NAME_1", \ "INPUT_FILE" using 2:5 with points ps 0.5 title "COMPARISON_NAME_2",
0
repos/ryu
repos/ryu/scripts/printf.template
set title "" set datafile separator "," set linetype 1 lc rgb '#396AB1' set linetype 2 lc rgb '#DA7C30' set linetype 3 lc rgb '#3E9651' set term pdf size 25cm, 15cm set key above left horizontal Left reverse samplen 0.1 set ylabel "Time in ns" set xrange [0:18446744073709551616.0] set xtics ("0" 0, "2^{62}" 4611686018427387904.0, "2^{63}" 9223372036854775808.0, "2^{63}+2^{62}" 13835058055282163712.0, "2^{64}" 18446744073709551616.0) plot "INPUT_FILE" using 2:3 with points ps 0.5 title "Ryū Printf", \ "INPUT_FILE" using 2:4 with points ps 0.5 title "COMPARISON_NAME_1"
0
repos/ryu
repos/ryu/scripts/float.template
set title "" set datafile separator "," set linetype 1 lc rgb '#396AB1' set linetype 2 lc rgb '#DA7C30' set linetype 3 lc rgb '#3E9651' set term pdf size 25cm, 15cm set key above left horizontal Left reverse samplen 0.1 set ylabel "Time in ns" set xrange [0:4294967296.0] set xtics ("0" 0, "2^{30}" 1073741824.0, "2^{31}" 2147483648.0, "2^{31}+2^{30}" 3221225472.0, "2^{32}" 4294967296.0) plot "INPUT_FILE" using 2:3 with points ps 0.5 title "Ryū", \ "INPUT_FILE" using 2:4 with points ps 0.5 title "COMPARISON_NAME_1", \ "INPUT_FILE" using 2:5 with points ps 0.5 title "COMPARISON_NAME_2",
0
repos/ryu/src/main/java/info/adams
repos/ryu/src/main/java/info/adams/ryu/RyuFloat.java
// Copyright 2018 Ulf Adams // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package info.adams.ryu; import java.math.BigInteger; /** * An implementation of Ryu for float. */ public final class RyuFloat { private static boolean DEBUG = false; private static final int FLOAT_MANTISSA_BITS = 23; private static final int FLOAT_MANTISSA_MASK = (1 << FLOAT_MANTISSA_BITS) - 1; private static final int FLOAT_EXPONENT_BITS = 8; private static final int FLOAT_EXPONENT_MASK = (1 << FLOAT_EXPONENT_BITS) - 1; private static final int FLOAT_EXPONENT_BIAS = (1 << (FLOAT_EXPONENT_BITS - 1)) - 1; private static final long LOG10_2_DENOMINATOR = 10000000L; private static final long LOG10_2_NUMERATOR = (long) (LOG10_2_DENOMINATOR * Math.log10(2)); private static final long LOG10_5_DENOMINATOR = 10000000L; private static final long LOG10_5_NUMERATOR = (long) (LOG10_5_DENOMINATOR * Math.log10(5)); private static final long LOG2_5_DENOMINATOR = 10000000L; private static final long LOG2_5_NUMERATOR = (long) (LOG2_5_DENOMINATOR * (Math.log(5)/Math.log(2))); private static final int POS_TABLE_SIZE = 47; private static final int INV_TABLE_SIZE = 31; // Only for debugging. private static final BigInteger[] POW5 = new BigInteger[POS_TABLE_SIZE]; private static final BigInteger[] POW5_INV = new BigInteger[INV_TABLE_SIZE]; private static final int POW5_BITCOUNT = 61; private static final int POW5_HALF_BITCOUNT = 31; private static final int[][] POW5_SPLIT = new int[POS_TABLE_SIZE][2]; private static final int POW5_INV_BITCOUNT = 59; private static final int POW5_INV_HALF_BITCOUNT = 31; private static final int[][] POW5_INV_SPLIT = new int[INV_TABLE_SIZE][2]; static { BigInteger mask = BigInteger.valueOf(1).shiftLeft(POW5_HALF_BITCOUNT).subtract(BigInteger.ONE); BigInteger maskInv = BigInteger.valueOf(1).shiftLeft(POW5_INV_HALF_BITCOUNT).subtract(BigInteger.ONE); for (int i = 0; i < Math.max(POW5.length, POW5_INV.length); i++) { BigInteger pow = BigInteger.valueOf(5).pow(i); int pow5len = pow.bitLength(); int expectedPow5Bits = pow5bits(i); if (expectedPow5Bits != pow5len) { throw new IllegalStateException(pow5len + " != " + expectedPow5Bits); } if (i < POW5.length) { POW5[i] = pow; } if (i < POW5_SPLIT.length) { POW5_SPLIT[i][0] = pow.shiftRight(pow5len - POW5_BITCOUNT + POW5_HALF_BITCOUNT).intValueExact(); POW5_SPLIT[i][1] = pow.shiftRight(pow5len - POW5_BITCOUNT).and(mask).intValueExact(); } if (i < POW5_INV.length) { int j = pow5len - 1 + POW5_INV_BITCOUNT; BigInteger inv = BigInteger.ONE.shiftLeft(j).divide(pow).add(BigInteger.ONE); POW5_INV[i] = inv; POW5_INV_SPLIT[i][0] = inv.shiftRight(POW5_INV_HALF_BITCOUNT).intValueExact(); POW5_INV_SPLIT[i][1] = inv.and(maskInv).intValueExact(); } } } public static void main(String[] args) { DEBUG = true; float f = 0.33007812f; String result = floatToString(f, RoundingMode.ROUND_EVEN); System.out.println(result + " " + f); } public static String floatToString(float value) { return floatToString(value, RoundingMode.ROUND_EVEN); } public static String floatToString(float value, RoundingMode roundingMode) { // Step 1: Decode the floating point number, and unify normalized and subnormal cases. // First, handle all the trivial cases. if (Float.isNaN(value)) return "NaN"; if (value == Float.POSITIVE_INFINITY) return "Infinity"; if (value == Float.NEGATIVE_INFINITY) return "-Infinity"; int bits = Float.floatToIntBits(value); if (bits == 0) return "0.0"; if (bits == 0x80000000) return "-0.0"; // Otherwise extract the mantissa and exponent bits and run the full algorithm. int ieeeExponent = (bits >> FLOAT_MANTISSA_BITS) & FLOAT_EXPONENT_MASK; int ieeeMantissa = bits & FLOAT_MANTISSA_MASK; // By default, the correct mantissa starts with a 1, except for denormal numbers. int e2; int m2; if (ieeeExponent == 0) { e2 = 1 - FLOAT_EXPONENT_BIAS - FLOAT_MANTISSA_BITS; m2 = ieeeMantissa; } else { e2 = ieeeExponent - FLOAT_EXPONENT_BIAS - FLOAT_MANTISSA_BITS; m2 = ieeeMantissa | (1 << FLOAT_MANTISSA_BITS); } boolean sign = bits < 0; if (DEBUG) { System.out.println("IN=" + Long.toBinaryString(bits)); System.out.println(" S=" + (sign ? "-" : "+") + " E=" + e2 + " M=" + m2); } // Step 2: Determine the interval of legal decimal representations. boolean even = (m2 & 1) == 0; int mv = 4 * m2; int mp = 4 * m2 + 2; int mm = 4 * m2 - ((m2 != (1L << FLOAT_MANTISSA_BITS)) || (ieeeExponent <= 1) ? 2 : 1); e2 -= 2; if (DEBUG) { String sv, sp, sm; int e10; if (e2 >= 0) { sv = BigInteger.valueOf(mv).shiftLeft(e2).toString(); sp = BigInteger.valueOf(mp).shiftLeft(e2).toString(); sm = BigInteger.valueOf(mm).shiftLeft(e2).toString(); e10 = 0; } else { BigInteger factor = BigInteger.valueOf(5).pow(-e2); sv = BigInteger.valueOf(mv).multiply(factor).toString(); sp = BigInteger.valueOf(mp).multiply(factor).toString(); sm = BigInteger.valueOf(mm).multiply(factor).toString(); e10 = e2; } e10 += sp.length() - 1; System.out.println("Exact values"); System.out.println(" m =" + mv); System.out.println(" E =" + e10); System.out.println(" d+=" + sp); System.out.println(" d =" + sv); System.out.println(" d-=" + sm); System.out.println(" e2=" + e2); } // Step 3: Convert to a decimal power base using 128-bit arithmetic. // -151 = 1 - 127 - 23 - 2 <= e_2 - 2 <= 254 - 127 - 23 - 2 = 102 int dp, dv, dm; int e10; boolean dpIsTrailingZeros, dvIsTrailingZeros, dmIsTrailingZeros; int lastRemovedDigit = 0; if (e2 >= 0) { // Compute m * 2^e_2 / 10^q = m * 2^(e_2 - q) / 5^q int q = (int) (e2 * LOG10_2_NUMERATOR / LOG10_2_DENOMINATOR); int k = POW5_INV_BITCOUNT + pow5bits(q) - 1; int i = -e2 + q + k; dv = (int) mulPow5InvDivPow2(mv, q, i); dp = (int) mulPow5InvDivPow2(mp, q, i); dm = (int) mulPow5InvDivPow2(mm, q, i); if (q != 0 && ((dp - 1) / 10 <= dm / 10)) { // We need to know one removed digit even if we are not going to loop below. We could use // q = X - 1 above, except that would require 33 bits for the result, and we've found that // 32-bit arithmetic is faster even on 64-bit machines. int l = POW5_INV_BITCOUNT + pow5bits(q - 1) - 1; lastRemovedDigit = (int) (mulPow5InvDivPow2(mv, q - 1, -e2 + q - 1 + l) % 10); } e10 = q; if (DEBUG) { System.out.println(mv + " * 2^" + e2 + " / 10^" + q); } dpIsTrailingZeros = pow5Factor(mp) >= q; dvIsTrailingZeros = pow5Factor(mv) >= q; dmIsTrailingZeros = pow5Factor(mm) >= q; } else { // Compute m * 5^(-e_2) / 10^q = m * 5^(-e_2 - q) / 2^q int q = (int) (-e2 * LOG10_5_NUMERATOR / LOG10_5_DENOMINATOR); int i = -e2 - q; int k = pow5bits(i) - POW5_BITCOUNT; int j = q - k; dv = (int) mulPow5divPow2(mv, i, j); dp = (int) mulPow5divPow2(mp, i, j); dm = (int) mulPow5divPow2(mm, i, j); if (q != 0 && ((dp - 1) / 10 <= dm / 10)) { j = q - 1 - (pow5bits(i + 1) - POW5_BITCOUNT); lastRemovedDigit = (int) (mulPow5divPow2(mv, i + 1, j) % 10); } e10 = q + e2; // Note: e2 and e10 are both negative here. if (DEBUG) { System.out.println(mv + " * 5^" + (-e2) + " / 10^" + q + " = " + mv + " * 5^" + (-e2 - q) + " / 2^" + q); } dpIsTrailingZeros = 1 >= q; dvIsTrailingZeros = (q < FLOAT_MANTISSA_BITS) && (mv & ((1 << (q - 1)) - 1)) == 0; dmIsTrailingZeros = (mm % 2 == 1 ? 0 : 1) >= q; } if (DEBUG) { System.out.println("Actual values"); System.out.println(" d+=" + dp); System.out.println(" d =" + dv); System.out.println(" d-=" + dm); System.out.println(" last removed=" + lastRemovedDigit); System.out.println(" e10=" + e10); System.out.println(" d+10=" + dpIsTrailingZeros); System.out.println(" d =" + dvIsTrailingZeros); System.out.println(" d-10=" + dmIsTrailingZeros); } // Step 4: Find the shortest decimal representation in the interval of legal representations. // // We do some extra work here in order to follow Float/Double.toString semantics. In particular, // that requires printing in scientific format if and only if the exponent is between -3 and 7, // and it requires printing at least two decimal digits. // // Above, we moved the decimal dot all the way to the right, so now we need to count digits to // figure out the correct exponent for scientific notation. int dplength = decimalLength(dp); int exp = e10 + dplength - 1; // Float.toString semantics requires using scientific notation if and only if outside this range. boolean scientificNotation = !((exp >= -3) && (exp < 7)); int removed = 0; if (dpIsTrailingZeros && !roundingMode.acceptUpperBound(even)) { dp--; } while (dp / 10 > dm / 10) { if ((dp < 100) && scientificNotation) { // We print at least two digits, so we might as well stop now. break; } dmIsTrailingZeros &= dm % 10 == 0; dp /= 10; lastRemovedDigit = dv % 10; dv /= 10; dm /= 10; removed++; } if (dmIsTrailingZeros && roundingMode.acceptLowerBound(even)) { while (dm % 10 == 0) { if ((dp < 100) && scientificNotation) { // We print at least two digits, so we might as well stop now. break; } dp /= 10; lastRemovedDigit = dv % 10; dv /= 10; dm /= 10; removed++; } } if (dvIsTrailingZeros && (lastRemovedDigit == 5) && (dv % 2 == 0)) { // Round down not up if the number ends in X50000 and the number is even. lastRemovedDigit = 4; } int output = dv + ((dv == dm && !(dmIsTrailingZeros && roundingMode.acceptLowerBound(even))) || (lastRemovedDigit >= 5) ? 1 : 0); int olength = dplength - removed; if (DEBUG) { System.out.println("Actual values after loop"); System.out.println(" d+=" + dp); System.out.println(" d =" + dv); System.out.println(" d-=" + dm); System.out.println(" last removed=" + lastRemovedDigit); System.out.println(" e10=" + e10); System.out.println(" d+10=" + dpIsTrailingZeros); System.out.println(" d-10=" + dmIsTrailingZeros); System.out.println(" output=" + output); System.out.println(" output_length=" + olength); System.out.println(" output_exponent=" + exp); } // Step 5: Print the decimal representation. // We follow Float.toString semantics here. char[] result = new char[15]; int index = 0; if (sign) { result[index++] = '-'; } if (scientificNotation) { // Print in the format x.xxxxxE-yy. for (int i = 0; i < olength - 1; i++) { int c = output % 10; output /= 10; result[index + olength - i] = (char) ('0' + c); } result[index] = (char) ('0' + output % 10); result[index + 1] = '.'; index += olength + 1; if (olength == 1) { result[index++] = '0'; } // Print 'E', the exponent sign, and the exponent, which has at most two digits. result[index++] = 'E'; if (exp < 0) { result[index++] = '-'; exp = -exp; } if (exp >= 10) { result[index++] = (char) ('0' + exp / 10); } result[index++] = (char) ('0' + exp % 10); } else { // Otherwise follow the Java spec for values in the interval [1E-3, 1E7). if (exp < 0) { // Decimal dot is before any of the digits. result[index++] = '0'; result[index++] = '.'; for (int i = -1; i > exp; i--) { result[index++] = '0'; } int current = index; for (int i = 0; i < olength; i++) { result[current + olength - i - 1] = (char) ('0' + output % 10); output /= 10; index++; } } else if (exp + 1 >= olength) { // Decimal dot is after any of the digits. for (int i = 0; i < olength; i++) { result[index + olength - i - 1] = (char) ('0' + output % 10); output /= 10; } index += olength; for (int i = olength; i < exp + 1; i++) { result[index++] = '0'; } result[index++] = '.'; result[index++] = '0'; } else { // Decimal dot is somewhere between the digits. int current = index + 1; for (int i = 0; i < olength; i++) { if (olength - i - 1 == exp) { result[current + olength - i - 1] = '.'; current--; } result[current + olength - i - 1] = (char) ('0' + output % 10); output /= 10; } index += olength + 1; } } return new String(result, 0, index); } private static int pow5bits(int e) { return e == 0 ? 1 : (int) ((e * LOG2_5_NUMERATOR + LOG2_5_DENOMINATOR - 1)/LOG2_5_DENOMINATOR); } /** * Returns the exponent of the largest power of 5 that divides the given value, i.e., returns * i such that value = 5^i * x, where x is an integer. */ private static int pow5Factor(int value) { int count = 0; while (value > 0) { if (value % 5 != 0) { return count; } value /= 5; count++; } throw new IllegalArgumentException("" + value); } /** * Compute the exact result of [m * 5^(-e_2) / 10^q] = [m * 5^(-e_2 - q) / 2^q] * = [m * [5^(p - q)/2^k] / 2^(q - k)] = [m * POW5[i] / 2^j]. */ private static long mulPow5divPow2(int m, int i, int j) { if (j - POW5_HALF_BITCOUNT < 0) { throw new IllegalArgumentException(); } long bits0 = m * (long) POW5_SPLIT[i][0]; long bits1 = m * (long) POW5_SPLIT[i][1]; return (bits0 + (bits1 >> POW5_HALF_BITCOUNT)) >> (j - POW5_HALF_BITCOUNT); } /** * Compute the exact result of [m * 2^p / 10^q] = [m * 2^(p - q) / 5 ^ q] * = [m * [2^k / 5^q] / 2^-(p - q - k)] = [m * POW5_INV[q] / 2^j]. */ private static long mulPow5InvDivPow2(int m, int q, int j) { if (j - POW5_INV_HALF_BITCOUNT < 0) { throw new IllegalArgumentException(); } long bits0 = m * (long) POW5_INV_SPLIT[q][0]; long bits1 = m * (long) POW5_INV_SPLIT[q][1]; return (bits0 + (bits1 >> POW5_INV_HALF_BITCOUNT)) >> (j - POW5_INV_HALF_BITCOUNT); } private static int decimalLength(int v) { int length = 10; int factor = 1000000000; for (; length > 0; length--) { if (v >= factor) { break; } factor /= 10; } return length; } }
0
repos/ryu/src/main/java/info/adams
repos/ryu/src/main/java/info/adams/ryu/RyuDouble.java
// Copyright 2018 Ulf Adams // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package info.adams.ryu; import java.math.BigInteger; /** * An implementation of Ryu for double. */ public final class RyuDouble { private static boolean DEBUG = false; private static final int DOUBLE_MANTISSA_BITS = 52; private static final long DOUBLE_MANTISSA_MASK = (1L << DOUBLE_MANTISSA_BITS) - 1; private static final int DOUBLE_EXPONENT_BITS = 11; private static final int DOUBLE_EXPONENT_MASK = (1 << DOUBLE_EXPONENT_BITS) - 1; private static final int DOUBLE_EXPONENT_BIAS = (1 << (DOUBLE_EXPONENT_BITS - 1)) - 1; private static final int POS_TABLE_SIZE = 326; private static final int NEG_TABLE_SIZE = 291; // Only for debugging. private static final BigInteger[] POW5 = new BigInteger[POS_TABLE_SIZE]; private static final BigInteger[] POW5_INV = new BigInteger[NEG_TABLE_SIZE]; private static final int POW5_BITCOUNT = 121; // max 3*31 = 124 private static final int POW5_QUARTER_BITCOUNT = 31; private static final int[][] POW5_SPLIT = new int[POS_TABLE_SIZE][4]; private static final int POW5_INV_BITCOUNT = 122; // max 3*31 = 124 private static final int POW5_INV_QUARTER_BITCOUNT = 31; private static final int[][] POW5_INV_SPLIT = new int[NEG_TABLE_SIZE][4]; static { BigInteger mask = BigInteger.valueOf(1).shiftLeft(POW5_QUARTER_BITCOUNT).subtract(BigInteger.ONE); BigInteger invMask = BigInteger.valueOf(1).shiftLeft(POW5_INV_QUARTER_BITCOUNT).subtract(BigInteger.ONE); for (int i = 0; i < Math.max(POW5.length, POW5_INV.length); i++) { BigInteger pow = BigInteger.valueOf(5).pow(i); int pow5len = pow.bitLength(); int expectedPow5Bits = pow5bits(i); if (expectedPow5Bits != pow5len) { throw new IllegalStateException(pow5len + " != " + expectedPow5Bits); } if (i < POW5.length) { POW5[i] = pow; } if (i < POW5_SPLIT.length) { for (int j = 0; j < 4; j++) { POW5_SPLIT[i][j] = pow .shiftRight(pow5len - POW5_BITCOUNT + (3 - j) * POW5_QUARTER_BITCOUNT) .and(mask) .intValueExact(); } } if (i < POW5_INV_SPLIT.length) { // We want floor(log_2 5^q) here, which is pow5len - 1. int j = pow5len - 1 + POW5_INV_BITCOUNT; BigInteger inv = BigInteger.ONE.shiftLeft(j).divide(pow).add(BigInteger.ONE); POW5_INV[i] = inv; for (int k = 0; k < 4; k++) { if (k == 0) { POW5_INV_SPLIT[i][k] = inv.shiftRight((3 - k) * POW5_INV_QUARTER_BITCOUNT).intValueExact(); } else { POW5_INV_SPLIT[i][k] = inv.shiftRight((3 - k) * POW5_INV_QUARTER_BITCOUNT).and(invMask).intValueExact(); } } } } } public static void main(String[] args) { DEBUG = true; double value = Double.longBitsToDouble(0x7fefffffffffffffL); String result = doubleToString(value); System.out.println(result + " " + value); } public static String doubleToString(double value) { return doubleToString(value, RoundingMode.ROUND_EVEN); } public static String doubleToString(double value, RoundingMode roundingMode) { // Step 1: Decode the floating point number, and unify normalized and subnormal cases. // First, handle all the trivial cases. if (Double.isNaN(value)) return "NaN"; if (value == Double.POSITIVE_INFINITY) return "Infinity"; if (value == Double.NEGATIVE_INFINITY) return "-Infinity"; long bits = Double.doubleToLongBits(value); if (bits == 0) return "0.0"; if (bits == 0x8000000000000000L) return "-0.0"; // Otherwise extract the mantissa and exponent bits and run the full algorithm. int ieeeExponent = (int) ((bits >>> DOUBLE_MANTISSA_BITS) & DOUBLE_EXPONENT_MASK); long ieeeMantissa = bits & DOUBLE_MANTISSA_MASK; int e2; long m2; if (ieeeExponent == 0) { // Denormal number - no implicit leading 1, and the exponent is 1, not 0. e2 = 1 - DOUBLE_EXPONENT_BIAS - DOUBLE_MANTISSA_BITS; m2 = ieeeMantissa; } else { // Add implicit leading 1. e2 = ieeeExponent - DOUBLE_EXPONENT_BIAS - DOUBLE_MANTISSA_BITS; m2 = ieeeMantissa | (1L << DOUBLE_MANTISSA_BITS); } boolean sign = bits < 0; if (DEBUG) { System.out.println("IN=" + Long.toBinaryString(bits)); System.out.println(" S=" + (sign ? "-" : "+") + " E=" + e2 + " M=" + m2); } // Step 2: Determine the interval of legal decimal representations. boolean even = (m2 & 1) == 0; final long mv = 4 * m2; final long mp = 4 * m2 + 2; final int mmShift = ((m2 != (1L << DOUBLE_MANTISSA_BITS)) || (ieeeExponent <= 1)) ? 1 : 0; final long mm = 4 * m2 - 1 - mmShift; e2 -= 2; if (DEBUG) { String sv, sp, sm; int e10; if (e2 >= 0) { sv = BigInteger.valueOf(mv).shiftLeft(e2).toString(); sp = BigInteger.valueOf(mp).shiftLeft(e2).toString(); sm = BigInteger.valueOf(mm).shiftLeft(e2).toString(); e10 = 0; } else { BigInteger factor = BigInteger.valueOf(5).pow(-e2); sv = BigInteger.valueOf(mv).multiply(factor).toString(); sp = BigInteger.valueOf(mp).multiply(factor).toString(); sm = BigInteger.valueOf(mm).multiply(factor).toString(); e10 = e2; } e10 += sp.length() - 1; System.out.println("E =" + e10); System.out.println("d+=" + sp); System.out.println("d =" + sv); System.out.println("d-=" + sm); System.out.println("e2=" + e2); } // Step 3: Convert to a decimal power base using 128-bit arithmetic. // -1077 = 1 - 1023 - 53 - 2 <= e_2 - 2 <= 2046 - 1023 - 53 - 2 = 968 long dv, dp, dm; final int e10; boolean dmIsTrailingZeros = false, dvIsTrailingZeros = false; if (e2 >= 0) { final int q = Math.max(0, ((e2 * 78913) >>> 18) - 1); // k = constant + floor(log_2(5^q)) final int k = POW5_INV_BITCOUNT + pow5bits(q) - 1; final int i = -e2 + q + k; dv = mulPow5InvDivPow2(mv, q, i); dp = mulPow5InvDivPow2(mp, q, i); dm = mulPow5InvDivPow2(mm, q, i); e10 = q; if (DEBUG) { System.out.println(mv + " * 2^" + e2); System.out.println("V+=" + dp); System.out.println("V =" + dv); System.out.println("V-=" + dm); } if (DEBUG) { long exact = POW5_INV[q] .multiply(BigInteger.valueOf(mv)) .shiftRight(-e2 + q + k).longValueExact(); System.out.println(exact + " " + POW5_INV[q].bitCount()); if (dv != exact) { throw new IllegalStateException(); } } if (q <= 21) { if (mv % 5 == 0) { dvIsTrailingZeros = multipleOfPowerOf5(mv, q); } else if (roundingMode.acceptUpperBound(even)) { dmIsTrailingZeros = multipleOfPowerOf5(mm, q); } else if (multipleOfPowerOf5(mp, q)) { dp--; } } } else { final int q = Math.max(0, ((-e2 * 732923) >>> 20) - 1); final int i = -e2 - q; final int k = pow5bits(i) - POW5_BITCOUNT; final int j = q - k; dv = mulPow5divPow2(mv, i, j); dp = mulPow5divPow2(mp, i, j); dm = mulPow5divPow2(mm, i, j); e10 = q + e2; if (DEBUG) { System.out.println(mv + " * 5^" + (-e2) + " / 10^" + q); } if (q <= 1) { dvIsTrailingZeros = true; if (roundingMode.acceptUpperBound(even)) { dmIsTrailingZeros = mmShift == 1; } else { dp--; } } else if (q < 63) { dvIsTrailingZeros = (mv & ((1L << (q - 1)) - 1)) == 0; } } if (DEBUG) { System.out.println("d+=" + dp); System.out.println("d =" + dv); System.out.println("d-=" + dm); System.out.println("e10=" + e10); System.out.println("d-10=" + dmIsTrailingZeros); System.out.println("d =" + dvIsTrailingZeros); System.out.println("Accept upper=" + roundingMode.acceptUpperBound(even)); System.out.println("Accept lower=" + roundingMode.acceptLowerBound(even)); } // Step 4: Find the shortest decimal representation in the interval of legal representations. // // We do some extra work here in order to follow Float/Double.toString semantics. In particular, // that requires printing in scientific format if and only if the exponent is between -3 and 7, // and it requires printing at least two decimal digits. // // Above, we moved the decimal dot all the way to the right, so now we need to count digits to // figure out the correct exponent for scientific notation. final int vplength = decimalLength(dp); int exp = e10 + vplength - 1; // Double.toString semantics requires using scientific notation if and only if outside this range. boolean scientificNotation = !((exp >= -3) && (exp < 7)); int removed = 0; int lastRemovedDigit = 0; long output; if (dmIsTrailingZeros || dvIsTrailingZeros) { while (dp / 10 > dm / 10) { if ((dp < 100) && scientificNotation) { // Double.toString semantics requires printing at least two digits. break; } dmIsTrailingZeros &= dm % 10 == 0; dvIsTrailingZeros &= lastRemovedDigit == 0; lastRemovedDigit = (int) (dv % 10); dp /= 10; dv /= 10; dm /= 10; removed++; } if (dmIsTrailingZeros && roundingMode.acceptLowerBound(even)) { while (dm % 10 == 0) { if ((dp < 100) && scientificNotation) { // Double.toString semantics requires printing at least two digits. break; } dvIsTrailingZeros &= lastRemovedDigit == 0; lastRemovedDigit = (int) (dv % 10); dp /= 10; dv /= 10; dm /= 10; removed++; } } if (dvIsTrailingZeros && (lastRemovedDigit == 5) && (dv % 2 == 0)) { // Round even if the exact numbers is .....50..0. lastRemovedDigit = 4; } output = dv + ((dv == dm && !(dmIsTrailingZeros && roundingMode.acceptLowerBound(even))) || (lastRemovedDigit >= 5) ? 1 : 0); } else { while (dp / 10 > dm / 10) { if ((dp < 100) && scientificNotation) { // Double.toString semantics requires printing at least two digits. break; } lastRemovedDigit = (int) (dv % 10); dp /= 10; dv /= 10; dm /= 10; removed++; } output = dv + ((dv == dm || (lastRemovedDigit >= 5)) ? 1 : 0); } int olength = vplength - removed; if (DEBUG) { System.out.println("LAST_REMOVED_DIGIT=" + lastRemovedDigit); System.out.println("VP=" + dp); System.out.println("VR=" + dv); System.out.println("VM=" + dm); System.out.println("O=" + output); System.out.println("OLEN=" + olength); System.out.println("EXP=" + exp); } // Step 5: Print the decimal representation. // We follow Double.toString semantics here. char[] result = new char[24]; int index = 0; if (sign) { result[index++] = '-'; } // Values in the interval [1E-3, 1E7) are special. if (scientificNotation) { // Print in the format x.xxxxxE-yy. for (int i = 0; i < olength - 1; i++) { int c = (int) (output % 10); output /= 10; result[index + olength - i] = (char) ('0' + c); } result[index] = (char) ('0' + output % 10); result[index + 1] = '.'; index += olength + 1; if (olength == 1) { result[index++] = '0'; } // Print 'E', the exponent sign, and the exponent, which has at most three digits. result[index++] = 'E'; if (exp < 0) { result[index++] = '-'; exp = -exp; } if (exp >= 100) { result[index++] = (char) ('0' + exp / 100); exp %= 100; result[index++] = (char) ('0' + exp / 10); } else if (exp >= 10) { result[index++] = (char) ('0' + exp / 10); } result[index++] = (char) ('0' + exp % 10); return new String(result, 0, index); } else { // Otherwise follow the Java spec for values in the interval [1E-3, 1E7). if (exp < 0) { // Decimal dot is before any of the digits. result[index++] = '0'; result[index++] = '.'; for (int i = -1; i > exp; i--) { result[index++] = '0'; } int current = index; for (int i = 0; i < olength; i++) { result[current + olength - i - 1] = (char) ('0' + output % 10); output /= 10; index++; } } else if (exp + 1 >= olength) { // Decimal dot is after any of the digits. for (int i = 0; i < olength; i++) { result[index + olength - i - 1] = (char) ('0' + output % 10); output /= 10; } index += olength; for (int i = olength; i < exp + 1; i++) { result[index++] = '0'; } result[index++] = '.'; result[index++] = '0'; } else { // Decimal dot is somewhere between the digits. int current = index + 1; for (int i = 0; i < olength; i++) { if (olength - i - 1 == exp) { result[current + olength - i - 1] = '.'; current--; } result[current + olength - i - 1] = (char) ('0' + output % 10); output /= 10; } index += olength + 1; } return new String(result, 0, index); } } private static int pow5bits(int e) { return ((e * 1217359) >>> 19) + 1; } private static int decimalLength(long v) { if (v >= 1000000000000000000L) return 19; if (v >= 100000000000000000L) return 18; if (v >= 10000000000000000L) return 17; if (v >= 1000000000000000L) return 16; if (v >= 100000000000000L) return 15; if (v >= 10000000000000L) return 14; if (v >= 1000000000000L) return 13; if (v >= 100000000000L) return 12; if (v >= 10000000000L) return 11; if (v >= 1000000000L) return 10; if (v >= 100000000L) return 9; if (v >= 10000000L) return 8; if (v >= 1000000L) return 7; if (v >= 100000L) return 6; if (v >= 10000L) return 5; if (v >= 1000L) return 4; if (v >= 100L) return 3; if (v >= 10L) return 2; return 1; } private static boolean multipleOfPowerOf5(long value, int q) { return pow5Factor(value) >= q; } private static int pow5Factor(long value) { // We want to find the largest power of 5 that divides value. if ((value % 5) != 0) return 0; if ((value % 25) != 0) return 1; if ((value % 125) != 0) return 2; if ((value % 625) != 0) return 3; int count = 4; value /= 625; while (value > 0) { if (value % 5 != 0) { return count; } value /= 5; count++; } throw new IllegalArgumentException("" + value); } /** * Compute the high digits of m * 5^p / 10^q = m * 5^(p - q) / 2^q = m * 5^i / 2^j, with q chosen * such that m * 5^i / 2^j has sufficiently many decimal digits to represent the original floating * point number. */ private static long mulPow5divPow2(long m, int i, int j) { // m has at most 55 bits. long mHigh = m >>> 31; long mLow = m & 0x7fffffff; long bits13 = mHigh * POW5_SPLIT[i][0]; // 124 long bits03 = mLow * POW5_SPLIT[i][0]; // 93 long bits12 = mHigh * POW5_SPLIT[i][1]; // 93 long bits02 = mLow * POW5_SPLIT[i][1]; // 62 long bits11 = mHigh * POW5_SPLIT[i][2]; // 62 long bits01 = mLow * POW5_SPLIT[i][2]; // 31 long bits10 = mHigh * POW5_SPLIT[i][3]; // 31 long bits00 = mLow * POW5_SPLIT[i][3]; // 0 int actualShift = j - 3 * 31 - 21; if (actualShift < 0) { throw new IllegalArgumentException("" + actualShift); } return (((((( ((bits00 >>> 31) + bits01 + bits10) >>> 31) + bits02 + bits11) >>> 31) + bits03 + bits12) >>> 21) + (bits13 << 10)) >>> actualShift; } /** * Compute the high digits of m / 5^i / 2^j such that the result is accurate to at least 9 * decimal digits. i and j are already chosen appropriately. */ private static long mulPow5InvDivPow2(long m, int i, int j) { // m has at most 55 bits. long mHigh = m >>> 31; long mLow = m & 0x7fffffff; long bits13 = mHigh * POW5_INV_SPLIT[i][0]; long bits03 = mLow * POW5_INV_SPLIT[i][0]; long bits12 = mHigh * POW5_INV_SPLIT[i][1]; long bits02 = mLow * POW5_INV_SPLIT[i][1]; long bits11 = mHigh * POW5_INV_SPLIT[i][2]; long bits01 = mLow * POW5_INV_SPLIT[i][2]; long bits10 = mHigh * POW5_INV_SPLIT[i][3]; long bits00 = mLow * POW5_INV_SPLIT[i][3]; int actualShift = j - 3 * 31 - 21; if (actualShift < 0) { throw new IllegalArgumentException("" + actualShift); } return (((((( ((bits00 >>> 31) + bits01 + bits10) >>> 31) + bits02 + bits11) >>> 31) + bits03 + bits12) >>> 21) + (bits13 << 10)) >>> actualShift; } }
0
repos/ryu/src/main/java/info/adams
repos/ryu/src/main/java/info/adams/ryu/RoundingMode.java
// Copyright 2018 Ulf Adams // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package info.adams.ryu; public enum RoundingMode { CONSERVATIVE { @Override public boolean acceptUpperBound(boolean even) { return false; } @Override public boolean acceptLowerBound(boolean even) { return false; } }, ROUND_EVEN { @Override public boolean acceptUpperBound(boolean even) { return even; } @Override public boolean acceptLowerBound(boolean even) { return even; } }; public abstract boolean acceptUpperBound(boolean even); public abstract boolean acceptLowerBound(boolean even); }
0
repos/ryu/src/main/java/info/adams/ryu
repos/ryu/src/main/java/info/adams/ryu/printf/PrintPrintfLookupTable.java
// Copyright 2018 Ulf Adams // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package info.adams.ryu.printf; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * Prints a lookup table for the C version of Ryu. */ public final class PrintPrintfLookupTable { private static final int POW10_ADDITIONAL_BITS = 120; // Multiplier < 10^9 * 2^BITS // BITS >= pow10BitsForIndex(indexForExponent(e2)) + POW10_ADDITIONAL_BITS - e2 // >= 16 * [(e2 + 15) / 16] + POW10_ADDITIONAL_BITS - e2 // >= (e2 + 15) + POW10_ADDITIONAL_BITS - e2 // >= 15 + POW10_ADDITIONAL_BITS private static final int BITS = POW10_ADDITIONAL_BITS + 16; private static final int TABLE_SIZE = 64; private static final int ADDITIONAL_BITS_2 = 120; // max 192 - 32 - 16 = 144 private static final int TABLE_SIZE_2 = 68; private static final BigInteger mask = BigInteger.valueOf(1).shiftLeft(64).subtract(BigInteger.ONE); public static void main(String[] args) { printTables(); printInverseTables(); } private static void printTables() { int sum = 0; for (int idx = 0; idx < TABLE_SIZE; idx++) { System.out.print(sum + ", "); int len = lengthForIndex(idx); sum += len; } System.out.println(); int totalLength = 0; for (int idx = 0; idx < TABLE_SIZE; idx++) { totalLength += lengthForIndex(idx); } System.out.println("static uint64_t POW10_SPLIT[" + totalLength + "][3] = {"); for (int idx = 0; idx < TABLE_SIZE; idx++) { int pow10bits = pow10BitsForIndex(idx); int len = lengthForIndex(idx); for (int i = 0; i < len; i++) { BigInteger v = BigInteger.valueOf(1).shiftLeft(pow10bits) .divide(BigInteger.TEN.pow(9 * i)) .add(BigInteger.ONE) .mod(BigInteger.TEN.pow(9).shiftLeft(BITS)); if (v.bitLength() > 192) { throw new IllegalStateException("" + v.bitLength()); } System.out.printf(" { "); for (int j = 0; j < 3; j++) { if (j != 0) { System.out.print(", "); } BigInteger bits = v.shiftRight(64 * j).and(mask); System.out.printf("%20su", bits); } System.out.printf(" },\n"); } } System.out.println("};"); } private static void printInverseTables() { BigInteger lowerCutoff = BigInteger.ONE.shiftLeft(54 + 8); int[] min = new int[TABLE_SIZE_2]; int[] max = new int[TABLE_SIZE_2]; int[] offset = new int[TABLE_SIZE_2]; List<BigInteger> data = new ArrayList<>(); Arrays.fill(min, -1); Arrays.fill(max, -1); for (int idx = 0; idx < TABLE_SIZE_2; idx++) { int len = lengthForIndex2(idx); int k = ADDITIONAL_BITS_2; offset[idx] = data.size(); for (int i = 0; ; i++) { BigInteger v = BigInteger.TEN.pow(9 * (i + 1)) .shiftRight(-(k - 16 * idx)) .mod(BigInteger.TEN.pow(9).shiftLeft(k + 16)); if (v.bitLength() > 192) { // 32 + 74 + 16 = 122 throw new IllegalStateException("" + v.bitLength()); } if (min[idx] == -1 && v.multiply(lowerCutoff).shiftRight(128).equals(BigInteger.ZERO)) { continue; } if (min[idx] == -1) { min[idx] = i; } if (v.equals(BigInteger.ZERO)) { break; } data.add(v); max[idx] = i + 1; } BigInteger v = BigInteger.TEN.pow(9 * (len + 1)) .shiftRight(-(k - 16 * idx)) .mod(BigInteger.TEN.pow(9).shiftLeft(k + 16)); if (!v.equals(BigInteger.ZERO)) { throw new IllegalStateException(idx + " " + len + " " + v); } } System.out.println("static const uint16_t POW10_OFFSET_2[TABLE_SIZE_2] = {"); System.out.print(" "); for (int idx = 0; idx < TABLE_SIZE_2; idx++) { System.out.printf(" %4d,", Integer.valueOf(offset[idx])); if (idx % 10 == 9) { System.out.println(); System.out.print(" "); } } System.out.printf(" %4d\n", Integer.valueOf(data.size())); System.out.println("};"); System.out.println(); System.out.println("static const uint8_t MIN_BLOCK_2[TABLE_SIZE_2] = {"); System.out.print(" "); for (int idx = 0; idx < TABLE_SIZE_2; idx++) { System.out.printf(" %4d,", Integer.valueOf(min[idx])); if (idx % 10 == 9) { System.out.println(); System.out.print(" "); } } System.out.printf(" %4d\n", Integer.valueOf(0)); System.out.println("};"); // System.out.println("static const uint8_t MAX_BLOCK_2[TABLE_SIZE_2] = {"); // System.out.print(" "); // for (int idx = 0; idx < TABLE_SIZE_2; idx++) { // System.out.printf(" %4d,", Integer.valueOf(max[idx])); // if (idx % 10 == 9) { // System.out.println(); // System.out.print(" "); // } // } // System.out.printf(" %4d\n", Integer.valueOf(0)); // System.out.println("};"); System.out.println(); System.out.println("static const uint64_t POW10_SPLIT_2[" + data.size() + "][3] = {"); for (int i = 0; i < data.size(); i++) { BigInteger v = data.get(i); System.out.printf(" { "); for (int j = 0; j < 3; j++) { if (j != 0) { System.out.print(", "); } BigInteger bits = v.shiftRight(64 * j).and(mask); System.out.printf("%20su", bits); } System.out.printf(" },\n"); } System.out.println("};"); } private static int pow10BitsForIndex(int idx) { return 16 * idx + POW10_ADDITIONAL_BITS; } private static int lengthForIndex(int idx) { // [log_10(2^i)] = ((16 * i) * 78913L) >> 18 <-- floor // +1 for ceil, +16 for mantissa, +8 to round up when dividing by 9 return ((int) (((16 * idx) * 1292913986L) >> 32) + 1 + 16 + 8) / 9; } private static int lengthForIndex2(int idx) { return (120 * idx) / 64 + 3; } }
0
repos/ryu/src/main/java/info/adams/ryu
repos/ryu/src/main/java/info/adams/ryu/analysis/PrintGenericLookupTable.java
// Copyright 2018 Ulf Adams // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package info.adams.ryu.analysis; import java.math.BigInteger; import java.util.Arrays; import java.util.BitSet; /** * Prints a lookup table for the C version of Ryu. */ public final class PrintGenericLookupTable { // Bit sizes: FLOAT128,249,246 // Table sizes: FLOAT128,4968,4897,9865 // 5^55 < 2^128 private static final int POS_TABLE_SIZE = 4968; private static final int NEG_TABLE_SIZE = 4897; // We use the same size for simplicity. private static final int POW5_BITCOUNT = 249; private static final int POW5_INV_BITCOUNT = 249; public static void main(String[] args) { BigInteger mask = BigInteger.valueOf(1).shiftLeft(64).subtract(BigInteger.ONE); int pow5TableSize = 56; // log_5(2^128) + 1 System.out.println("#define POW5_INV_BITCOUNT " + POW5_INV_BITCOUNT); System.out.println("#define POW5_BITCOUNT " + POW5_BITCOUNT); System.out.println("#define POW5_TABLE_SIZE " + pow5TableSize); System.out.println(); System.out.println("static uint64_t GENERIC_POW5_TABLE[POW5_TABLE_SIZE][2] = {"); for (int i = 0; i < pow5TableSize; i++) { if (i != 0) { System.out.println(","); } BigInteger pow = BigInteger.valueOf(5).pow(i); System.out.print(" { "); for (int j = 0; j < 2; j++) { if (j != 0) { System.out.print(", "); } System.out.printf("%20su", pow.and(mask)); pow = pow.shiftRight(64); } if (!pow.equals(BigInteger.ZERO)) { throw new IllegalStateException(); } System.out.print(" }"); } System.out.println(); System.out.println("};"); int posPartialTableSize = (POS_TABLE_SIZE / pow5TableSize) + 1; System.out.println("static uint64_t GENERIC_POW5_SPLIT[" + posPartialTableSize + "][4] = {"); for (int i = 0; i < posPartialTableSize; i++) { if (i != 0) { System.out.println(","); } BigInteger pow = pos(pow5TableSize * i); System.out.print(" { "); for (int j = 0; j < 4; j++) { if (j != 0) { System.out.print(", "); } System.out.printf("%20su", pow.and(mask)); pow = pow.shiftRight(64); } if (!pow.equals(BigInteger.ZERO)) { throw new IllegalStateException(); } System.out.print(" }"); } System.out.println(); System.out.println("};"); BitSet errorBits = new BitSet(); for (int i = 0; i < POS_TABLE_SIZE; i++) { int base = i / pow5TableSize; int base2 = base * pow5TableSize; int offset = i - base2; BigInteger pow5base = pos(base2); BigInteger pow5offset = BigInteger.valueOf(5).pow(offset); BigInteger product = pow5base.multiply(pow5offset).shiftRight(pow5bits(i) - pow5bits(base2)); BigInteger exact = pos(i); int diff = exact.subtract(product).intValueExact(); // System.out.print((diff != 0 ? diff : " ") + " "); // if (i % pow5TableSize == pow5TableSize - 1) { // System.out.println(); // } errorBits.set(2 * i + 0, (diff & 1) != 0); errorBits.set(2 * i + 1, (diff & 2) != 0); } long[] error = Arrays.copyOf(errorBits.toLongArray(), POS_TABLE_SIZE / 32 + 1); System.out.println("static uint64_t POW5_ERRORS[" + error.length + "] = {"); for (int i = 0; i < error.length; i++) { if (i % 4 == 0) { if (i != 0) { System.out.println(); } System.out.print(" "); } System.out.printf("0x%016xu, ", Long.valueOf(error[i])); } System.out.println(); System.out.println("};"); int negPartialTableSize = (NEG_TABLE_SIZE + pow5TableSize - 1) / pow5TableSize + 1; System.out.println("static uint64_t GENERIC_POW5_INV_SPLIT[" + negPartialTableSize + "][4] = {"); for (int i = 0; i < negPartialTableSize; i++) { if (i != 0) { System.out.println(","); } BigInteger inv = neg(i * pow5TableSize); System.out.print(" { "); for (int j = 0; j < 4; j++) { if (j != 0) { System.out.print(", "); } System.out.printf("%20su", inv.and(mask)); inv = inv.shiftRight(64); } if (!inv.equals(BigInteger.ZERO)) { throw new IllegalStateException(); } System.out.print(" }"); } System.out.println(); System.out.println("};"); errorBits.clear(); for (int i = 0; i < NEG_TABLE_SIZE; i++) { int base = (i + pow5TableSize - 1) / pow5TableSize; int base2 = base * pow5TableSize; int offset = base2 - i; BigInteger pow5base = neg(base2); BigInteger pow5offset = BigInteger.valueOf(5).pow(offset); BigInteger product = pow5base.multiply(pow5offset).shiftRight(pow5bits(base2) - pow5bits(i)); BigInteger exact = neg(i); int diff = exact.subtract(product).intValueExact(); // System.out.print((diff != 0 ? diff : " ") + " "); // if (i % pow5TableSize == pow5TableSize - 1) { // System.out.println(); // } errorBits.set(2 * i + 0, (diff & 1) != 0); errorBits.set(2 * i + 1, (diff & 2) != 0); } error = Arrays.copyOf(errorBits.toLongArray(), NEG_TABLE_SIZE / 32 + 1); System.out.println("static uint64_t POW5_INV_ERRORS[" + error.length + "] = {"); for (int i = 0; i < error.length; i++) { if (i % 4 == 0) { System.out.print(" "); } System.out.printf("0x%016xu, ", Long.valueOf(error[i])); if (i % 4 == 3) { System.out.println(); } } System.out.println(); System.out.println("};"); { int[] exps = new int[] { 1, 10, 55, 56, 300, 1000, 2345, 3210, POS_TABLE_SIZE - 3, POS_TABLE_SIZE - 1 }; System.out.println("static uint64_t EXACT_POW5[" + exps.length + "][4] = {"); for (int i = 0; i < exps.length; i++) { if (i != 0) { System.out.println(","); } BigInteger exact = pos(exps[i]); System.out.print(" { "); for (int j = 0; j < 4; j++) { if (j != 0) { System.out.print(", "); } System.out.printf("%20su", exact.and(mask)); exact = exact.shiftRight(64); } if (!exact.equals(BigInteger.ZERO)) { throw new IllegalStateException(); } System.out.print(" }"); } System.out.println(); System.out.println("};"); } { int[] exps = new int[] { 1, 10, 55, 56, 300, 1000, 2345, 3210, NEG_TABLE_SIZE - 3, NEG_TABLE_SIZE - 1 }; System.out.println("static uint64_t EXACT_INV_POW5[" + exps.length + "][4] = {"); for (int i = 0; i < exps.length; i++) { if (i != 0) { System.out.println(","); } BigInteger exact = neg(exps[i]).add(BigInteger.ONE); System.out.print(" { "); for (int j = 0; j < 4; j++) { if (j != 0) { System.out.print(", "); } System.out.printf("%20su", exact.and(mask)); exact = exact.shiftRight(64); } if (!exact.equals(BigInteger.ZERO)) { throw new IllegalStateException(); } System.out.print(" }"); } System.out.println(); System.out.println("};"); } } private static BigInteger pos(int i) { BigInteger pow = BigInteger.valueOf(5).pow(i); return pow.shiftRight(pow.bitLength() - POW5_BITCOUNT); } private static BigInteger neg(int i) { BigInteger pow = BigInteger.valueOf(5).pow(i); // We want floor(log_2 5^q) here, which is pow5len - 1. int shift = pow.bitLength() - 1 + POW5_INV_BITCOUNT; return BigInteger.ONE.shiftLeft(shift).divide(pow); //.add(BigInteger.ONE); } private static int pow5bits(int e) { return (int) ((e * 163391164108059L) >> 46) + 1; } }
0
repos/ryu/src/main/java/info/adams/ryu
repos/ryu/src/main/java/info/adams/ryu/analysis/EuclidMinMax.java
// Copyright 2018 Ulf Adams // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package info.adams.ryu.analysis; import java.math.BigInteger; /** * Computes the modular min and max using a modified version of Euclid's algorithm. */ public final class EuclidMinMax { private static final boolean DEBUG = false; public static BigInteger min(BigInteger multiplier, BigInteger modulo, BigInteger maximum) { if (DEBUG) { System.out.println(); } BigInteger c = multiplier.gcd(modulo); BigInteger b = modulo.divide(c); BigInteger a = multiplier.divide(c).mod(b); if (maximum.compareTo(b) >= 0) { return BigInteger.ZERO; } if (DEBUG) { System.out.println("C=" + c); } BigInteger s = BigInteger.ONE; BigInteger t = BigInteger.ZERO; BigInteger u = BigInteger.ZERO; BigInteger v = BigInteger.ONE; while (true) { if (DEBUG) { System.out.printf("A=%s\nB=%s\n", a, b); } while (b.compareTo(a) >= 0) { b = b.subtract(a); u = u.subtract(s); v = v.subtract(t); if (DEBUG) { System.out.printf("U=%s (A=%s)\n", u, a); } if (u.negate().compareTo(maximum) >= 0) { return a.multiply(c); } } if (b.equals(BigInteger.ZERO)) { return BigInteger.ZERO; } while (a.compareTo(b) >= 0) { BigInteger oldA = a; a = a.subtract(b); s = s.subtract(u); t = t.subtract(v); if (DEBUG) { System.out.printf("S=%s (A=%s)\n", s, a); } int cmp = s.compareTo(maximum); if (cmp >= 0) { if (cmp > 0) { return oldA.multiply(c); } else { return a.multiply(c); } } } if (a.equals(BigInteger.ZERO)) { return BigInteger.ZERO; } } } public static BigInteger max(BigInteger multiplier, BigInteger modulo, BigInteger maximum) { if (DEBUG) { System.out.println(); } BigInteger c = multiplier.gcd(modulo); BigInteger b = modulo.divide(c); BigInteger a = multiplier.divide(c).mod(b); if (DEBUG) { System.out.printf("A=%s B=%s C=%s MAX=%s\n", a, b, c, maximum); } if (maximum.compareTo(b) >= 0) { return modulo.subtract(c); } BigInteger s = BigInteger.ONE; BigInteger t = BigInteger.ZERO; BigInteger u = BigInteger.ZERO; BigInteger v = BigInteger.ONE; while (true) { if (DEBUG) { System.out.printf("A=%s\nB=%s\n", a, b); } while (b.compareTo(a) >= 0) { BigInteger q = b.divide(a); q = q.min(maximum.subtract(u.negate()).divide(s).subtract(BigInteger.ONE)); q = q.max(BigInteger.ONE); BigInteger oldB = b; b = b.subtract(a.multiply(q)); u = u.subtract(s.multiply(q)); v = v.subtract(t.multiply(q)); if (DEBUG) { System.out.printf("U=%s (B=%s)\n", u, b); } int cmp = u.negate().compareTo(maximum); if (cmp >= 0) { if (cmp > 0) { return modulo.subtract(oldB.multiply(c)); } else { return modulo.subtract(b.multiply(c)); } } } if (b.equals(BigInteger.ZERO)) { return modulo.subtract(c); } while (a.compareTo(b) >= 0) { BigInteger q = BigInteger.ONE; //a.divide(b); if (!u.equals(BigInteger.ZERO)) { q = q.min(maximum.subtract(s).divide(u.negate().add(BigInteger.ONE))); } q = q.max(BigInteger.ONE); a = a.subtract(b.multiply(q)); s = s.subtract(u.multiply(q)); t = t.subtract(v.multiply(q)); if (DEBUG) { System.out.printf("S=%s (B=%s)\n", s, b); } if (s.compareTo(maximum) >= 0) { return modulo.subtract(b.multiply(c)); } } if (a.equals(BigInteger.ZERO)) { return modulo.subtract(c); } } } }
0
repos/ryu/src/main/java/info/adams/ryu
repos/ryu/src/main/java/info/adams/ryu/analysis/PrintFloatLookupTable.java
// Copyright 2018 Ulf Adams // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package info.adams.ryu.analysis; import java.math.BigInteger; /** * Prints a lookup table for the C version of Ryu. */ public final class PrintFloatLookupTable { private static final int POS_TABLE_SIZE = 47; private static final int INV_TABLE_SIZE = 55; private static final int POW5_BITCOUNT = 61; // max 63 private static final int POW5_INV_BITCOUNT = 59; // max 63 public static void main(String[] args) { System.out.println("#define POW5_INV_BITCOUNT " + POW5_INV_BITCOUNT); System.out.println("static uint64_t FLOAT_POW5_INV_SPLIT[" + INV_TABLE_SIZE + "] = {"); for (int i = 0; i < INV_TABLE_SIZE; i++) { BigInteger pow = BigInteger.valueOf(5).pow(i); int pow5len = pow.bitLength(); int j = pow5len - 1 + POW5_INV_BITCOUNT; BigInteger pow5inv = BigInteger.ONE.shiftLeft(j).divide(pow).add(BigInteger.ONE); long v = pow5inv.longValueExact(); System.out.printf(" %19su", Long.toUnsignedString(v)); if (i < INV_TABLE_SIZE - 1) { System.out.print(","); } if (i % 4 == 3) { System.out.println(); } } System.out.println(); System.out.println("};"); System.out.println("#define POW5_BITCOUNT " + POW5_BITCOUNT); System.out.println("static uint64_t FLOAT_POW5_SPLIT[" + POS_TABLE_SIZE + "] = {"); for (int i = 0; i < POS_TABLE_SIZE; i++) { BigInteger pow = BigInteger.valueOf(5).pow(i); int pow5len = pow.bitLength(); BigInteger pow5 = pow.shiftRight(pow5len - POW5_BITCOUNT); long v = pow5.longValueExact(); System.out.printf(" %19su", Long.toUnsignedString(v)); if (i < POS_TABLE_SIZE - 1) { System.out.print(","); } if (i % 4 == 3) { System.out.println(); } } System.out.println(); System.out.println("};"); } }
0
repos/ryu/src/main/java/info/adams/ryu
repos/ryu/src/main/java/info/adams/ryu/analysis/ComputeTableSizes.java
// Copyright 2018 Ulf Adams // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package info.adams.ryu.analysis; /** * Computes and outputs the lookup table sizes. */ public class ComputeTableSizes { private static final long LOG10_2_DENOMINATOR = 10000000L; private static final long LOG10_2_NUMERATOR = (long) (LOG10_2_DENOMINATOR * Math.log10(2)); private static final long LOG10_5_DENOMINATOR = 10000000L; private static final long LOG10_5_NUMERATOR = (long) (LOG10_5_DENOMINATOR * Math.log10(5)); public static void main(String[] args) { boolean verbose = false; for (String s : args) { if ("-v".equals(s)) { verbose = true; } } if (verbose) { System.out.println("These are the lookup table sizes required for each floating point type:"); } else { System.out.println("floating_point_type,table_size_1,table_size_2,total_size"); } for (FloatingPointFormat format : FloatingPointFormat.values()) { int minE2 = 1 - format.bias() - format.mantissaBits() - 2; int maxE2 = ((1 << format.exponentBits()) - 2) - format.bias() - format.mantissaBits() - 2; long minQ, maxQ; if (format == FloatingPointFormat.FLOAT32) { // Float32 is special; using -1 as below is problematic as it would require 33 bit // integers. Instead, we compute the additionally required digit separately. minQ = (-minE2 * LOG10_5_NUMERATOR) / LOG10_5_DENOMINATOR; maxQ = (maxE2 * LOG10_2_NUMERATOR) / LOG10_2_DENOMINATOR; } else { minQ = Math.max(0, (-minE2 * LOG10_5_NUMERATOR) / LOG10_5_DENOMINATOR - 1); maxQ = Math.max(0, (maxE2 * LOG10_2_NUMERATOR) / LOG10_2_DENOMINATOR - 1); } long negTableSize = (-minE2 - minQ) + 1; long posTableSize = maxQ + 1; if (verbose) { System.out.println(format); System.out.println(" " + minE2 + " <= e_2 <= " + maxE2); System.out.println(" " + (-minQ) + " <= q <= " + maxQ); System.out.println(" Total table size = " + negTableSize + " + " + posTableSize + " = " + (negTableSize + posTableSize)); } else { System.out.println(format + "," + negTableSize + "," + posTableSize + "," + (negTableSize + posTableSize)); } } } }
0
repos/ryu/src/main/java/info/adams/ryu
repos/ryu/src/main/java/info/adams/ryu/analysis/PrintDoubleLookupTable.java
// Copyright 2018 Ulf Adams // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package info.adams.ryu.analysis; import java.math.BigInteger; /** * Prints a lookup table for the C version of Ryu. */ public final class PrintDoubleLookupTable { private static final int POS_TABLE_SIZE = 326; // The C version has two code paths, one of which requires an additional entry here. private static final int NEG_TABLE_SIZE = 342; // We intentionally choose these to be larger than or equal to the float equivalent + 64. private static final int POW5_BITCOUNT = 125; // max 127 private static final int POW5_INV_BITCOUNT = 125; // max 127 private static final boolean PRINT_LARGE_TABLES = true; private static final BigInteger MASK64 = BigInteger.valueOf(1).shiftLeft(64).subtract(BigInteger.ONE); public static void main(String[] args) { BigInteger[] largeInvTable = new BigInteger[NEG_TABLE_SIZE]; for (int i = 0; i < largeInvTable.length; i++) { largeInvTable[i] = invMultiplier(i); } int mulTableSize = 26; BigInteger[] smallInvTable = new BigInteger[(NEG_TABLE_SIZE + mulTableSize - 1) / mulTableSize + 1]; for (int i = 0; i < smallInvTable.length; i++) { smallInvTable[i] = invMultiplier(mulTableSize * i); } int[] invErrorTable = new int[NEG_TABLE_SIZE]; for (int i = 0; i < NEG_TABLE_SIZE; i++) { int base = (i + mulTableSize - 1) / mulTableSize; int base2 = base * mulTableSize; int offset = base2 - i; BigInteger mul = BigInteger.valueOf(5).pow(offset); BigInteger result = smallInvTable[base].subtract(BigInteger.ONE).multiply(mul).shiftRight(pow5bits(base2) - pow5bits(i)).add(BigInteger.ONE); BigInteger error = invMultiplier(i).subtract(result); if ((error.signum() < 0) || (error.compareTo(BigInteger.valueOf(2)) > 0)) { throw new IllegalStateException("That went wrong!"); } invErrorTable[i] = error.intValueExact(); } BigInteger[] largeTable = new BigInteger[POS_TABLE_SIZE]; for (int i = 0; i < largeTable.length; i++) { largeTable[i] = multiplier(i); } BigInteger[] smallTable = new BigInteger[(POS_TABLE_SIZE + mulTableSize - 1) / mulTableSize]; for (int i = 0; i < smallTable.length; i++) { smallTable[i] = multiplier(mulTableSize * i); } int[] errorTable = new int[POS_TABLE_SIZE]; for (int i = 0; i < POS_TABLE_SIZE; i++) { int base = i / mulTableSize; int base2 = base * mulTableSize; int offset = i - base2; BigInteger mul = BigInteger.valueOf(5).pow(offset); BigInteger result = smallTable[base].multiply(mul).shiftRight(pow5bits(i) - pow5bits(base2)); BigInteger error = multiplier(i).subtract(result); if ((error.signum() < 0) || (error.compareTo(BigInteger.valueOf(2)) > 0)) { throw new IllegalStateException("That went wrong: " + error); } errorTable[i] = error.intValueExact(); } // System.out.println(Arrays.toString(invErrorTable)); // System.out.println(Arrays.toString(errorTable)); System.out.println("#define DOUBLE_POW5_INV_BITCOUNT " + POW5_INV_BITCOUNT); System.out.println("#define DOUBLE_POW5_BITCOUNT " + POW5_BITCOUNT); System.out.println(); if (PRINT_LARGE_TABLES) { printTable("DOUBLE_POW5_INV_SPLIT", largeInvTable, 2); System.out.println(); printTable("DOUBLE_POW5_SPLIT", largeTable, 2); } else { printTable("DOUBLE_POW5_INV_SPLIT2", smallInvTable, 1); printOffsets("POW5_INV_OFFSETS", invErrorTable, 6); System.out.println(); printTable("DOUBLE_POW5_SPLIT2", smallTable, 1); printOffsets("POW5_OFFSETS", errorTable, 6); } } private static BigInteger invMultiplier(int i) { // 5^i BigInteger pow = BigInteger.valueOf(5).pow(i); // length of 5^i in binary = ceil(log_2(5^i)) int pow5len = pow.bitLength(); // We want floor(log_2(5^i)) here, which is pow5len - 1 (no power of 5 is a power of 2). int j = pow5len - 1 + POW5_INV_BITCOUNT; // [2^j / 5^i] + 1 = [2^(floor(log_2(5^i)) + POW5_INV_BITCOUNT) / 5^i] + 1 // By construction, this will have approximately POW5_INV_BITCOUNT + 1 bits. BigInteger inv = BigInteger.ONE.shiftLeft(j).divide(pow).add(BigInteger.ONE); if (inv.bitLength() > POW5_INV_BITCOUNT + 1) { throw new IllegalStateException("Result is longer than expected: " + inv.bitLength() + " > " + (POW5_INV_BITCOUNT + 1)); } return inv; } private static BigInteger multiplier(int i) { // 5^i BigInteger pow = BigInteger.valueOf(5).pow(i); int pow5len = pow.bitLength(); // [5^i / 2^j] = [5^i / 2^(ceil(log_2(5^i)) - POW5_BITCOUNT)] // By construction, this will have exactly POW5_BITCOUNT bits. Note that this can shift left if j is negative! BigInteger pow5DivPow2 = pow.shiftRight(pow5len - POW5_BITCOUNT); if (pow5DivPow2.bitLength() != POW5_BITCOUNT) { throw new IllegalStateException("Unexpected result length: " + pow5DivPow2.bitLength() + " != " + POW5_BITCOUNT); } return pow5DivPow2; } private static int pow5bits(int e) { return ((e * 1217359) >> 19) + 1; } private static void printTable(String name, BigInteger[] table, int entriesPerLine) { System.out.println("static const uint64_t " + name + "[" + table.length + "][2] = {"); for (int i = 0; i < table.length; i++) { BigInteger pow5High = table[i].shiftRight(64); BigInteger pow5Low = table[i].and(MASK64); if (i % entriesPerLine == 0) { System.out.print(" "); } else { System.out.print(" "); } System.out.printf("{ %20su, %18su }", pow5Low, pow5High); if (i != table.length - 1) { System.out.print(","); } if (i % entriesPerLine == entriesPerLine - 1) { System.out.println(); } } System.out.println("};"); } private static void printOffsets(String name, int[] table, int entriesPerLine) { int length = (table.length + 15) / 16; System.out.println("static const uint32_t " + name + "[" + length + "] = {"); for (int i = 0; i < length; i++) { int value = 0; for (int j = 0; j < 16; j++) { int offset = i * 16 + j < table.length ? table[i * 16 + j] : 0; value |= offset << (j << 1); } if (i % entriesPerLine == 0) { System.out.print(" "); } else { System.out.print(" "); } System.out.printf("0x%08x", Integer.valueOf(value)); if (i != length - 1) { System.out.print(","); } if ((i % entriesPerLine == entriesPerLine - 1) || (i == length - 1)) { System.out.println(); } } System.out.println("};"); } }
0
repos/ryu/src/main/java/info/adams/ryu
repos/ryu/src/main/java/info/adams/ryu/analysis/RandomizedDoubleComparison.java
// Copyright 2018 Ulf Adams // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package info.adams.ryu.analysis; import info.adams.random.MersenneTwister; import info.adams.ryu.RyuDouble; /** * Pseud-randomized tests the fast implementation of Ryu against the slow one. */ public class RandomizedDoubleComparison { public static void main(String[] args) { checkDoubleFastAgainstSlow(); } private static void checkDoubleFastAgainstSlow() { MersenneTwister twister = new MersenneTwister(12345); // Warm up the JIT. for (int i = 0; i < 10000000; i++) { long r = twister.nextLong(); double d = Double.longBitsToDouble(r); String expected = RyuDouble.doubleToString(d); String actual = SlowConversion.doubleToString(d); if (!expected.equals(actual)) { System.out.println(String.format("expected %s, but was %s", expected, actual)); throw new RuntimeException(String.format("expected %s, but was %s", expected, actual)); } if (i % 1000 == 0) { System.out.print("."); } } System.out.println(); } }
0
repos/ryu/src/main/java/info/adams/ryu
repos/ryu/src/main/java/info/adams/ryu/analysis/ComputeRequiredBitSizes.java
// Copyright 2018 Ulf Adams // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package info.adams.ryu.analysis; import java.math.BigInteger; import java.util.EnumSet; /** * Computes appropriate values for B_0 and B_1 for a given floating point type. */ public final class ComputeRequiredBitSizes { private static final BigInteger FIVE = BigInteger.valueOf(5); private static final BigInteger TWO = BigInteger.valueOf(2); private static final long LOG10_5_DENOMINATOR = 10000000L; private static final long LOG10_5_NUMERATOR = (long) (LOG10_5_DENOMINATOR * Math.log10(5)); private static final long LOG10_2_DENOMINATOR = 10000000L; private static final long LOG10_2_NUMERATOR = (long) (LOG10_2_DENOMINATOR * Math.log10(2)); public static void main(String[] args) { boolean verbose = false; EnumSet<FloatingPointFormat> formats = EnumSet.noneOf(FloatingPointFormat.class); formats.add(FloatingPointFormat.FLOAT16); formats.add(FloatingPointFormat.FLOAT32); formats.add(FloatingPointFormat.FLOAT64); for (String s : args) { if ("-80".equals(s)) { formats.add(FloatingPointFormat.FLOAT80); } else if ("-128".equals(s)) { formats.add(FloatingPointFormat.FLOAT128); } else if ("-256".equals(s)) { formats.add(FloatingPointFormat.FLOAT256); } else if ("-v".equals(s)) { verbose = true; } } for (FloatingPointFormat format : formats) { compute(format, verbose); } } private static void compute(FloatingPointFormat format, boolean verbose) { int mbits = format.mantissaBits() + 3; int minE2 = 0; int maxE2 = -(1 - format.bias() - format.mantissaBits() - 2); int b1 = 0; for (int e2 = minE2; e2 < maxE2 + 1; e2++) { int q = Math.max(0, (int) (e2 * LOG10_5_NUMERATOR / LOG10_5_DENOMINATOR) - 1); int i = e2 - q; BigInteger pow5 = FIVE.pow(i); BigInteger pow2 = BigInteger.ONE.shiftLeft(q); // max(w) = 4 * ((1 << format.mantissaBits()) * 2 - 1) + 2 // = (1 << (format.mantissaBits() + 3)) - 2 BigInteger mxM = BigInteger.ONE.shiftLeft(mbits).subtract(TWO); BigInteger min = EuclidMinMax.min(pow5, pow2, mxM.subtract(BigInteger.ONE)); // BigInteger min2 = minSlow(pow5, pow2, mxM); // if (!min.equals(min2)) { // new IllegalStateException(min + " " + min2).printStackTrace(System.out); // } int bits = min.divide(mxM).bitLength(); int reqn = pow5.bitLength() - bits; b1 = Math.max(b1, reqn); if (verbose) { System.out.printf("%s,%s,%s,%s,%s,%s,%.2f%%\n", Integer.valueOf(e2), Integer.valueOf(q), Integer.valueOf(i), Integer.valueOf(bits), Integer.valueOf(reqn), Integer.valueOf(b1), Double.valueOf((100.0 * e2) / maxE2)); } } if (verbose) { System.out.println("B_1 = " + b1); } minE2 = 0; maxE2 = ((1 << format.exponentBits()) - 2) - format.bias() - format.mantissaBits() - 2; int b0 = 0; for (int e2 = minE2; e2 < maxE2 + 1; e2++) { int q = Math.max(0, (int) (e2 * LOG10_2_NUMERATOR / LOG10_2_DENOMINATOR) - 1); BigInteger pow5 = FIVE.pow(q); BigInteger pow2 = BigInteger.ONE.shiftLeft(e2 - q); // max(w) = 4 * ((1 << format.mantissaBits()) * 2 - 1) + 2 // = (1 << (format.mantissaBits() + 3)) - 2 BigInteger mxM = BigInteger.ONE.shiftLeft(mbits).subtract(TWO); BigInteger max = EuclidMinMax.max(pow2, pow5, mxM.subtract(BigInteger.ONE)); // BigInteger max2 = maxSlow(pow2, pow5, mxM); // if (!max.equals(max2)) { // new IllegalStateException(max + " " + max2).printStackTrace(System.out); // } BigInteger num = mxM.multiply(pow5).multiply(pow2); BigInteger den = pow5.subtract(max); int bits = num.divide(den).bitLength(); int reqn = bits - pow5.bitLength(); b0 = Math.max(b0, reqn); if (verbose) { System.out.printf("%s,%s,%s,%s,%s,%s,%.2f%%\n", Integer.valueOf(e2), Integer.valueOf(q), Integer.valueOf(e2 - q), Integer.valueOf(bits), Integer.valueOf(reqn), Integer.valueOf(b0), Double.valueOf((100.0 * e2) / maxE2)); } } if (verbose) { System.out.println("B_0 = " + b0); System.out.println(); } System.out.printf("%s,%d,%d\n", format, Integer.valueOf(b0), Integer.valueOf(b1)); } }
0
repos/ryu/src/main/java/info/adams/ryu
repos/ryu/src/main/java/info/adams/ryu/analysis/SlowConversion.java
// Copyright 2018 Ulf Adams // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package info.adams.ryu.analysis; import java.math.BigInteger; import info.adams.ryu.RoundingMode; /** * Implementation of Float and Double to String conversion. */ public final class SlowConversion { private static final BigInteger TWO = BigInteger.valueOf(2); private static boolean DEBUG = false; private static final boolean DEBUG_FLOAT = true; public static void main(String[] args) { DEBUG = true; if (DEBUG_FLOAT) { float f = 0.33007812f; String result = floatToString(f); System.out.println(result + " " + f); } else { double f = 1.1873267205539228E-308; String result = doubleToString(f); System.out.println(result + " " + f); } } public static String floatToString(float value) { return floatToString(value, RoundingMode.ROUND_EVEN); } public static String floatToString(float value, RoundingMode roundingMode) { if (DEBUG) System.out.println("VALUE="+value); long bits = Float.floatToIntBits(value) & 0xffffffffL; return asString(bits, FloatingPointFormat.FLOAT32, roundingMode); } public static String doubleToString(double value) { return doubleToString(value, RoundingMode.ROUND_EVEN); } public static String doubleToString(double value, RoundingMode roundingMode) { if (DEBUG) System.out.println("VALUE="+value); long bits = Double.doubleToLongBits(value); return asString(bits, FloatingPointFormat.FLOAT64, roundingMode); } static String asString(long bits, FloatingPointFormat format, RoundingMode mode) { // Step 1: Decode the floating point number, and unify normalized and subnormal cases. // // The format of all IEEE numbers is S E* M*; we obtain M by masking the lower M bits, E by // shifting and masking, and S also by shifting and masking. int mantissaBits = format.mantissaBits(); int exponentBits = format.exponentBits(); int ieeeExponent = (int) ((bits >>> mantissaBits) & ((1 << exponentBits) - 1)); long ieeeMantissa = bits & ((1L << mantissaBits) - 1); boolean sign = ((bits >>> (mantissaBits + exponentBits)) & 1) != 0; boolean even = (bits & 1) == 0; // Exit early if it's NaN, Infinity, or 0. if (ieeeExponent == ((1 << exponentBits) - 1)) { // Handle the special cases where the exponent is all 1s indicating NaN or Infinity: if the // mantissa is non-zero, it's a NaN, otherwise it's +/-infinity. return (ieeeMantissa != 0) ? "NaN" : sign ? "-Infinity" : "Infinity"; } else if ((ieeeExponent == 0) && (ieeeMantissa == 0)) { // If the mantissa is 0, the code below would end up with a lower bound that is less than 0, // which throws off the char-by-char comparison. Instead, we exit here with the correct // string. return sign ? "-0.0" : "0.0"; } // Compute the offset used by the IEEE format. int offset = (1 << (exponentBits - 1)) - 1; // Unify normalized and subnormal cases. int e2; long m2; if (ieeeExponent == 0) { e2 = 1 - offset - mantissaBits; m2 = ieeeMantissa; } else { e2 = ieeeExponent - offset - mantissaBits; m2 = ieeeMantissa | (1L << mantissaBits); } // Step 2: Determine the interval of legal decimal representations. long mv = 4 * m2; long mp = 4 * m2 + 2; long mm = 4 * m2 - (((m2 != (1L << mantissaBits)) || (ieeeExponent <= 1)) ? 2 : 1); e2 -= 2; // Step 3: Convert to a decimal power base using arbitrary-precision arithmetic. BigInteger vr, vp, vm; int e10; if (e2 >= 0) { vr = BigInteger.valueOf(mv).shiftLeft(e2); vp = BigInteger.valueOf(mp).shiftLeft(e2); vm = BigInteger.valueOf(mm).shiftLeft(e2); e10 = 0; } else { BigInteger factor = BigInteger.valueOf(5).pow(-e2); vr = BigInteger.valueOf(mv).multiply(factor); vp = BigInteger.valueOf(mp).multiply(factor); vm = BigInteger.valueOf(mm).multiply(factor); e10 = e2; } // Step 4: Find the shortest decimal representation in the interval of legal representations. // // We do some extra work here in order to follow Float/Double.toString semantics. In particular, // that requires printing in scientific format if and only if the exponent is between -3 and 7, // and it requires printing at least two decimal digits. // // Above, we moved the decimal dot all the way to the right, so now we need to count digits to // figure out the correct exponent for scientific notation. int vpLength = vp.toString().length(); e10 += vpLength - 1; boolean scientificNotation = (e10 < -3) || (e10 >= 7); if (DEBUG) { System.out.println("IN=" + Long.toBinaryString(bits)); System.out.println(" S=" + (sign ? "-" : "+") + " E=" + e2 + " M=" + m2); System.out.println("E ="+e10); System.out.println("V+="+vp); System.out.println("V ="+vr); System.out.println("V-="+vm); } if (!mode.acceptUpperBound(even)) { vp = vp.subtract(BigInteger.ONE); } boolean vmIsTrailingZeros = true; // Track if vr is tailing zeroes _after_ lastRemovedDigit. boolean vrIsTrailingZeros = true; int removed = 0; int lastRemovedDigit = 0; while (!vp.divide(BigInteger.TEN).equals(vm.divide(BigInteger.TEN))) { if (scientificNotation && vp.compareTo(BigInteger.valueOf(100)) < 0) { // Float/Double.toString semantics requires printing at least two digits. break; } vmIsTrailingZeros &= vm.mod(BigInteger.TEN).intValueExact() == 0; vrIsTrailingZeros &= lastRemovedDigit == 0; lastRemovedDigit = vr.mod(BigInteger.TEN).intValueExact(); vp = vp.divide(BigInteger.TEN); vr = vr.divide(BigInteger.TEN); vm = vm.divide(BigInteger.TEN); removed++; } if (vmIsTrailingZeros && mode.acceptLowerBound(even)) { while (vm.mod(BigInteger.TEN).intValueExact() == 0) { if (scientificNotation && vp.compareTo(BigInteger.valueOf(100)) < 0) { // Float/Double.toString semantics requires printing at least two digits. break; } vrIsTrailingZeros &= lastRemovedDigit == 0; lastRemovedDigit = vr.mod(BigInteger.TEN).intValueExact(); vp = vp.divide(BigInteger.TEN); vr = vr.divide(BigInteger.TEN); vm = vm.divide(BigInteger.TEN); removed++; } } if (vrIsTrailingZeros && (lastRemovedDigit == 5) && (vr.mod(TWO).intValueExact() == 0)) { // Round down not up if the number ends in X50000 and the number is even. lastRemovedDigit = 4; } String output = ((vr.compareTo(vm) > 0) ? (lastRemovedDigit >= 5 ? vr.add(BigInteger.ONE) : vr) : vp).toString(); int olength = vpLength - removed; if (DEBUG) { System.out.println("LRD=" + lastRemovedDigit); System.out.println("VP=" + vp); System.out.println("VR=" + vr); System.out.println("VM=" + vm); System.out.println("O=" + output); System.out.println("OLEN=" + olength); System.out.println("EXP=" + e10); } // Step 5: Print the decimal representation. // We follow Float/Double.toString semantics here. StringBuilder result = new StringBuilder(); // Add the minus sign if the number is negative. if (sign) { result.append('-'); } if (scientificNotation) { result.append(output.charAt(0)); result.append('.'); for (int i = 1; i < olength; i++) { result.append(output.charAt(i)); } if (olength == 1) { result.append('0'); } result.append('E'); result.append(e10); return result.toString(); } else { // Print leading 0s and '.' if applicable. for (int i = 0; i > e10; i--) { result.append('0'); if (i == 0) { result.append("."); } } // Print number and '.' if applicable. for (int i = 0; i < olength; i++) { result.append(output.charAt(i)); if (e10 == 0) { result.append('.'); } e10--; } // Print trailing 0s and '.' if applicable. for (; e10 >= -1; e10--) { result.append('0'); if (e10 == 0) { result.append('.'); } } return result.toString(); } } }
0
repos/ryu/src/main/java/info/adams/ryu
repos/ryu/src/main/java/info/adams/ryu/analysis/ExtensiveDoubleComparison.java
// Copyright 2018 Ulf Adams // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package info.adams.ryu.analysis; import info.adams.ryu.RyuDouble; /** * Extensively tests the fast implementation of Ryu against the slow one. */ public class ExtensiveDoubleComparison { public static void main(String[] args) { checkDoubleFastAgainstSlow(); } private static void checkDoubleFastAgainstSlow() { System.out.println("This checks every possible 64-bit floating point value - interrupt when you are satisfied."); long stride = 1000000000000000L; for (long base = 0; base < stride; base++) { for (long l = base; l <= 0x7fffffffffffffffL - stride + 1; l += stride) { double d = Double.longBitsToDouble(l); String expected = RyuDouble.doubleToString(d); String actual = SlowConversion.doubleToString(d); if (!expected.equals(actual)) { System.out.println(String.format("expected %s, but was %s", expected, actual)); throw new RuntimeException(String.format("expected %s, but was %s", expected, actual)); } } double frac = (base + 1) / (double) stride; System.out.printf("(%16.12f%%)\n", Double.valueOf(100 * frac)); } } }
0
repos/ryu/src/main/java/info/adams/ryu
repos/ryu/src/main/java/info/adams/ryu/analysis/FindDifferences.java
// Copyright 2018 Ulf Adams // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package info.adams.ryu.analysis; import java.math.BigInteger; import org.yuanheng.cookjson.DoubleUtils; import info.adams.random.MersenneTwister; import info.adams.ryu.RoundingMode; import info.adams.ryu.RyuDouble; /** * A few tests to check that {@link DoubleUtils} isn't completely broken. * * <p>Note that the implementation does not follow Java {@link Double#toString} semantics, so we * can't run the existing double-to-string tests against it. */ public class FindDifferences { private static final int DOUBLE_MANTISSA_BITS = 52; private static final long DOUBLE_MANTISSA_MASK = (1L << DOUBLE_MANTISSA_BITS) - 1; private static final int DOUBLE_EXPONENT_BITS = 11; private static final int DOUBLE_EXPONENT_MASK = (1 << DOUBLE_EXPONENT_BITS) - 1; private static final int DOUBLE_EXPONENT_BIAS = (1 << (DOUBLE_EXPONENT_BITS - 1)) - 1; private enum Mode { SUMMARY, LATEX, CSV; } public static void main(String[] args) { Mode mode = Mode.SUMMARY; for (String s : args) { if (s.startsWith("-mode=")) { String modeName = s.substring(6); switch (modeName) { case "summary": mode = Mode.SUMMARY; break; case "latex": mode = Mode.LATEX; break; case "csv": mode = Mode.CSV; break; } } } if (mode == Mode.CSV) { System.out.println("compared_to,ryu_output,other_output,exact_lower_bound,exact_value,exact_upper_bound"); } compareWithJaffer(mode); compareWithJdk(mode); } private static void compareWithJaffer(Mode mode) { MersenneTwister rand = new MersenneTwister(12345); int toolong = 0; for (int i = 0; i < 1000000; i++) { double value = Double.longBitsToDouble(rand.nextLong()); if ((Math.abs(value) >= 1E-3) && (Math.abs(value) <= 1E7)) { // We ignore differences in the range 1e-3 to 1e7. continue; } String a = DoubleUtils.toString(value); String b = RyuDouble.doubleToString(value, RoundingMode.ROUND_EVEN); if (a.length() > b.length()) { if (toolong < 20 || mode == Mode.CSV) { // Only print the first 20. printComparison(value, b, a, mode, "Jaffer"); } toolong++; } } if (mode != Mode.CSV) { System.out.println("Jaffer: " + toolong + " / " + 100000 + " are longer"); } } private static void compareWithJdk(Mode mode) { MersenneTwister rand = new MersenneTwister(12345); int toolong = 0; for (int i = 0; i < 1000000; i++) { double value = Double.longBitsToDouble(rand.nextLong()); String a = Double.toString(value); // All of the longer strings from the JDK end in E{16,17,18}. // if (a.endsWith("E16") || a.endsWith("E17") || a.endsWith("E18")) { // continue; // } // We're nice and compare with the CONSERVATIVE rounding mode here. String b = RyuDouble.doubleToString(value, RoundingMode.CONSERVATIVE); if (a.length() > b.length()) { if (toolong < 20 || mode == Mode.CSV) { // Only print the first 20. printComparison(value, b, a, mode, "Jdk"); } toolong++; } } if (mode != Mode.CSV) { System.out.println("Jdk: " + toolong + " / " + 100000 + " are longer"); } } private static void printComparison(double value, String ryuOutput, String candidate, Mode mode, String area) { if (Double.isNaN(value)) return; if (value == Float.POSITIVE_INFINITY) return; if (value == Float.NEGATIVE_INFINITY) return; long bits = Double.doubleToLongBits(value); if (bits == 0) return; if (bits == 0x80000000) return; int ieeeExponent = (int) ((bits >>> DOUBLE_MANTISSA_BITS) & DOUBLE_EXPONENT_MASK); long ieeeMantissa = bits & DOUBLE_MANTISSA_MASK; int e2; long m2; if (ieeeExponent == 0) { // Denormal number - no implicit leading 1, and the exponent is 1, not 0. e2 = 1 - DOUBLE_EXPONENT_BIAS - DOUBLE_MANTISSA_BITS; m2 = ieeeMantissa; } else { // Add implicit leading 1. e2 = ieeeExponent - DOUBLE_EXPONENT_BIAS - DOUBLE_MANTISSA_BITS; m2 = ieeeMantissa | (1L << DOUBLE_MANTISSA_BITS); } long mv = 4 * m2; long mp = 4 * m2 + 2; long mm = 4 * m2 - (((m2 != (1L << DOUBLE_MANTISSA_BITS)) || (ieeeExponent <= 1)) ? 2 : 1); e2 -= 2; BigInteger vr, vp, vm; int e10; if (e2 >= 0) { vr = BigInteger.valueOf(mv).shiftLeft(e2); vp = BigInteger.valueOf(mp).shiftLeft(e2); vm = BigInteger.valueOf(mm).shiftLeft(e2); e10 = 0; } else { BigInteger factor = BigInteger.valueOf(5).pow(-e2); vr = BigInteger.valueOf(mv).multiply(factor); vp = BigInteger.valueOf(mp).multiply(factor); vm = BigInteger.valueOf(mm).multiply(factor); e10 = e2; } e10 += vp.toString().length() - 1; String vms = vm.toString().replaceAll("^(.)", "$1."); String vrs = vr.toString().replaceAll("^(.)", "$1."); String vps = vp.toString().replaceAll("^(.)", "$1."); if (mode == Mode.LATEX) { int maxLen = 24; if (vps.length() > maxLen) { vms = vms.substring(0, Math.min(maxLen, vms.length())) + "..."; vrs = vrs.substring(0, Math.min(maxLen, vrs.length())) + "..."; vps = vps.substring(0, Math.min(maxLen, vps.length())) + "..."; } System.out.printf("\\texttt{0x%s} & ", Long.toHexString(bits)); System.out.printf("$\\texttt{%s} * 10^{%s}$ & ", vms, Integer.valueOf(e10)); System.out.printf("$\\texttt{%s}$ (our) \\\\\n", SlowConversion.doubleToString(value)); System.out.printf(" & "); System.out.printf("$\\texttt{%s} * 10^{%s}$ & ", vrs, Integer.valueOf(e10)); System.out.printf("$\\texttt{%s}$ (%s) \\\\\n", candidate, "OpenJDK"); System.out.printf(" & "); System.out.printf("$\\texttt{%s} * 10^{%s}$ ", vps, Integer.valueOf(e10)); System.out.printf("& \\\\ \\hline\n"); } else if (mode == Mode.CSV) { System.out.println(area + "," + ryuOutput + "," + candidate + "," + vms + "," + vrs + "," + vps); } } }
0
repos/ryu/src/main/java/info/adams/ryu
repos/ryu/src/main/java/info/adams/ryu/analysis/FloatingPointFormat.java
// Copyright 2018 Ulf Adams // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package info.adams.ryu.analysis; enum FloatingPointFormat { FLOAT16(16, 5, 10), FLOAT32(32, 8, 23), FLOAT64(64, 11, 52), FLOAT80(80, 15, 63), FLOAT128(128, 15, 112), FLOAT256(256, 19, 236); private final int totalBits; private final int exponentBits; private final int mantissaBits; private FloatingPointFormat(int totalBits, int exponentBits, int mantissaBits) { this.totalBits = totalBits; this.exponentBits = exponentBits; this.mantissaBits = mantissaBits; } public int totalBits() { return totalBits; } public int exponentBits() { return exponentBits; } public int mantissaBits() { return mantissaBits; } public int bias() { return (1 << (exponentBits - 1)) - 1; } }
0
repos/ryu/src/main/java/info/adams/ryu
repos/ryu/src/main/java/info/adams/ryu/analysis/ExhaustiveFloatComparison.java
// Copyright 2018 Ulf Adams // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package info.adams.ryu.analysis; import info.adams.ryu.RyuFloat; /** * Exhaustively tests the fast implementation of Ryu against the slow one. */ public class ExhaustiveFloatComparison { public static void main(String[] args) { System.out.println("This checks every possible 32-bit floating point value, which takes ~60 hours."); System.out.println("We report progress approximately every ~10 seconds."); long stride = 10007L; // 10007 is prime // We go through the set of all possible values in stride-sized steps, and go through all // possible [0,stride) offsets. This gives us good coverage across the whole range of floating // point numbers even in the first loop, which quickly finds systematic errors. We use a prime // to avoid bit patterns in the floating point number. // // We also don't check any negative numbers; we assume that the code behaves identically. for (long base = 0; base < stride; base++) { for (long l = base; l <= 0x7fffffffL; l += stride) { float f = Float.intBitsToFloat((int) l); String expected = SlowConversion.floatToString(f); String actual = RyuFloat.floatToString(f); if (!expected.equals(actual)) { System.out.println(String.format("expected %s, but was %s", expected, actual)); throw new RuntimeException(String.format("expected %s, but was %s", expected, actual)); } // Also check round-trip safety. long g = Float.floatToRawIntBits(Float.parseFloat(actual)) & 0xffffffffL; if (!Float.isNaN(f) && g != l) { String message = String.format("expected %d, but was %d", Long.valueOf(l), Long.valueOf(g)); System.out.println(message); throw new RuntimeException(message); } } double frac = (base + 1) / (double) stride; System.out.printf("(%6.2f%%)\n", Double.valueOf(100 * frac)); } } }
0
repos/ryu/src/main/java/info/adams/ryu
repos/ryu/src/main/java/info/adams/ryu/benchmark/BenchmarkMain.java
// Copyright 2018 Ulf Adams // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package info.adams.ryu.benchmark; import org.yuanheng.cookjson.DoubleUtils; import info.adams.random.MersenneTwister; import info.adams.ryu.RyuDouble; import info.adams.ryu.RyuFloat; public class BenchmarkMain { public static void main(String[] args) { boolean run32 = true; boolean run64 = true; int samples = 1000; int iterations = 1000; boolean verbose = false; for (String s : args) { if (s.equals("-32")) { run32 = true; run64 = false; } else if (s.equals("-64")) { run32 = false; run64 = true; } else if (s.equals("-v")) { verbose = true; } else if (s.startsWith("-samples=")) { samples = Integer.parseInt(s.substring(9)); } else if (s.startsWith("-iterations=")) { iterations = Integer.parseInt(s.substring(12)); } } if (verbose) { System.out.println("output_ryu,float_bits_as_int,ryu_time_in_ns,jdk_time_in_ns,jaffer_time_in_ns"); } else { System.out.printf(" Average & Stddev Ryu Average & Stddev Jdk Average & Stddev Jaffer\n"); } int throwaway = 0; if (run32) { throwaway += bench32(samples, iterations, verbose); } if (run64) { throwaway += bench64(samples, iterations, verbose); } if (args.length == 1000) { // Prevent the compiler from optimizing the code away. Technically, the // JIT could see that args.length != 1000, but it seems unlikely. System.err.println(throwaway); } } private static int bench32(int samples, int iterations, boolean verbose) { MersenneTwister twister = new MersenneTwister(12345); // Warm up the JIT. MeanAndVariance warmUp = new MeanAndVariance(); for (int i = 0; i < 1000; i++) { System.gc(); System.gc(); int r = twister.nextInt(); float f = Float.intBitsToFloat(r); long start = System.nanoTime(); for (int j = 0; j < 100; j++) { RyuFloat.floatToString(f).length(); } for (int j = 0; j < 100; j++) { Float.toString(f).length(); } long stop = System.nanoTime(); warmUp.update((stop - start) / 100.0); } MeanAndVariance mv1 = new MeanAndVariance(); MeanAndVariance mv2 = new MeanAndVariance(); twister.setSeed(12345); // We track some value computed from the result of the conversion to make sure that the // compiler does not eliminate the conversion due to the result being otherwise unused. int throwaway = 0; for (int i = 0; i < samples; i++) { System.gc(); System.gc(); int r = twister.nextInt(); float f = Float.intBitsToFloat(r); long start = System.nanoTime(); for (int j = 0; j < iterations; j++) { throwaway += RyuFloat.floatToString(f).length(); } long stop = System.nanoTime(); double delta1 = (stop - start) / (double) iterations; mv1.update(delta1); System.gc(); System.gc(); start = System.nanoTime(); for (int j = 0; j < iterations; j++) { throwaway += Float.toString(f).length(); } stop = System.nanoTime(); double delta2 = (stop - start) / (double) iterations; mv2.update(delta2); if (verbose) { System.out.printf( "%s,%s,%s,%s,\n", RyuFloat.floatToString(f), Integer.toUnsignedString(r), Double.valueOf(delta1), Double.valueOf(delta2)); } } if (!verbose) { System.out.printf("32: %8.3f %8.3f %8.3f %8.3f\n", Double.valueOf(mv1.mean()), Double.valueOf(mv1.stddev()), Double.valueOf(mv2.mean()), Double.valueOf(mv2.stddev())); } return throwaway; } private static int bench64(int samples, int iterations, boolean verbose) { MersenneTwister twister = new MersenneTwister(12345); // Warm up the JIT. MeanAndVariance warmUp = new MeanAndVariance(); for (int i = 0; i < 1000; i++) { System.gc(); System.gc(); long r = twister.nextLong(); double f = Double.longBitsToDouble(r); long start = System.nanoTime(); for (int j = 0; j < 100; j++) { RyuDouble.doubleToString(f).length(); } for (int j = 0; j < 100; j++) { Double.toString(f).length(); } for (int j = 0; j < 100; j++) { DoubleUtils.toString(f).length(); } long stop = System.nanoTime(); warmUp.update((stop - start) / 100.0); } MeanAndVariance mv1 = new MeanAndVariance(); MeanAndVariance mv2 = new MeanAndVariance(); MeanAndVariance mv3 = new MeanAndVariance(); twister.setSeed(12345); // We track some value computed from the result of the conversion to make sure that the // compiler does not eliminate the conversion due to the result being otherwise unused. int throwaway = 0; for (int i = 0; i < samples; i++) { System.gc(); System.gc(); long r = twister.nextLong(); double f = Double.longBitsToDouble(r); long start = System.nanoTime(); for (int j = 0; j < iterations; j++) { throwaway += RyuDouble.doubleToString(f).length(); } long stop = System.nanoTime(); double delta1 = (stop - start) / (double) iterations; mv1.update(delta1); System.gc(); System.gc(); start = System.nanoTime(); for (int j = 0; j < iterations; j++) { throwaway += Double.toString(f).length(); } stop = System.nanoTime(); double delta2 = (stop - start) / (double) iterations; mv2.update(delta2); System.gc(); System.gc(); start = System.nanoTime(); for (int j = 0; j < iterations; j++) { throwaway += DoubleUtils.toString(f).length(); } stop = System.nanoTime(); double delta3 = (stop - start) / (double) iterations; mv3.update(delta3); if (verbose) { System.out.printf( "%s,%s,%s,%s,%s\n", RyuDouble.doubleToString(f), Long.toUnsignedString(r), Double.valueOf(delta1), Double.valueOf(delta2), Double.valueOf(delta3)); } } if (!verbose) { System.out.printf("64: %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f\n", Double.valueOf(mv1.mean()), Double.valueOf(mv1.stddev()), Double.valueOf(mv2.mean()), Double.valueOf(mv2.stddev()), Double.valueOf(mv3.mean()), Double.valueOf(mv3.stddev())); } return throwaway; } }
0
repos/ryu/src/main/java/info/adams/ryu
repos/ryu/src/main/java/info/adams/ryu/benchmark/MeanAndVariance.java
// Copyright 2018 Ulf Adams // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package info.adams.ryu.benchmark; final class MeanAndVariance { private long n; private double mean; private double m2; public MeanAndVariance() { } public void update(double x) { n++; double d = x - mean; mean += d / n; double d2 = x - mean; m2 += d * d2; } public double mean() { return mean; } public double variance() { return m2 / (n - 1); } public double stddev() { return Math.sqrt(variance()); } }
0
repos/ryu/src/test/java/info/adams
repos/ryu/src/test/java/info/adams/ryu/DoubleToStringTest.java
// Copyright 2018 Ulf Adams // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package info.adams.ryu; import static org.junit.Assert.assertEquals; import org.junit.Test; public abstract class DoubleToStringTest { abstract String f(double f, RoundingMode roundingMode); private void assertD2sEquals(String expected, double f) { assertEquals(expected, f(f, RoundingMode.ROUND_EVEN)); assertEquals(expected, f(f, RoundingMode.CONSERVATIVE)); } private void assertD2sEquals(String expectedRoundEven, String expectedConservative, double f) { assertEquals(expectedRoundEven, f(f, RoundingMode.ROUND_EVEN)); assertEquals(expectedConservative, f(f, RoundingMode.CONSERVATIVE)); } @Test public void simpleCases() { assertD2sEquals("0.0", 0); assertD2sEquals("-0.0", Double.longBitsToDouble(0x8000000000000000L)); assertD2sEquals("1.0", 1.0d); assertD2sEquals("-1.0", -1.0d); assertD2sEquals("NaN", Double.NaN); assertD2sEquals("Infinity", Double.POSITIVE_INFINITY); assertD2sEquals("-Infinity", Double.NEGATIVE_INFINITY); } @Test public void switchToSubnormal() { assertD2sEquals("2.2250738585072014E-308", Double.longBitsToDouble(0x0010000000000000L)); } /** * Floating point values in the range 1.0E-3 <= x < 1.0E7 have to be printed * without exponent. This test checks the values at those boundaries. */ @Test public void boundaryConditions() { // x = 1.0E7 assertD2sEquals("1.0E7", 1.0E7d); // x < 1.0E7 assertD2sEquals("9999999.999999998", 9999999.999999998d); // x = 1.0E-3 assertD2sEquals("0.001", 0.001d); // x < 1.0E-3 assertD2sEquals("9.999999999999998E-4", 0.0009999999999999998d); } @Test public void minAndMax() { assertD2sEquals("1.7976931348623157E308", Double.longBitsToDouble(0x7fefffffffffffffL)); assertD2sEquals("4.9E-324", Double.longBitsToDouble(1)); } @Test public void roundingModeEven() { assertD2sEquals("-2.109808898695963E16", "-2.1098088986959632E16", -2.109808898695963E16); } @Test public void regressionTest() { assertD2sEquals("4.940656E-318", 4.940656E-318d); assertD2sEquals("1.18575755E-316", 1.18575755E-316d); assertD2sEquals("2.989102097996E-312", 2.989102097996E-312d); assertD2sEquals("9.0608011534336E15", 9.0608011534336E15d); assertD2sEquals("4.708356024711512E18", 4.708356024711512E18); assertD2sEquals("9.409340012568248E18", 9.409340012568248E18); // This number naively requires 65 bit for the intermediate results if we reduce the lookup // table by half. This checks that we don't loose any information in that case. assertD2sEquals("1.8531501765868567E21", 1.8531501765868567E21); assertD2sEquals("-3.347727380279489E33", -3.347727380279489E33); // Discovered by Andriy Plokhotnyuk, see #29. assertD2sEquals("1.9430376160308388E16", 1.9430376160308388E16); assertD2sEquals("-6.9741824662760956E19", -6.9741824662760956E19); assertD2sEquals("4.3816050601147837E18", 4.3816050601147837E18); } }
0
repos/ryu/src/test/java/info/adams
repos/ryu/src/test/java/info/adams/ryu/FloatToStringTest.java
// Copyright 2018 Ulf Adams // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package info.adams.ryu; import static org.junit.Assert.assertEquals; import org.junit.Test; public abstract class FloatToStringTest { abstract String f(float f, RoundingMode roundingMode); private void assertF2sEquals(String expected, float f) { assertEquals(expected, f(f, RoundingMode.ROUND_EVEN)); assertEquals(expected, f(f, RoundingMode.CONSERVATIVE)); } private void assertF2sEquals(String expectedRoundEven, String expectedConservative, float f) { assertEquals(expectedRoundEven, f(f, RoundingMode.ROUND_EVEN)); assertEquals(expectedConservative, f(f, RoundingMode.CONSERVATIVE)); } @Test public void simpleCases() { assertF2sEquals("0.0", 0); assertF2sEquals("-0.0", Float.intBitsToFloat(0x80000000)); assertF2sEquals("1.0", 1.0f); assertF2sEquals("-1.0", -1f); assertF2sEquals("NaN", Float.NaN); assertF2sEquals("Infinity", Float.POSITIVE_INFINITY); assertF2sEquals("-Infinity", Float.NEGATIVE_INFINITY); } @Test public void switchToSubnormal() { assertF2sEquals("1.1754944E-38", Float.intBitsToFloat(0x00800000)); } /** * Floating point values in the range 1.0E-3 <= x < 1.0E7 have to be printed * without exponent. This test checks the values at those boundaries. */ @Test public void boundaryConditions() { // x = 1.0E7 assertF2sEquals("1.0E7", 1.0E7f); // x < 1.0E7 assertF2sEquals("9999999.0", 9999999.0f); // x = 1.0E-3 assertF2sEquals("0.001", 0.001f); // x < 1.0E-3 assertF2sEquals("9.999999E-4", 0.0009999999f); } @Test public void minAndMax() { assertF2sEquals("3.4028235E38", Float.intBitsToFloat(0x7f7fffff)); assertF2sEquals("1.4E-45", Float.intBitsToFloat(0x00000001)); } @Test public void roundingModeEven() { assertF2sEquals("3.355445E7", "3.3554448E7", 3.3554448E7f); assertF2sEquals("9.0E9", "8.999999E9", 8.999999E9f); assertF2sEquals("3.436672E10", "3.4366718E10", 3.4366717E10f); } @Test public void roundingEvenIfTied() { assertF2sEquals("0.33007812", 0.33007812f); } @Test public void looksLikePow5() { // These are all floating point numbers where the mantissa is a power of 5, // and the exponent is in the range such that q = 10. assertF2sEquals("6.7108864E17", Float.intBitsToFloat(0x5D1502F9)); assertF2sEquals("1.3421773E18", Float.intBitsToFloat(0x5D9502F9)); assertF2sEquals("2.6843546E18", Float.intBitsToFloat(0x5E1502F9)); } @Test public void regressionTest() { assertF2sEquals("4.7223665E21", 4.7223665E21f); assertF2sEquals("8388608.0", 8388608.0f); assertF2sEquals("1.6777216E7", 1.6777216E7f); assertF2sEquals("3.3554436E7", 3.3554436E7f); assertF2sEquals("6.7131496E7", 6.7131496E7f); assertF2sEquals("1.9310392E-38", 1.9310392E-38f); assertF2sEquals("-2.47E-43", -2.47E-43f); assertF2sEquals("1.993244E-38", 1.993244E-38f); assertF2sEquals("4103.9004", 4103.9003f); assertF2sEquals("5.3399997E9", 5.3399997E9f); assertF2sEquals("6.0898E-39", 6.0898E-39f); assertF2sEquals("0.0010310042", 0.0010310042f); assertF2sEquals("2.882326E17", 2.8823261E17f); assertF2sEquals("7.038531E-26", 7.038531E-26f); assertF2sEquals("9.223404E17", 9.2234038E17f); assertF2sEquals("6.710887E7", 6.7108872E7f); assertF2sEquals("1.0E-44", 1.0E-44f); assertF2sEquals("2.816025E14", 2.816025E14f); assertF2sEquals("9.223372E18", 9.223372E18f); assertF2sEquals("1.5846086E29", 1.5846085E29f); assertF2sEquals("1.1811161E19", 1.1811161E19f); assertF2sEquals("5.368709E18", 5.368709E18f); assertF2sEquals("4.6143166E18", 4.6143165E18f); assertF2sEquals("0.007812537", 0.007812537f); assertF2sEquals("1.4E-45", 1.4E-45f); assertF2sEquals("1.18697725E20", 1.18697724E20f); assertF2sEquals("1.00014165E-36", 1.00014165E-36f); assertF2sEquals("200.0", 200f); assertF2sEquals("3.3554432E7", 3.3554432E7f); } }
0
repos/ryu/src/test/java/info/adams
repos/ryu/src/test/java/info/adams/ryu/AllTests.java
// Copyright 2018 Ulf Adams // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package info.adams.ryu; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; @RunWith(Suite.class) @SuiteClasses({ EuclidMinMaxTest.class, RyuFloatTest.class, RyuDoubleTest.class, SlowFloatTest.class, SlowDoubleTest.class, JafferDoubleTest.class, }) public class AllTests { }
0
repos/ryu/src/test/java/info/adams
repos/ryu/src/test/java/info/adams/ryu/RyuDoubleTest.java
// Copyright 2018 Ulf Adams // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package info.adams.ryu; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @RunWith(JUnit4.class) public class RyuDoubleTest extends DoubleToStringTest { @Override String f(double f, RoundingMode roundingMode) { return RyuDouble.doubleToString(f, roundingMode); } }
0
repos/ryu/src/test/java/info/adams
repos/ryu/src/test/java/info/adams/ryu/EuclidMinMaxTest.java
package info.adams.ryu; import static org.junit.Assert.assertEquals; import java.math.BigInteger; import java.util.Random; import org.junit.Test; import info.adams.ryu.analysis.EuclidMinMax; public class EuclidMinMaxTest { private static int min(int a, int b, int max) { return EuclidMinMax.min(BigInteger.valueOf(a), BigInteger.valueOf(b), BigInteger.valueOf(max)).intValueExact(); } private static int max(int a, int b, int max) { return EuclidMinMax.max(BigInteger.valueOf(a), BigInteger.valueOf(b), BigInteger.valueOf(max)).intValueExact(); } private static BigInteger minSlow(BigInteger multiplier, BigInteger modulo, BigInteger maximum) { // if (maximum.compareTo(modulo) >= 0) { // return BigInteger.ZERO; // } BigInteger result = multiplier.mod(modulo); for (long l = 2; l <= maximum.longValueExact(); l++) { BigInteger cand = BigInteger.valueOf(l).multiply(multiplier).mod(modulo); if (cand.compareTo(result) < 0) { result = cand; } } return result; } private static BigInteger maxSlow(BigInteger multiplier, BigInteger modulo, BigInteger maximum) { // if (maximum.compareTo(modulo) >= 0) { // return modulo.subtract(BigInteger.ONE); // } BigInteger result = multiplier.mod(modulo); for (long l = 2; l <= maximum.longValueExact(); l++) { BigInteger cand = BigInteger.valueOf(l).multiply(multiplier).mod(modulo); if (cand.compareTo(result) > 0) { result = cand; } } return result; } @Test public void simpleMin() { assertEquals(2, min(2, 10, 1)); assertEquals(2, min(2, 10, 2)); assertEquals(2, min(2, 10, 3)); assertEquals(2, min(2, 10, 4)); assertEquals(0, min(2, 10, 5)); } @Test public void simpleMax() { assertEquals(2, max(2, 10, 1)); assertEquals(4, max(2, 10, 2)); assertEquals(6, max(2, 10, 3)); assertEquals(8, max(2, 10, 4)); assertEquals(8, max(2, 10, 5)); } @Test public void minAgain() { assertEquals(7, min(7, 10, 1)); assertEquals(4, min(7, 10, 2)); assertEquals(1, min(7, 10, 3)); assertEquals(1, min(7, 10, 4)); assertEquals(1, min(7, 10, 5)); assertEquals(1, min(7, 10, 6)); assertEquals(1, min(7, 10, 7)); assertEquals(1, min(7, 10, 8)); assertEquals(1, min(7, 10, 9)); assertEquals(0, min(7, 10, 10)); } @Test public void maxAgain() { assertEquals(7, max(7, 10, 1)); assertEquals(7, max(7, 10, 2)); assertEquals(7, max(7, 10, 3)); assertEquals(8, max(7, 10, 4)); assertEquals(8, max(7, 10, 5)); assertEquals(8, max(7, 10, 6)); assertEquals(9, max(7, 10, 7)); assertEquals(9, max(7, 10, 8)); assertEquals(9, max(7, 10, 9)); assertEquals(9, max(7, 10, 10)); } @Test public void minAgain2() { assertEquals(7, min(7, 30, 1)); assertEquals(7, min(7, 30, 2)); assertEquals(7, min(7, 30, 3)); assertEquals(7, min(7, 30, 4)); assertEquals(5, min(7, 30, 5)); assertEquals(5, min(7, 30, 6)); assertEquals(5, min(7, 30, 7)); assertEquals(5, min(7, 30, 8)); assertEquals(3, min(7, 30, 9)); assertEquals(3, min(7, 30, 10)); } @Test public void compareMin() { Random rand = new Random(1234L); for (int i = 0; i < 10000; i++) { BigInteger a = BigInteger.valueOf(rand.nextInt(500) + 2); BigInteger b = BigInteger.valueOf(rand.nextInt(500) + 2); BigInteger max = BigInteger.valueOf(rand.nextInt(100) + 1); // System.out.println(a + " " + b + " " + max + " " + a.mod(b)); BigInteger minFast = EuclidMinMax.min(a, b, max); BigInteger minSlow = minSlow(a, b, max); assertEquals(minSlow, minFast); } } @Test public void compareMax() { Random rand = new Random(1234L); for (int i = 0; i < 10000; i++) { BigInteger a = BigInteger.valueOf(rand.nextInt(500) + 2); BigInteger b = BigInteger.valueOf(rand.nextInt(500) + 2); BigInteger max = BigInteger.valueOf(rand.nextInt(100) + 1); // System.out.println(a + " " + b + " " + max); BigInteger maxFast = EuclidMinMax.max(a, b, max); BigInteger maxSlow = maxSlow(a, b, max); assertEquals(maxSlow, maxFast); } } }
0
repos/ryu/src/test/java/info/adams
repos/ryu/src/test/java/info/adams/ryu/SlowFloatTest.java
// Copyright 2018 Ulf Adams // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package info.adams.ryu; import info.adams.ryu.analysis.SlowConversion; public class SlowFloatTest extends FloatToStringTest { @Override String f(float f, RoundingMode roundingMode) { return SlowConversion.floatToString(f, roundingMode); } }
0
repos/ryu/src/test/java/info/adams
repos/ryu/src/test/java/info/adams/ryu/JafferDoubleTest.java
// Copyright 2018 Ulf Adams // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package info.adams.ryu; import static org.junit.Assert.assertEquals; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import org.yuanheng.cookjson.DoubleUtils; /** * A few tests to check that {@link DoubleUtils} isn't completely broken. * * <p>Note that the implementation does not follow Java {@link Double#toString} semantics, so we * can't run the existing double-to-string tests against it. */ @RunWith(JUnit4.class) public class JafferDoubleTest { private String f(double f) { return DoubleUtils.toString(f); } @Test public void simpleCases() { assertEquals("0", f(0)); assertEquals("0", f(Double.longBitsToDouble(0x8000000000000000L))); assertEquals("1", f(1.0d)); assertEquals("-1", f(-1.0d)); assertEquals("NaN", f(Double.NaN)); assertEquals("Infinity", f(Double.POSITIVE_INFINITY)); assertEquals("-Infinity", f(Double.NEGATIVE_INFINITY)); } @Test public void switchToSubnormal() { assertEquals("2.2250738585072014e-308", f(Double.longBitsToDouble(0x0010000000000000L))); } @Test public void boundaryConditions() { // x = 1.0E7 assertEquals("10000000", f(1.0E7d)); // x < 1.0E7 assertEquals("9999999", f(9999999d)); // x = 1.0E-3 assertEquals("0.001", f(0.001d)); // x < 1.0E-3 assertEquals("0.0009", f(0.0009d)); } @Test public void regressionTest() { assertEquals("4.940656e-318", f(4.940656E-318d)); assertEquals("1.18575755e-316", f(1.18575755E-316d)); assertEquals("2.989102097996e-312", f(2.989102097996E-312d)); assertEquals("9.0608011534336e15", f(9.0608011534336E15d)); assertEquals("4.708356024711512e18", f(4.708356024711512E18)); assertEquals("9.409340012568248e18", f(9.409340012568248E18)); } }
0
repos/ryu/src/test/java/info/adams
repos/ryu/src/test/java/info/adams/ryu/SlowDoubleTest.java
// Copyright 2018 Ulf Adams // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package info.adams.ryu; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import info.adams.ryu.analysis.SlowConversion; @RunWith(JUnit4.class) public class SlowDoubleTest extends DoubleToStringTest { @Override String f(double f, RoundingMode roundingMode) { return SlowConversion.doubleToString(f, roundingMode); } }
0
repos/ryu/src/test/java/info/adams
repos/ryu/src/test/java/info/adams/ryu/RyuFloatTest.java
// Copyright 2018 Ulf Adams // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package info.adams.ryu; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @RunWith(JUnit4.class) public class RyuFloatTest extends FloatToStringTest { @Override String f(float f, RoundingMode roundingMode) { return RyuFloat.floatToString(f, roundingMode); } }
0
repos
repos/zigXrustXc/README.md
# Performance of Zig vs Rust vs C ## Things to know My CPU is a Amd Ryzen 9 7950x, so results may vary *a lot* on other CPUs. My Rust binary is still pretty small compared to normal Rust binaries, check the [Cargo.toml](./rust/Cargo.toml#L11) file for more info. The C and Rust binaries are dynamically linked, and the Zig binary is statically linked. ## C (clang v15.0.7) Build ```bash clang -Ofast -lm main.c -o sieve ``` Result ```bash time ./sieve 100000000 # 0.33s, 96MB MAX RAM, 16k binary size ``` ## Zig (v0.10.1) Build ```bash zig build -Drelease-fast ``` Result ```bash time ./zig-out/bin/zig 100000000 # 0.44s, 143MB MAX RAM, 25k binary size ``` ## Rust (v1.68.2) Build ```bash cargo build --release ``` Result ```bash time ./target/release/rust 100000000 # 0.47s, 96MB MAX RAM, 293k binary size ```
0
repos/zigXrustXc
repos/zigXrustXc/zig/build.zig
const std = @import("std"); pub fn build(b: *std.build.Builder) void { // Standard target options allows the person running `zig build` to choose // what target to build for. Here we do not override the defaults, which // means any target is allowed, and the default is native. Other options // for restricting supported target set are available. const target = b.standardTargetOptions(.{}); // Standard release options allow the person running `zig build` to select // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. const mode = b.standardReleaseOptions(); const exe = b.addExecutable("zig", "src/main.zig"); exe.setTarget(target); exe.setBuildMode(mode); exe.strip = true; exe.install(); const run_cmd = exe.run(); run_cmd.step.dependOn(b.getInstallStep()); if (b.args) |args| { run_cmd.addArgs(args); } const run_step = b.step("run", "Run the app"); run_step.dependOn(&run_cmd.step); const exe_tests = b.addTest("src/main.zig"); exe_tests.setTarget(target); exe_tests.setBuildMode(mode); const test_step = b.step("test", "Run unit tests"); test_step.dependOn(&exe_tests.step); }
0
repos/zigXrustXc/zig
repos/zigXrustXc/zig/src/main.zig
const std = @import("std"); pub fn sieve_of_eratosthenes(n: usize, allocator: std.mem.Allocator) !usize { var arr = try allocator.alloc(bool, n + 1); arr[0] = false; arr[1] = false; for (arr) |*e| e.* = true; var i: f64 = 2; var n_float = @intToFloat(f64, n); while (i < @sqrt(n_float)) : (i += 1) { if (arr[@floatToInt(usize, i)]) { var j: f64 = i * i; while (j <= n_float) : (j += i) { arr[@floatToInt(usize, j)] = false; } } } var count: usize = 0; for (arr) |e| { if (e) { count += 1; } } return count - 2; } pub fn main() !void { const stdout = std.io.getStdOut().writer(); var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); const allocator = arena.allocator(); const args = try std.process.argsAlloc(allocator); const first_arg = args[1]; const n = try std.fmt.parseInt(usize, first_arg, 10); var primes = try sieve_of_eratosthenes(n, allocator); try stdout.print("Primes up to {d} are: {d}\n", .{ n, primes }); }
0
repos/zigXrustXc
repos/zigXrustXc/rust/Cargo.lock
# This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 3 [[package]] name = "rust" version = "0.1.0"
0
repos/zigXrustXc
repos/zigXrustXc/rust/Cargo.toml
[package] name = "rust" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] [profile.release] panic = "abort" # Strip expensive panic clean-up logic codegen-units = 1 # Compile crates one after another so the compiler can optimize better lto = true # Enables link to optimizations strip = true # Remove debug symbols
0
repos/zigXrustXc/rust
repos/zigXrustXc/rust/src/main.rs
fn sieve_of_eratosthenes(n: usize) -> usize { let mut is_prime = vec![true; n + 1]; let mut total = 0; is_prime[0] = false; is_prime[1] = false; for i in 2..=(n as f64).sqrt() as usize { if is_prime[i] { for j in ((i * i)..=n).step_by(i) { is_prime[j] = false; } } } for i in 2..=n { if is_prime[i] { total += 1; } } total } fn main() { let args: Vec<String> = std::env::args().collect(); let n = args[1].parse::<usize>().unwrap(); let primes = sieve_of_eratosthenes(n); println!("Primes up to {} are: {}", n, primes); }
0
repos/zigXrustXc
repos/zigXrustXc/c/main.c
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <stdbool.h> int sieve_of_eratosthenes(int n) { bool *is_prime = (bool *)malloc((n + 1) * sizeof(bool)); for (int i = 2; i <= n; i++) { is_prime[i] = true; } for (int i = 2; i <= sqrt(n); i++) { if (is_prime[i]) { for (int j = i * i; j <= n; j += i) { is_prime[j] = false; } } } int total = 0; for (int i = 2; i <= n; i++) { if (is_prime[i]) { total++; } } free(is_prime); return total; } int main(int argc, char **argv) { int n = atoi(argv[1]); int primes = sieve_of_eratosthenes(n); printf("There are %d primes between 2 and %d\n", primes, n); return 0; }
0
repos
repos/Zig-Intel-Hex/ihex.zig
pub fn writer(comptime Address: type, inner_writer: anytype, options: Writer_Options) Writer(Address, @TypeOf(inner_writer)) { return Writer(Address, @TypeOf(inner_writer)).init(inner_writer, options); } pub const Writer_Options = struct { line_ending: ?[]const u8 = null, pretty: bool = false, }; // Note segmented modes are not supported at this time. pub fn Writer(comptime Address: type, comptime Inner_Writer: type) type { switch (@typeInfo(Address).Int.bits) { 16, 32 => {}, else => @compileError("Invalid address type; must be u32 or u16"), } return struct { inner: Inner_Writer, pretty: bool, line_ending: []const u8, last_address_ext: ?u16 = null, const Self = @This(); pub fn init(inner_writer: Inner_Writer, options: Writer_Options) Self { return .{ .inner = inner_writer, .line_ending = options.line_ending orelse default_line_ending(), .pretty = options.pretty, }; } fn write_byte(self: *Self, d: u8) !void { try self.inner.writeByte("0123456789ABCDEF"[d >> 4]); try self.inner.writeByte("0123456789ABCDEF"[@as(u4, @truncate(d))]); } const Record_Type = enum (u8) { data = 0, end_of_file = 1, extended_address = 4, start_address = 5, }; fn write_record(self: *Self, record_type: Record_Type, address: u16, data: []const u8) !void { try self.inner.writeByte(':'); var checksum: u8 = 0; const length: u8 = @intCast(data.len); try self.write_byte(length); checksum +%= length; if (self.pretty) { try self.inner.writeByte(' '); } const address_high: u8 = @truncate(address >> 8); try self.write_byte(address_high); checksum +%= address_high; const address_low: u8 = @truncate(address); try self.write_byte(address_low); checksum +%= address_low; if (self.pretty) { try self.inner.writeByte(' '); } const record_type_byte = @intFromEnum(record_type); try self.write_byte(record_type_byte); checksum +%= record_type_byte; if (self.pretty) { try self.inner.writeByte(' '); } for (data) |d| { try self.write_byte(d); checksum +%= d; } if (self.pretty) { try self.inner.writeByte(' '); } const signed_checksum: i8 = @bitCast(checksum); try self.write_byte(@bitCast(-signed_checksum)); try self.inner.writeAll(self.line_ending); } pub fn write(self: *Self, address: Address, data: []const u8) !void { var start = address; var remaining = data; while (true) { var bytes: Address = @intCast(@min(remaining.len, 32)); if (@bitSizeOf(Address) > 16) { const start_ext: u16 = @truncate(start >> 16); const end_ext: u16 = @truncate((address + bytes) >> 16); if (start_ext != end_ext) { const end = (address + bytes) & 0xFFFF0000; bytes = end - address; } if (start_ext != self.last_address_ext) { const start_ext_be = std.mem.nativeToBig(Address, start_ext); try self.write_record(.extended_address, 0, std.mem.asBytes(&start_ext_be)); self.last_address_ext = start_ext; } } try self.write_record(.data, @truncate(start), remaining[0..bytes]); start += bytes; remaining = remaining[bytes..]; if (remaining.len == 0) break; } } pub fn finish(self: *Self, start_address: ?Address) !void { if (start_address) |address| { var address_be = std.mem.nativeToBig(Address, address); try self.write_record(.start_address, 0, std.mem.asBytes(&address_be)); } try self.write_record(.end_of_file, 0, ""); } }; } fn default_line_ending() []const u8 { return if (@import("builtin").target.os.tag == .windows) "\r\n" else "\n"; } const std = @import("std");
0
repos
repos/Zig-Intel-Hex/tests.zig
test "pretty=false" { const binary = "abcdef123\x00\x10\x01asdf\r\n0\x00"; var buf: [1024]u8 = undefined; var stream = std.io.fixedBufferStream(&buf); var writer = ihex.writer(u32, stream.writer(), .{ .line_ending = "\n" }); try writer.write(0x1234567, binary); try writer.finish(0xABCD); try std.testing.expectEqualStrings( \\:0400000400000123D4 \\:14456700616263646566313233001001617364660D0A30005F \\:040000050000ABCD7F \\:00000001FF \\ , stream.getWritten()); } test "pretty=true" { const binary = "abcdef123\x00\x10\x01asdf\r\n0\x00"; var buf: [1024]u8 = undefined; var stream = std.io.fixedBufferStream(&buf); var writer = ihex.writer(u32, stream.writer(), .{ .line_ending = "\n", .pretty = true, }); try writer.write(0x1234567, binary); try writer.finish(0xABCD); try std.testing.expectEqualStrings( \\:04 0000 04 00000123 D4 \\:14 4567 00 616263646566313233001001617364660D0A3000 5F \\:04 0000 05 0000ABCD 7F \\:00 0000 01 FF \\ , stream.getWritten()); } const ihex = @import("ihex"); const std = @import("std");
0
repos
repos/Zig-Intel-Hex/build.zig.zon
.{ .name = "Zig-Intel-Hex", .version = "1.1.0", .minimum_zig_version = "0.12.0-dev.2063+804cee3b9", .dependencies = .{}, .paths = .{ "build.zig", "build.zig.zon", "ihex.zig", }, }
0
repos
repos/Zig-Intel-Hex/build.zig
const std = @import("std"); pub fn build(b: *std.Build) void { const ihex = b.addModule("ihex", .{ .root_source_file = .{ .path = "ihex.zig" }, }); const tests = b.addTest(.{ .root_source_file = .{ .path = "tests.zig"}, .target = b.standardTargetOptions(.{}), .optimize = b.standardOptimizeOption(.{}), }); tests.root_module.addImport("ihex", ihex); const run_tests = b.addRunArtifact(tests); const test_step = b.step("test", "Run all tests"); test_step.dependOn(&run_tests.step); }
0
repos
repos/Zig-Intel-Hex/readme.md
# Zig-Intel-Hex Prints binary data into Intel Hex format. TODO: Parsing
0
repos
repos/slugify/README.md
<h1 align="center"> slugify 🐌 </h1> [![CI](https://github.com/dying-will-bullet/slugify/actions/workflows/ci.yaml/badge.svg)](https://github.com/dying-will-bullet/slugify/actions/workflows/ci.yaml) ![](https://img.shields.io/badge/language-zig-%23ec915c) Small utility library for generating ASCII string from a Unicode string. It could handle most major languages and emojis. ## Examples ```zig const std = @import("std"); const slugify = @import("slugify").slugify; const slugifyAlloc = @import("slugify").slugifyAlloc; pub fn main() !void { const allocator = std.heap.page_allocator; const res = try slugifyAlloc(allocator, " Déjà Vu! ", .{}); defer allocator.free(res); std.debug.print("{s}\n", .{res}); // deja-vu // Or use a buffer var buf: [1024]u8 = undefined; const res2 = try slugify(&buf, "𝒔𝒍𝒖𝒈𝒊𝒇𝒚 𝒂 𝒔𝒕𝒓𝒊𝒏𝒈", .{}); std.debug.print("{s}\n", .{res2}); // slugify-a-string } ``` ## Installation You can install it using a package manager or manually as shown below. Add `slugify` as dependency in `build.zig.zon`: ``` .{ .name = "my-project", .version = "0.1.0", .dependencies = .{ .slugify = .{ .url = "https://github.com/dying-will-bullet/slugify/archive/refs/tags/v0.1.0.tar.gz", .hash = "12208e86bbf6970f74f85859cc90a601d6cb381ef8637b0aa7901647750bafa6ac8c", }, }, } ``` Add `slugify` as module in `build.zig`: ```diff diff --git a/build.zig b/build.zig index 60fb4c2..0255ef3 100644 --- a/build.zig +++ b/build.zig @@ -15,6 +15,9 @@ pub fn build(b: *std.Build) void { // set a preferred release mode, allowing the user to decide how to optimize. const optimize = b.standardOptimizeOption(.{}); + const opts = .{ .target = target, .optimize = optimize }; + const slugify_module = b.dependency("slugify", opts).module("slugify"); + const exe = b.addExecutable(.{ .name = "m", // In this case the main source file is merely a path, however, in more @@ -23,6 +26,7 @@ pub fn build(b: *std.Build) void { .target = target, .optimize = optimize, }); + exe.addModule("slugify", slugify_module); // This declares intent for the executable to be installed into the // standard location when the user invokes the "install" step (the default ``` ## API ### `Options` Used to control the conversion behavior, with the following default values. ```zig const Dict = std.AutoHashMap(u21, []const u8); const Options = struct { sep: []const u8 = "-", dict: ?Dict = null, }; ``` `dict`: Add your own custom replacements. The replacements are run on the original string **before** any other transformations. ```zig var dict = Dict.init(allocator); defer dict.deinit(); // 128049 is the code point of 🐱 try dict.put(128049, "neko"); const res = try slugifyAlloc(allocator, "I love 🐱.", .{ .dict = dict }); // i-love-neko defer allocator.free(res); ``` ### `slugifyAlloc(allocator: Allocator, s: []const u8, options: Options) ![]const u8` Return the converted string. The caller is should free the memory. ### `slugify(dest: []u8, s: []const u8, options: Options) ![]const u8` Use buffer instead of allocator. Return a slice of the buffer. ## slugify implementations in different languages It is important to note that there is no universal standard for converting a Unicode character to an ASCII string. The same Han character may have different transliterations in different languages. For example, in Japanese, "世界" is transliterated as "sekai," while in Chinese, it is transliterated as "shijie". This complexity also applies to emojis. For instance, the ♥ emoji can represent "love" or "heart" depending on the context. Different implementations may use different mapping table, and I cannot guarantee that their results will be the same. Here are slugify implementations in other languages: - Java: [slugify/slugify](https://github.com/slugify/slugify) - Rust: [Stebalien/slug-rs](https://github.com/Stebalien/slug-rs) - Python: [un33k/python-slugify](https://github.com/un33k/python-slugify) - JavaScript: [simov/slugify](https://github.com/simov/slugify) - JavaScript: [sindresorhus/slugify](https://github.com/sindresorhus/slugify) ## LICENSE MIT License Copyright (c) 2023, Hanaasagi
0
repos
repos/slugify/build.zig.zon
.{ .name = "slugify", .version = "0.1.0", .dependencies = .{ .deunicode = .{ .url = "https://github.com/dying-will-bullet/deunicode/archive/refs/tags/v0.1.1.tar.gz", .hash = "1220fef06e2fab740b409eaec28fee459526c86f297e6c43fdaee471084cc569f397", }, }, }
0
repos
repos/slugify/build.zig
const std = @import("std"); const examples = .{ "basic", "replacement", }; // Although this function looks imperative, note that its job is to // declaratively construct a build graph that will be executed by an external // runner. pub fn build(b: *std.Build) void { // Standard target options allows the person running `zig build` to choose // what target to build for. Here we do not override the defaults, which // means any target is allowed, and the default is native. Other options // for restricting supported target set are available. const target = b.standardTargetOptions(.{}); // Standard optimization options allow the person running `zig build` to select // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. Here we do not // set a preferred release mode, allowing the user to decide how to optimize. const optimize = b.standardOptimizeOption(.{}); const opts = .{ .target = target, .optimize = optimize }; const deunicode_module = b.dependency("deunicode", opts).module("deunicode"); const mod = b.addModule("slugify", .{ .source_file = .{ .path = "src/lib.zig" }, .dependencies = &.{.{ .name = "deunicode", .module = deunicode_module }}, }); const lib = b.addStaticLibrary(.{ .name = "slugify", // In this case the main source file is merely a path, however, in more // complicated build scripts, this could be a generated file. .root_source_file = .{ .path = "src/lib.zig" }, .target = target, .optimize = optimize, }); lib.addModule("deunicode", deunicode_module); // This declares intent for the library to be installed into the standard // location when the user invokes the "install" step (the default step when // running `zig build`). b.installArtifact(lib); // Creates a step for unit testing. This only builds the test executable // but does not run it. const main_tests = b.addTest(.{ .root_source_file = .{ .path = "src/lib.zig" }, .target = target, .optimize = optimize, }); main_tests.addModule("deunicode", deunicode_module); const run_main_tests = b.addRunArtifact(main_tests); // This creates a build step. It will be visible in the `zig build --help` menu, // and can be selected like this: `zig build test` // This will evaluate the `test` step rather than the default, which is "install". const test_step = b.step("test", "Run library tests"); test_step.dependOn(&run_main_tests.step); inline for (examples) |e| { const example_path = "examples/" ++ e ++ "/main.zig"; const exe_name = "example-" ++ e; const run_name = "run-" ++ e; const run_desc = "Run the " ++ e ++ " example"; const exe = b.addExecutable(.{ .name = exe_name, .root_source_file = .{ .path = example_path }, .target = target, .optimize = optimize, }); exe.addModule("slugify", mod); const run_cmd = b.addRunArtifact(exe); run_cmd.step.dependOn(b.getInstallStep()); const run_step = b.step(run_name, run_desc); run_step.dependOn(&run_cmd.step); } }
0
repos/slugify
repos/slugify/src/lib.zig
const std = @import("std"); const testing = std.testing; const Allocator = std.mem.Allocator; const unicode = @import("std").unicode; const deuni = @import("deunicode"); // -------------------------------------------------------------------------------- // Private API // -------------------------------------------------------------------------------- fn pushChar(c: u8, out: anytype, prev_is_dash: *bool, sep: []const u8) !void { if ((c >= 'a' and c <= 'z') or (c >= '0' and c <= '9')) { prev_is_dash.* = false; _ = try out.writeByte(c); } else if (c >= 'A' and c <= 'Z') { prev_is_dash.* = false; _ = try out.writeByte(c - 'A' + 'a'); } else { if (!prev_is_dash.*) { _ = try out.write(sep); prev_is_dash.* = true; } } } // -------------------------------------------------------------------------------- // Public API // -------------------------------------------------------------------------------- pub const Dict = std.AutoHashMap(u21, []const u8); pub const Options = struct { sep: []const u8 = "-", dict: ?Dict = null, }; pub fn slugifyAlloc(allocator: Allocator, s: []const u8, options: Options) ![]const u8 { var buf = try std.ArrayList(u8).initCapacity(allocator, s.len); defer buf.deinit(); var out = buf.writer(); var prev_is_dash = true; var iter = (try unicode.Utf8View.init(s)).iterator(); while (iter.nextCodepoint()) |codepoint| { if (options.dict != null) { if (options.dict.?.get(codepoint)) |repl| { for (repl) |c| { try pushChar(c, out, &prev_is_dash, options.sep); } continue; } } if (codepoint < 0x7F) { try pushChar(@truncate(codepoint), out, &prev_is_dash, options.sep); } else { const res = deuni.getReplacement(codepoint) orelse options.sep; for (res) |c| { try pushChar(c, out, &prev_is_dash, options.sep); } } } if (std.mem.endsWith(u8, buf.items, options.sep)) { for (0..options.sep.len) |_| { _ = buf.pop(); } } return buf.toOwnedSlice(); } pub fn slugify(dest: []u8, s: []const u8, options: Options) ![]const u8 { var fbs = std.io.fixedBufferStream(dest); var out = fbs.writer(); var prev_is_dash = true; var iter = (try unicode.Utf8View.init(s)).iterator(); while (iter.nextCodepoint()) |codepoint| { if (codepoint < 0x7F) { try pushChar(@truncate(codepoint), out, &prev_is_dash, options.sep); } else { const res = deuni.getReplacement(codepoint) orelse options.sep; for (res) |c| { try pushChar(c, out, &prev_is_dash, options.sep); } } } if (std.mem.endsWith(u8, dest[0..fbs.pos], options.sep)) { return dest[0 .. fbs.pos - options.sep.len]; } return dest[0..fbs.pos]; } // -------------------------------------------------------------------------------- // Testing // -------------------------------------------------------------------------------- fn testConversionAlloc(s: []const u8, expect: []const u8) !bool { const allocator = testing.allocator; const res = try slugifyAlloc(allocator, s, .{}); defer allocator.free(res); return std.mem.eql(u8, res, expect); } fn testConversion(s: []const u8, expect: []const u8) !bool { var buf: [1024]u8 = undefined; const res = try slugify(&buf, s, .{}); return std.mem.eql(u8, res, expect); } test "test conversion alloc" { try testing.expect(try testConversionAlloc("♥", "hearts")); try testing.expect(try testConversionAlloc("🦊", "fox-face")); try testing.expect(try testConversionAlloc(" Déjà Vu! ", "deja-vu")); try testing.expect(try testConversionAlloc("tôi yêu những chú kỳ lân", "toi-yeu-nhung-chu-ky-lan")); } test "test conversion buffer" { try testing.expect(try testConversion("♥", "hearts")); try testing.expect(try testConversion("🦊", "fox-face")); try testing.expect(try testConversion(" Déjà Vu! ", "deja-vu")); try testing.expect(try testConversion("tôi yêu những chú kỳ lân", "toi-yeu-nhung-chu-ky-lan")); } test "test custom sep" { const allocator = testing.allocator; const res = try slugifyAlloc(allocator, " Déjà Vu! ", .{ .sep = "__" }); defer allocator.free(res); try testing.expectEqualStrings("deja__vu", res); } test "test dict" { const allocator = testing.allocator; var dict = Dict.init(allocator); defer dict.deinit(); // é try dict.put(233, "ee"); // à try dict.put(224, "aa"); const res = try slugifyAlloc(allocator, " Déjà Vu! ", .{ .dict = dict }); defer allocator.free(res); try testing.expectEqualStrings("deejaa-vu", res); }
0
repos/slugify/examples
repos/slugify/examples/basic/main.zig
const std = @import("std"); const slugify = @import("slugify").slugify; const slugifyAlloc = @import("slugify").slugifyAlloc; pub fn main() !void { const allocator = std.heap.page_allocator; const res = try slugifyAlloc(allocator, " Déjà Vu! ", .{}); defer allocator.free(res); std.debug.print("{s}\n", .{res}); // Or use a buffer var buf: [1024]u8 = undefined; // const res2 = try slugify(&buf, "🌿🐌🌲", .{}); const res2 = try slugify(&buf, "𝒔𝒍𝒖𝒈𝒊𝒇𝒚 𝒂 𝒔𝒕𝒓𝒊𝒏𝒈", .{}); std.debug.print("{s}\n", .{res2}); }
0
repos/slugify/examples
repos/slugify/examples/replacement/main.zig
const std = @import("std"); const slugifyAlloc = @import("slugify").slugifyAlloc; const Dict = @import("slugify").Dict; pub fn main() !void { const allocator = std.heap.page_allocator; var dict = Dict.init(allocator); defer dict.deinit(); // 128049 is the code point of 🐱 try dict.put(128049, "neko"); const res = try slugifyAlloc(allocator, "I love 🐱.", .{ .dict = dict }); defer allocator.free(res); std.debug.print("{s}\n", .{res}); }
0
repos
repos/cutransform/LICENSE.txt
MIT License Copyright (c) 2023 lennyerik Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0
repos
repos/cutransform/README.md
# cutransform Are you tired of having to write your CUDA kernel code in C++? This project aims to make it possible to compile CUDA kernels written in any language supported by LLVM without much hassle. Specifically, this is basically a transpiler from LLVM-IR to NVVM-IR. Importantly, languages like plain C, Rust and Zig are all supported. Expecially CUDA in Rust is not yet very good and [Rust-CUDA](https://github.com/Rust-GPU/Rust-CUDA) has been stale since July 2022. Maybe we can fix that by using a different approach to the problem of CUDA codegen. **This is not a CUDA runtime API wrapper! You cannot run the kernels with this project alone!** If you're just looking for a simple way to write CUDA in Rust though, you're in luck. [cust](https://crates.io/crates/cust) is a really good wrapper around the CUDA API. ## How it works In order to compile a kernel in any language with an LLVM frontend, we * Invoke the standard compiler for the language and tell it to output LLVM bitcode for the nvptx64-nvidia-cuda target * Pass the generated bitcode to the code transformer (cutransform) * The transformer will parse the bitcode and add required attributes and functions and structs * It will output this modified version of the bitcode * Finally the bitcode can simply be passed through the llvm-bitcode compiler, llc to generate the PTX assembly * (Optional) Additionally can now choose to assemble the PTX to a SASS (cubin) program for your specific graphics card using Nvidia's proprietary ptxas assembler ## Setup You should already have * clang * llvm * cuda Then compile the cutransform binary: cd cutransform cargo build --release If the build fails with an error message from the `llvm-sys` crate, you likely have a build of LLVM without the static libraries. This is the default for newer LLVM binary distributions. To build with a dynamically linked LLVM, run: cargo build --release --features dynamic-llvm instead. ## Rust example usage First, make sure you have the nvptx Rust target installed: rustup target add nvptx64-nvidia-cuda Here is an example Rust kernel: ```rust #![no_std] extern "C" { fn threadIdxX() -> u32; } #[no_mangle] pub extern "C" fn kernel(arr: *mut u32) { unsafe { let idx = threadIdxX() as usize; *arr.add(idx) = 123; } } ``` **Please note that all kernel functions should have a name starting with the word "kernel". Otherwise they won't be exported.** To compile the Rust kernel to LLVM bitcode, run: rustc -O -C opt-level=3 -o kernel.bc --emit llvm-bc --target nvptx64-nvidia-cuda -C target-cpu=sm_86 -C target-feature=+ptx75 --crate-type lib kernel.rs You can change `sm_86` flag to the minimum supported compute capability of your kernel (8.6 is the newest supported in clang and it's mostly for 30-series cards and onwards). Refer to [this Wikipedia page](https://en.wikipedia.org/wiki/CUDA#GPUs_supported) for a list of cards and their supported compute capabilities. Now, run cutransform on the llvm bitcode cutransform/target/release/cutransform kernel.bc Finally, compile the new bitcode to PTX: llc -O3 -mcpu=sm_86 -mattr=+ptx75 kernel.bc Now you can also choose to assemble the PTX for your card: ptxas --allow-expensive-optimizations true -o kernel.cubin --gpu-name sm_89 kernel.s Where you can again change `sm_89` to the compute capability of your card. Compute capability 8.9 is for 40-series cards. For a complete and integrated example, see the `rust-example` crate included in this repo. ## C example usage Here is an example C kernel: ```c extern int threadIdxX(void); void kernel(int *arr) { arr[threadIdxX()] = 123; } ``` **Please note that all kernel functions should have a name starting with the word "kernel". Otherwise they won't be exported.** To compile the C kernel to LLVM bitcode, run: clang -cc1 -O3 -triple=nvptx64-nvidia-cuda -target-cpu sm_86 -target-feature +ptx75 -emit-llvm-bc -o kernel.bc kernel.c Now, run cutransform on the llvm bitcode cutransform/target/release/cutransform kernel.bc Finally, compile the new bitcode to PTX: llc -O3 -mcpu=sm_86 -mattr=+ptx75 kernel.bc Now you can also choose to assemble the PTX for your card: ptxas --allow-expensive-optimizations true -o kernel.cubin --gpu-name sm_89 kernel.s Where you can again change `sm_89` to the compute capability of your card. Compute capability 8.9 is for 40-series cards. For a complete and integrated example, see the `c-example` folder included in this repo. ## Zig example usage Here is an example Zig kernel: ```zig extern fn threadIdxX() i32; export fn kernel(arr: [*]u32) callconv(.C) void { arr[@intCast(usize, threadIdxX())] = 123; } // Override the default entrypoint pub fn _start() callconv(.Naked) void {} ``` **Please note that all kernel functions should have a name starting with the word "kernel". Otherwise they won't be exported.** To compile the Zig kernel to LLVM bitcode, run: zig build-obj -O ReleaseSmall -target nvptx64-cuda -mcpu sm_86+ptx75 -fno-emit-asm -femit-llvm-bc=kernel.bc kernel.zig Now, run cutransform on the llvm bitcode cutransform/target/release/cutransform kernel.bc Finally, compile the new bitcode to PTX: llc -O3 -mcpu=sm_86 -mattr=+ptx75 kernel.bc Now you can also choose to assemble the PTX for your card: ptxas --allow-expensive-optimizations true -o kernel.cubin --gpu-name sm_89 kernel.s Where you can again change `sm_89` to the compute capability of your card. Compute capability 8.9 is for 40-series cards. For a complete and integrated example, see the `zig-example` folder included in this repo.
0
repos/cutransform
repos/cutransform/cutransform/Cargo.toml
[package] name = "cutransform" version = "0.1.0" edition = "2021" [dependencies] inkwell = { version = "0.2.0", default-features = false, features = ["target-nvptx", "llvm15-0"] } llvm-sys = "150.*" [features] dynamic-llvm = ["llvm-sys/prefer-dynamic"]
0
repos/cutransform/cutransform
repos/cutransform/cutransform/src/nvvm_intrinsics.rs
use inkwell::{module::Module, types::FunctionType}; pub fn replace_stub_functions(module: &Module) -> Result<(), String> { let ctx = module.get_context(); let i32fntype = ctx.i32_type().fn_type(&[], false); let voidfntype = ctx.void_type().fn_type(&[], false); // Replace ThreadIdx functions replace_stub_fn_with_intrinsic( module, "threadIdxX", "llvm.nvvm.read.ptx.sreg.tid.x", i32fntype, )?; replace_stub_fn_with_intrinsic( module, "threadIdxY", "llvm.nvvm.read.ptx.sreg.tid.y", i32fntype, )?; replace_stub_fn_with_intrinsic( module, "threadIdxZ", "llvm.nvvm.read.ptx.sreg.tid.z", i32fntype, )?; // Replace GroupIdx functions replace_stub_fn_with_intrinsic( module, "blockIdxX", "llvm.nvvm.read.ptx.sreg.ctaid.x", i32fntype, )?; replace_stub_fn_with_intrinsic( module, "blockIdxY", "llvm.nvvm.read.ptx.sreg.ctaid.y", i32fntype, )?; replace_stub_fn_with_intrinsic( module, "blockIdxZ", "llvm.nvvm.read.ptx.sreg.ctaid.z", i32fntype, )?; // Replace blockDim functions replace_stub_fn_with_intrinsic( module, "blockDimX", "llvm.nvvm.read.ptx.sreg.ntid.x", i32fntype, )?; replace_stub_fn_with_intrinsic( module, "blockDimY", "llvm.nvvm.read.ptx.sreg.ntid.y", i32fntype, )?; replace_stub_fn_with_intrinsic( module, "blockDimZ", "llvm.nvvm.read.ptx.sreg.ntid.z", i32fntype, )?; // Replace gridDim functions replace_stub_fn_with_intrinsic( module, "gridDimX", "llvm.nvvm.read.ptx.sreg.nctaid.x", i32fntype, )?; replace_stub_fn_with_intrinsic( module, "gridDimY", "llvm.nvvm.read.ptx.sreg.nctaid.y", i32fntype, )?; replace_stub_fn_with_intrinsic( module, "gridDimZ", "llvm.nvvm.read.ptx.sreg.nctaid.z", i32fntype, )?; // Replace warpSize function replace_stub_fn_with_intrinsic( module, "warpSize", "llvm.nvvm.read.ptx.sreg.warpsize", i32fntype, )?; // Replace __syncthreads function replace_stub_fn_with_intrinsic(module, "__syncthreads", "llvm.nvvm.barrier0", voidfntype)?; Ok(()) } fn replace_stub_fn_with_intrinsic<'a>( module: &Module<'a>, stub_fn_name: &str, instrinsic_name: &str, fn_type: FunctionType<'a>, ) -> Result<(), String> { if let Some(func) = module.get_function(stub_fn_name) { let intrinsic_func = module .get_function(instrinsic_name) .unwrap_or_else(|| module.add_function(instrinsic_name, fn_type, None)); // Check the function type let actual_type = func.get_type(); if actual_type != fn_type { return Err(format!( "Intrinsic stub function `{}` has wrong type! Expected {}, got {}.", stub_fn_name, fn_type .print_to_string() .to_str() .unwrap_or("<Invalid UTF8>"), actual_type .print_to_string() .to_str() .unwrap_or("<Invalid UTF8>") )); } func.replace_all_uses_with(intrinsic_func); } Ok(()) }
0
repos/cutransform/cutransform
repos/cutransform/cutransform/src/main.rs
use inkwell::{context::Context, module::Module}; use std::path::Path; mod nvvm_cleanup; mod nvvm_intrinsics; mod nvvm_metadata; fn main() -> Result<(), String> { let file_path_str = std::env::args() .nth(1) .unwrap_or_else(|| "kernel.bc".into()); let file_path = Path::new(&file_path_str); let ctx = Context::create(); let module = Module::parse_bitcode_from_path(file_path, &ctx).map_err(|e| e.to_string())?; nvvm_metadata::add_metadata_to_kernel_functions(&module)?; nvvm_intrinsics::replace_stub_functions(&module)?; nvvm_cleanup::replace_external_void_functions(&module); module.write_bitcode_to_path(file_path); Ok(()) }
0
repos/cutransform/cutransform
repos/cutransform/cutransform/src/nvvm_cleanup.rs
use inkwell::module::Module; pub fn replace_external_void_functions(module: &Module) { for func in module.get_functions() { let func_name = func.get_name().to_str().unwrap_or("<Invalid UTF8>"); let returns_void = func.get_type().get_return_type().is_none(); if func.count_basic_blocks() == 0 && func.get_intrinsic_id() == 0 && returns_void { eprintln!("Warning: replacing unresolved external function `{func_name}` with noop"); let ctx = module.get_context(); let block = ctx.append_basic_block(func, "noop"); let builder = ctx.create_builder(); builder.position_at_end(block); builder.build_return(None); } } }
0
repos/cutransform/cutransform
repos/cutransform/cutransform/src/nvvm_metadata.rs
use inkwell::{module::Module, values::BasicMetadataValueEnum}; pub fn add_metadata_to_kernel_functions(module: &Module) -> Result<(), String> { let ctx = module.get_context(); for func in module.get_functions() { if let Ok(func_name) = func.get_name().to_str() { // Skip the function if it does not start with the word "kernel" if !func_name.starts_with("kernel") { continue; } // Make sure that the function has a return type of `void` if let Some(return_type) = func.get_type().get_return_type() { return Err(format!( "Kernel function `{}` has return type {}, when it should be void!", func_name, return_type .print_to_string() .to_str() .unwrap_or("<Invalid UTF8>") )); } let metadata = ctx.metadata_node(&[ BasicMetadataValueEnum::PointerValue(func.as_global_value().as_pointer_value()), BasicMetadataValueEnum::MetadataValue(ctx.metadata_string("kernel")), BasicMetadataValueEnum::IntValue(ctx.i32_type().const_int(1, true)), ]); module.add_global_metadata("nvvm.annotations", &metadata)?; } } Ok(()) }
0
repos/cutransform
repos/cutransform/rust-example/build.rs
use std::process::Command; fn main() -> Result<(), String> { println!("cargo:rerun-if-changed=src/kernel.rs"); let build_dir = std::env::var("OUT_DIR").map_err(|_| "Failed to get OUT_DIR environment variable")?; run_and_check_command( "rustc", &[ "-O", "-C", "opt-level=3", "--emit", "llvm-bc", "--target", "nvptx64-nvidia-cuda", "-C", "target-cpu=sm_86", "-C", "target-feature=+ptx75", "--crate-type", "lib", "-o", &format!("{build_dir}/kernel.bc"), "src/kernel.rs", ], )?; run_and_check_command( "../cutransform/target/release/cutransform", &[&format!("{build_dir}/kernel.bc")], )?; run_and_check_command( "llc", &[ "-O3", "-mcpu=sm_86", "-mattr=+ptx75", &format!("{build_dir}/kernel.bc"), ], )?; run_and_check_command( "ptxas", &[ "--allow-expensive-optimizations", "true", "--gpu-name", "sm_89", "-o", &format!("{build_dir}/kernel.cubin"), &format!("{build_dir}/kernel.s"), ], )?; Ok(()) } fn run_and_check_command(executable: &str, args: &[&str]) -> Result<(), String> { if Command::new(executable) .args(args) .status() .map_err(|_| format!("Failed to get command status of {executable}"))? .success() { Ok(()) } else { Err(format!("Command {executable} failed!")) } }
0
repos/cutransform
repos/cutransform/rust-example/Cargo.toml
[package] name = "rust-cuda-example" version = "0.1.0" edition = "2021" [dependencies] cust = "0.3.2"
0
repos/cutransform/rust-example
repos/cutransform/rust-example/src/main.rs
use cust::error::CudaError; use cust::prelude::*; const KERNEL_COMPILED: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/kernel.cubin")); fn main() -> Result<(), CudaError> { // We have to assign the context to an unused variable, because the // compiler optimises the function call out otherwise let _ctx = cust::quick_init()?; let module = Module::from_cubin(KERNEL_COMPILED, &[])?; let stream = Stream::new(StreamFlags::NON_BLOCKING, None)?; let arr = DeviceBuffer::from_slice(&[0u32; 512])?; let arr_ptr = arr.as_device_ptr(); unsafe { launch!(module.kernel<<<1, 512, 0, stream>>>(arr_ptr))?; } stream.synchronize()?; let mut host_arr = [0u32; 512]; arr.copy_to(&mut host_arr)?; for (i, value) in host_arr.iter().enumerate() { println!("arr[{i}] = {value}"); } Ok(()) }
0
repos/cutransform/rust-example
repos/cutransform/rust-example/src/kernel.rs
#![no_std] extern "C" { fn threadIdxX() -> u32; // fn threadIdxY() -> u32; // fn threadIdxZ() -> u32; } #[no_mangle] pub extern "C" fn kernel(arr: *mut u32) { unsafe { let idx = threadIdxX() as usize; *arr.add(idx) = 123; } }
0
repos/cutransform
repos/cutransform/c-example/main.c
#include <stdio.h> #include <cuda.h> #define CUDA_CHECK_ERR(err, err_msg) if (err != CUDA_SUCCESS) { fprintf(stderr, "%s\nError code: %d\n", err_msg, err); return 1; } #define ARR_SIZE 512 int main(void) { CUresult result = cuInit(0); CUDA_CHECK_ERR(result, "Failed to intialise CUDA!"); // Get the first CUDA device CUdevice device; result = cuDeviceGet(&device, 0); CUDA_CHECK_ERR(result, "Failed to get default CUDA device!"); CUcontext ctx; result = cuCtxCreate(&ctx, 0, device); CUDA_CHECK_ERR(result, "Failed to create CUDA device context!"); CUmodule module; result = cuModuleLoad(&module, "build/kernel.cubin"); CUDA_CHECK_ERR(result, "Failed to load build/kernel.cubin! Please make sure the file exists."); CUfunction kernel_func; result = cuModuleGetFunction(&kernel_func, module, "kernel"); CUDA_CHECK_ERR(result, "Failed to get function `kernel` from cubin!"); // Allocate the array CUdeviceptr device_arr; result = cuMemAlloc(&device_arr, sizeof(int) * ARR_SIZE); CUDA_CHECK_ERR(result, "Failed to allocate array on device"); // Launch the kernel void *args[] = { (void *) &device_arr }; result = cuLaunchKernel( kernel_func, 1, 1, 1, // Grid size ARR_SIZE, 1, 1, // Block size 0, // Shared mem 0, // Stream args, // Arguments 0 // Extra flags ); CUDA_CHECK_ERR(result, "Failed to launch kernel!"); // Synchronize cuCtxSynchronize(); // Copy the data into host memory int host_arr[ARR_SIZE] = {0}; result = cuMemcpyDtoH((void *) host_arr, device_arr, sizeof(int) * ARR_SIZE); cuMemFree(device_arr); CUDA_CHECK_ERR(result, "Failed to copy array from device to host!"); for (size_t i = 0; i < ARR_SIZE; i++) { printf("arr[%ld] = %d\n", i, host_arr[i]); } return 0; }
0
repos/cutransform
repos/cutransform/c-example/build.sh
#!/bin/bash set -e mkdir build &> /dev/null || true clang -cc1 -Wall -Werror -pedantic -O3 -triple=nvptx64-nvidia-cuda -target-cpu sm_86 -target-feature +ptx75 -emit-llvm-bc -o build/kernel.bc kernel.c ../cutransform/target/release/cutransform build/kernel.bc llc -O3 -mcpu=sm_86 -mattr=+ptx75 build/kernel.bc ptxas --allow-expensive-optimizations true --gpu-name sm_89 -o build/kernel.cubin build/kernel.s if [[ "$(pkg-config --libs --cflags cuda &> /dev/null; echo $?)" == "0" ]]; then clang -Wall -Werror -pedantic -O3 --std=c17 `pkg-config --libs --cflags cuda` -o c-example main.c else clang -Wall -Werror -pedantic -O3 --std=c17 -lcuda -o c-example main.c fi
0
repos/cutransform
repos/cutransform/c-example/kernel.c
extern int threadIdxX(void); void kernel(int *arr) { arr[threadIdxX()] = 123; }
0
repos/cutransform
repos/cutransform/zig-example/build.zig
const std = @import("std"); const EmitOption = std.build.LibExeObjStep.EmitOption; pub fn build(b: *std.build.Builder) !void { std.fs.cwd().makeDir("build") catch |err| { if (err != std.os.MakeDirError.PathAlreadyExists) { return err; } }; // CUDA kernel const kernel_build = setupKernelBuild(b); // Main executable const executable_build = b.addExecutable("zig-example", "src/main.zig"); executable_build.setTarget(b.standardTargetOptions(.{})); executable_build.setBuildMode(.ReleaseFast); executable_build.emit_bin = EmitOption{ .emit_to = "zig-example" }; executable_build.linkLibC(); executable_build.linkSystemLibrary("cuda"); executable_build.step.dependOn(kernel_build); b.default_step = &executable_build.step; } fn setupKernelBuild(b: *std.build.Builder) *std.build.Step { // Build the LLVM bitcode from the Zig source const zig_build_step = b.addObject("kernel", "src/kernel.zig"); var cuda_features = std.Target.Cpu.Feature.Set.empty; cuda_features.addFeature(@enumToInt(std.Target.nvptx.Feature.ptx75)); cuda_features.addFeature(@enumToInt(std.Target.nvptx.Feature.sm_86)); zig_build_step.setTarget(.{ .ofmt = .nvptx, .os_tag = .cuda, .abi = .eabi, .cpu_arch = .nvptx64, .cpu_features_add = cuda_features, }); zig_build_step.setBuildMode(.ReleaseSmall); zig_build_step.emit_bin = .no_emit; zig_build_step.emit_llvm_bc = EmitOption{ .emit_to = "build/kernel.bc" }; // Transform the bitcode const cutransform_cmd_str = &[_][]const u8 { "../cutransform/target/release/cutransform", "build/kernel.bc" }; const cutransform_step = b.addSystemCommand(cutransform_cmd_str); cutransform_step.step.dependOn(&zig_build_step.step); // Compile the bitcode const llc_cmd_str = &[_][]const u8 { "llc", "-O3", "-mcpu=sm_86", "-mattr=+ptx75", "-o", "build/kernel.s", "build/kernel.bc" }; const bitcode_compile_step = b.addSystemCommand(llc_cmd_str); bitcode_compile_step.step.dependOn(&cutransform_step.step); // Compile the ptx const ptxas_cmd_str = &[_][]const u8 { "ptxas", "--allow-expensive-optimizations", "true", "-o", "src/kernel.cubin", "--gpu-name", "sm_89", "build/kernel.s" }; const ptx_compile_step = b.addSystemCommand(ptxas_cmd_str); ptx_compile_step.step.dependOn(&bitcode_compile_step.step); return &ptx_compile_step.step; }
0
repos/cutransform/zig-example
repos/cutransform/zig-example/src/main.zig
const std = @import("std"); const cuda = @cImport( @cInclude("cuda.h"), ); const kernel_cubin = @embedFile("kernel.cubin"); const ARR_SIZE = 512; pub fn main() !void { if (cuda.cuInit(0) != cuda.CUDA_SUCCESS) { return error.CudaInitialisationFailed; } var dev: cuda.CUdevice = undefined; if (cuda.cuDeviceGet(&dev, 0) != cuda.CUDA_SUCCESS) { return error.NoCudaDeviceFound; } var ctx: cuda.CUcontext = undefined; if (cuda.cuCtxCreate(&ctx, 0, dev) != cuda.CUDA_SUCCESS) { return error.FailedToCreateDeviceContext; } var module: cuda.CUmodule = undefined; var err = cuda.cuModuleLoadData(&module, kernel_cubin); if (err != cuda.CUDA_SUCCESS) { return error.FailedToLoadCubin; } var kernel_func: cuda.CUfunction = undefined; if (cuda.cuModuleGetFunction(&kernel_func, module, "kernel") != cuda.CUDA_SUCCESS) { return error.FailedToGetKernelFunction; } var device_arr: cuda.CUdeviceptr = undefined; if (cuda.cuMemAlloc(&device_arr, @sizeOf(u32) * ARR_SIZE) != cuda.CUDA_SUCCESS) { return error.FailedToAllocateDeviceMemory; } const args = &[_]?*anyopaque { &device_arr }; const launch_result = cuda.cuLaunchKernel( kernel_func, 1, 1, 1, // Grid size ARR_SIZE, 1, 1, // Block size 0, // Shared mem null, // Stream args, // Arguments 0 // Extra flags ); if (launch_result != cuda.CUDA_SUCCESS) { return error.FailedToLaunchKernel; } if (cuda.cuCtxSynchronize() != cuda.CUDA_SUCCESS) { return error.FailedToSynchronize; } var host_arr: [ARR_SIZE]u32 = undefined; if (cuda.cuMemcpyDtoH(@ptrCast(*anyopaque, &host_arr), device_arr, @sizeOf(u32) * ARR_SIZE) != cuda.CUDA_SUCCESS) { return error.FailedMemcpyDeviceToHost; } _ = cuda.cuMemFree(device_arr); const stdout = std.io.getStdOut().writer(); var i: usize = 0; while (i < host_arr.len) { try stdout.print("arr[{}] = {}\n", .{i, host_arr[i]}); i += 1; } }
0
repos/cutransform/zig-example
repos/cutransform/zig-example/src/kernel.zig
extern fn threadIdxX() i32; export fn kernel(arr: [*]u32) callconv(.C) void { arr[@intCast(usize, threadIdxX())] = 123; } // Override the default entrypoint pub fn _start() callconv(.Naked) void {}
0
repos
repos/meta-zig/README.md
Dependencies ============ URI: https://github.com/kraj/meta-clang.git branch: mickledore Patches ======= Please submit changes via Pull Request Maintainer: nateglims Table of Contents ================= I. Adding the meta-zig layer to your build II. Misc I. Adding the meta-zig layer to your build ================================================= Run 'bitbake-layers add-layer meta-zig' II. Misc ======== Add to distro/local conf: ```editor-config LLVM_TARGETS_TO_BUILD = "AArch64;AMDGPU;ARM;AVR;BPF;Hexagon;Lanai;Mips;MSP430;NVPTX;PowerPC;RISCV;Sparc;SystemZ;VE;WebAssembly;X86;XCore" ``` III. TODO ========= - [ ] Host Build - [ ] zig on Target - [ ] Cross/Canadian - [ ] Vendor LLVM to match zig required version - [ ] CI
0
repos/meta-zig/recipes-example/hello-zig
repos/meta-zig/recipes-example/hello-zig/files/build.zig
const std = @import("std"); pub fn build(b: *std.build.Builder) void { // Standard target options allows the person running `zig build` to choose // what target to build for. Here we do not override the defaults, which // means any target is allowed, and the default is native. Other options // for restricting supported target set are available. const target = b.standardTargetOptions(.{}); // Standard release options allow the person running `zig build` to select // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. const mode = b.standardReleaseOptions(); const exe = b.addExecutable("hello", "src/main.zig"); exe.setTarget(target); exe.setBuildMode(mode); exe.install(); const run_cmd = exe.run(); run_cmd.step.dependOn(b.getInstallStep()); if (b.args) |args| { run_cmd.addArgs(args); } const run_step = b.step("run", "Run the app"); run_step.dependOn(&run_cmd.step); const exe_tests = b.addTest("src/main.zig"); exe_tests.setTarget(target); exe_tests.setBuildMode(mode); const test_step = b.step("test", "Run unit tests"); test_step.dependOn(&exe_tests.step); }
0
repos/meta-zig/recipes-example/hello-zig/files
repos/meta-zig/recipes-example/hello-zig/files/src/main.zig
const std = @import("std"); pub fn main() !void { // Prints to stderr (it's a shortcut based on `std.io.getStdErr()`) std.debug.print("All your {s} are belong to us.\n", .{"codebase"}); // stdout is for the actual output of your application, for example if you // are implementing gzip, then only the compressed bytes should be sent to // stdout, not any debugging messages. const stdout_file = std.io.getStdOut().writer(); var bw = std.io.bufferedWriter(stdout_file); const stdout = bw.writer(); try stdout.print("Run `zig build test` to run the tests.\n", .{}); try bw.flush(); // don't forget to flush! } test "simple test" { var list = std.ArrayList(i32).init(std.testing.allocator); defer list.deinit(); // try commenting this out and see if zig detects the memory leak! try list.append(42); try std.testing.expectEqual(@as(i32, 42), list.pop()); }
0
repos/meta-zig
repos/meta-zig/conf/layer.conf
# We have a conf and classes directory, add to BBPATH BBPATH .= ":${LAYERDIR}" # We have recipes-* directories, add to BBFILES BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ ${LAYERDIR}/recipes-*/*/*.bbappend" BBFILE_COLLECTIONS += "meta-zig" BBFILE_PATTERN_meta-zig = "^${LAYERDIR}/" BBFILE_PRIORITY_meta-zig = "6" LAYERDEPENDS_meta-zig = "core clang-layer" LAYERSERIES_COMPAT_meta-zig = "mickledore"
0
repos
repos/scafetch/README.md
# scafetch [![CI](https://github.com/iddev5/scafetch/actions/workflows/ci.yml/badge.svg)](https://github.com/iddev5/scafetch/actions) [![license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.md) [![zig](https://img.shields.io/badge/zig-0.13.0-orange.svg)](https://ziglang.org) Scafetch is a command-line tool to display information about your remote Git repositories in an aesthetic and visually pleasing way. It currently supports fetching repository information from Github, Gitlab and Codeberg (Gitea). ![](.data/scafetch.png) # Installation ## Releases You can get the latest stable [release](https://github.com/iddev5/scafetch/releases) from Github. ## Arch Linux (AUR) Install the community maintained [scafetch](https://aur.archlinux.org/packages/scafetch) package. # Usage You only need Zig master to compile. Use zig to build: ``` zig build -Doptimize=ReleaseSafe ``` (You can optionally install it in a system or user wide directory for easier access, use the ``-p <prefix>`` flag for convenience) Then, run the application: ``` ./zig-out/bin/scafetch ziglang/zig ``` where ``ziglang/zig`` is taken as an example repository address, and the host defaults to Github It is also possible to explicitly state the host service name using ``-o <hostname>`` flag. See ``--help`` for more information. Scafetch can additionally infer the host service from hints present in the given URL: Host name | 1 | 2 | 3 ----------|------------------------|------------------------------|--------------------------------- Github | ``gh/<author>/<repo>`` | ``github/<author>/<repo>`` | ``github.com/<author>/<repo>`` Gitlab | ``gl/<author>/<repo>`` | ``gitlab/<author>/<repo>`` | ``gitlab.com/<author>/<repo>`` Codeberg | ``cb/<author>/<repo>`` | ``codeberg/<author>/<repo>`` | ``codeberg.org/<author>/<repo>`` # Todo - More CLI flags, like opt out of coloring, what info to display etc. - Authentication support - Show an ASCII art of the primary language(?) of the repository # License scafetch is licensed under [MIT License](LICENSE)
0
repos
repos/scafetch/build.zig.zon
.{ .name = "scafetch", .version = "0.2.0", .dependencies = .{ .@"ay-arg" = .{ .url = "https://github.com/iddev5/ay-arg/archive/80c1df8b85214bd8d3bd61458cd9e6533880dc1f.tar.gz", .hash = "1220f6bf8688b796e101d40594ad2087f38fed3b0a213e5ddc6613d2b1b289ffa82d", } }, .paths = .{ "build.zig", "build.zig.zon", "src", "LICENSE", "README.md", }, }