gmock/gtest/include/gtest/internal/gtest-internal.h
Go to the documentation of this file.
1 // Copyright 2005, Google Inc.
2 // All rights reserved.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are
6 // met:
7 //
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above
11 // copyright notice, this list of conditions and the following disclaimer
12 // in the documentation and/or other materials provided with the
13 // distribution.
14 // * Neither the name of Google Inc. nor the names of its
15 // contributors may be used to endorse or promote products derived from
16 // this software without specific prior written permission.
17 //
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
31 //
32 // The Google C++ Testing Framework (Google Test)
33 //
34 // This header file declares functions and macros used internally by
35 // Google Test. They are subject to change without notice.
36 
37 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
38 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
39 
40 #include "gtest/internal/gtest-port.h"
41 
42 #if GTEST_OS_LINUX
43 # include <stdlib.h>
44 # include <sys/types.h>
45 # include <sys/wait.h>
46 # include <unistd.h>
47 #endif // GTEST_OS_LINUX
48 
49 #if GTEST_HAS_EXCEPTIONS
50 # include <stdexcept>
51 #endif
52 
53 #include <ctype.h>
54 #include <float.h>
55 #include <string.h>
56 #include <iomanip>
57 #include <limits>
58 #include <set>
59 
60 #include "gtest/gtest-message.h"
61 #include "gtest/internal/gtest-string.h"
62 #include "gtest/internal/gtest-filepath.h"
63 #include "gtest/internal/gtest-type-util.h"
64 
65 // Due to C++ preprocessor weirdness, we need double indirection to
66 // concatenate two tokens when one of them is __LINE__. Writing
67 //
68 // foo ## __LINE__
69 //
70 // will result in the token foo__LINE__, instead of foo followed by
71 // the current line number. For more details, see
72 // http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.6
73 #define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar)
74 #define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo ## bar
75 
76 class ProtocolMessage;
77 namespace proto2 { class Message; }
78 
79 namespace testing
80 {
81 
82 // Forward declarations.
83 
84 class AssertionResult; // Result of an assertion.
85 class Message; // Represents a failure message.
86 class Test; // Represents a test.
87 class TestInfo; // Information about a test.
88 class TestPartResult; // Result of a test part.
89 class UnitTest; // A collection of test cases.
90 
91 template <typename T>
92 ::std::string PrintToString(const T & value);
93 
94 namespace internal
95 {
96 
97 struct TraceInfo; // Information about a trace point.
98 class ScopedTrace; // Implements scoped trace.
99 class TestInfoImpl; // Opaque implementation of TestInfo
100 class UnitTestImpl; // Opaque implementation of UnitTest
101 
102 // How many times InitGoogleTest() has been called.
103 GTEST_API_ extern int g_init_gtest_count;
104 
105 // The text used in failure messages to indicate the start of the
106 // stack trace.
107 GTEST_API_ extern const char kStackTraceMarker[];
108 
109 // Two overloaded helpers for checking at compile time whether an
110 // expression is a null pointer literal (i.e. NULL or any 0-valued
111 // compile-time integral constant). Their return values have
112 // different sizes, so we can use sizeof() to test which version is
113 // picked by the compiler. These helpers have no implementations, as
114 // we only need their signatures.
115 //
116 // Given IsNullLiteralHelper(x), the compiler will pick the first
117 // version if x can be implicitly converted to Secret*, and pick the
118 // second version otherwise. Since Secret is a secret and incomplete
119 // type, the only expression a user can write that has type Secret* is
120 // a null pointer literal. Therefore, we know that x is a null
121 // pointer literal if and only if the first version is picked by the
122 // compiler.
123 char IsNullLiteralHelper(Secret * p);
124 char (&IsNullLiteralHelper(...))[2]; // NOLINT
125 
126 // A compile-time bool constant that is true if and only if x is a
127 // null pointer literal (i.e. NULL or any 0-valued compile-time
128 // integral constant).
129 #ifdef GTEST_ELLIPSIS_NEEDS_POD_
130 // We lose support for NULL detection where the compiler doesn't like
131 // passing non-POD classes through ellipsis (...).
132 # define GTEST_IS_NULL_LITERAL_(x) false
133 #else
134 # define GTEST_IS_NULL_LITERAL_(x) \
135  (sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1)
136 #endif // GTEST_ELLIPSIS_NEEDS_POD_
137 
138 // Appends the user-supplied message to the Google-Test-generated message.
140  const std::string & gtest_msg, const Message & user_msg);
141 
142 #if GTEST_HAS_EXCEPTIONS
143 
144 // This exception is thrown by (and only by) a failed Google Test
145 // assertion when GTEST_FLAG(throw_on_failure) is true (if exceptions
146 // are enabled). We derive it from std::runtime_error, which is for
147 // errors presumably detectable only at run time. Since
148 // std::runtime_error inherits from std::exception, many testing
149 // frameworks know how to extract and print the message inside it.
150 class GTEST_API_ GoogleTestFailureException : public ::std::runtime_error
151 {
152 public:
153  explicit GoogleTestFailureException(const TestPartResult & failure);
154 };
155 
156 #endif // GTEST_HAS_EXCEPTIONS
157 
158 // A helper class for creating scoped traces in user programs.
159 class GTEST_API_ ScopedTrace
160 {
161 public:
162  // The c'tor pushes the given source file location and message onto
163  // a trace stack maintained by Google Test.
164  ScopedTrace(const char * file, int line, const Message & message);
165 
166  // The d'tor pops the info pushed by the c'tor.
167  //
168  // Note that the d'tor is not virtual in order to be efficient.
169  // Don't inherit from ScopedTrace!
170  ~ScopedTrace();
171 
172 private:
173  GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedTrace);
174 } GTEST_ATTRIBUTE_UNUSED_; // A ScopedTrace object does its job in its
175 // c'tor and d'tor. Therefore it doesn't
176 // need to be used otherwise.
177 
178 // Constructs and returns the message for an equality assertion
179 // (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure.
180 //
181 // The first four parameters are the expressions used in the assertion
182 // and their values, as strings. For example, for ASSERT_EQ(foo, bar)
183 // where foo is 5 and bar is 6, we have:
184 //
185 // expected_expression: "foo"
186 // actual_expression: "bar"
187 // expected_value: "5"
188 // actual_value: "6"
189 //
190 // The ignoring_case parameter is true iff the assertion is a
191 // *_STRCASEEQ*. When it's true, the string " (ignoring case)" will
192 // be inserted into the message.
193 GTEST_API_ AssertionResult EqFailure(const char * expected_expression,
194  const char * actual_expression,
195  const std::string & expected_value,
196  const std::string & actual_value,
197  bool ignoring_case);
198 
199 // Constructs a failure message for Boolean assertions such as EXPECT_TRUE.
201  const AssertionResult & assertion_result,
202  const char * expression_text,
203  const char * actual_predicate_value,
204  const char * expected_predicate_value);
205 
206 // This template class represents an IEEE floating-point number
207 // (either single-precision or double-precision, depending on the
208 // template parameters).
209 //
210 // The purpose of this class is to do more sophisticated number
211 // comparison. (Due to round-off error, etc, it's very unlikely that
212 // two floating-points will be equal exactly. Hence a naive
213 // comparison by the == operation often doesn't work.)
214 //
215 // Format of IEEE floating-point:
216 //
217 // The most-significant bit being the leftmost, an IEEE
218 // floating-point looks like
219 //
220 // sign_bit exponent_bits fraction_bits
221 //
222 // Here, sign_bit is a single bit that designates the sign of the
223 // number.
224 //
225 // For float, there are 8 exponent bits and 23 fraction bits.
226 //
227 // For double, there are 11 exponent bits and 52 fraction bits.
228 //
229 // More details can be found at
230 // http://en.wikipedia.org/wiki/IEEE_floating-point_standard.
231 //
232 // Template parameter:
233 //
234 // RawType: the raw floating-point type (either float or double)
235 template <typename RawType>
236 class FloatingPoint
237 {
238 public:
239  // Defines the unsigned integer type that has the same size as the
240  // floating point number.
242 
243  // Constants.
244 
245  // # of bits in a number.
246  static const size_t kBitCount = 8 * sizeof(RawType);
247 
248  // # of fraction bits in a number.
249  static const size_t kFractionBitCount =
250  std::numeric_limits<RawType>::digits - 1;
251 
252  // # of exponent bits in a number.
253  static const size_t kExponentBitCount = kBitCount - 1 - kFractionBitCount;
254 
255  // The mask for the sign bit.
256  static const Bits kSignBitMask = static_cast<Bits>(1) << (kBitCount - 1);
257 
258  // The mask for the fraction bits.
259  static const Bits kFractionBitMask =
260  ~static_cast<Bits>(0) >> (kExponentBitCount + 1);
261 
262  // The mask for the exponent bits.
263  static const Bits kExponentBitMask = ~(kSignBitMask | kFractionBitMask);
264 
265  // How many ULP's (Units in the Last Place) we want to tolerate when
266  // comparing two numbers. The larger the value, the more error we
267  // allow. A 0 value means that two numbers must be exactly the same
268  // to be considered equal.
269  //
270  // The maximum error of a single floating-point operation is 0.5
271  // units in the last place. On Intel CPU's, all floating-point
272  // calculations are done with 80-bit precision, while double has 64
273  // bits. Therefore, 4 should be enough for ordinary use.
274  //
275  // See the following article for more details on ULP:
276  // http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
277  static const size_t kMaxUlps = 4;
278 
279  // Constructs a FloatingPoint from a raw floating-point number.
280  //
281  // On an Intel CPU, passing a non-normalized NAN (Not a Number)
282  // around may change its bits, although the new value is guaranteed
283  // to be also a NAN. Therefore, don't expect this constructor to
284  // preserve the bits in x when x is a NAN.
285  explicit FloatingPoint(const RawType & x) { u_.value_ = x; }
286 
287  // Static methods
288 
289  // Reinterprets a bit pattern as a floating-point number.
290  //
291  // This function is needed to test the AlmostEquals() method.
292  static RawType ReinterpretBits(const Bits bits)
293  {
294  FloatingPoint fp(0);
295  fp.u_.bits_ = bits;
296  return fp.u_.value_;
297  }
298 
299  // Returns the floating-point number that represent positive infinity.
300  static RawType Infinity()
301  {
302  return ReinterpretBits(kExponentBitMask);
303  }
304 
305  // Returns the maximum representable finite floating-point number.
306  static RawType Max();
307 
308  // Non-static methods
309 
310  // Returns the bits that represents this number.
311  const Bits & bits() const { return u_.bits_; }
312 
313  // Returns the exponent bits of this number.
314  Bits exponent_bits() const { return kExponentBitMask & u_.bits_; }
315 
316  // Returns the fraction bits of this number.
317  Bits fraction_bits() const { return kFractionBitMask & u_.bits_; }
318 
319  // Returns the sign bit of this number.
320  Bits sign_bit() const { return kSignBitMask & u_.bits_; }
321 
322  // Returns true iff this is NAN (not a number).
323  bool is_nan() const
324  {
325  // It's a NAN if the exponent bits are all ones and the fraction
326  // bits are not entirely zeros.
327  return (exponent_bits() == kExponentBitMask) && (fraction_bits() != 0);
328  }
329 
330  // Returns true iff this number is at most kMaxUlps ULP's away from
331  // rhs. In particular, this function:
332  //
333  // - returns false if either number is (or both are) NAN.
334  // - treats really large numbers as almost equal to infinity.
335  // - thinks +0.0 and -0.0 are 0 DLP's apart.
336  bool AlmostEquals(const FloatingPoint & rhs) const
337  {
338  // The IEEE standard says that any comparison operation involving
339  // a NAN must return false.
340  if (is_nan() || rhs.is_nan()) { return false; }
341 
342  return DistanceBetweenSignAndMagnitudeNumbers(u_.bits_, rhs.u_.bits_)
343  <= kMaxUlps;
344  }
345 
346 private:
347  // The data type used to store the actual floating-point number.
348  union FloatingPointUnion
349  {
350  RawType value_; // The raw floating-point number.
351  Bits bits_; // The bits that represent the number.
352  };
353 
354  // Converts an integer from the sign-and-magnitude representation to
355  // the biased representation. More precisely, let N be 2 to the
356  // power of (kBitCount - 1), an integer x is represented by the
357  // unsigned number x + N.
358  //
359  // For instance,
360  //
361  // -N + 1 (the most negative number representable using
362  // sign-and-magnitude) is represented by 1;
363  // 0 is represented by N; and
364  // N - 1 (the biggest number representable using
365  // sign-and-magnitude) is represented by 2N - 1.
366  //
367  // Read http://en.wikipedia.org/wiki/Signed_number_representations
368  // for more details on signed number representations.
369  static Bits SignAndMagnitudeToBiased(const Bits & sam)
370  {
371  if (kSignBitMask & sam)
372  {
373  // sam represents a negative number.
374  return ~sam + 1;
375  }
376 
377  else
378  {
379  // sam represents a positive number.
380  return kSignBitMask | sam;
381  }
382  }
383 
384  // Given two numbers in the sign-and-magnitude representation,
385  // returns the distance between them as an unsigned number.
386  static Bits DistanceBetweenSignAndMagnitudeNumbers(const Bits & sam1,
387  const Bits & sam2)
388  {
389  const Bits biased1 = SignAndMagnitudeToBiased(sam1);
390  const Bits biased2 = SignAndMagnitudeToBiased(sam2);
391  return (biased1 >= biased2) ? (biased1 - biased2) : (biased2 - biased1);
392  }
393 
395 };
396 
397 // We cannot use std::numeric_limits<T>::max() as it clashes with the max()
398 // macro defined by <windows.h>.
399 template <>
400 inline float FloatingPoint<float>::Max() { return FLT_MAX; }
401 template <>
402 inline double FloatingPoint<double>::Max() { return DBL_MAX; }
403 
404 // Typedefs the instances of the FloatingPoint template class that we
405 // care to use.
408 
409 // In order to catch the mistake of putting tests that use different
410 // test fixture classes in the same test case, we need to assign
411 // unique IDs to fixture classes and compare them. The TypeId type is
412 // used to hold such IDs. The user should treat TypeId as an opaque
413 // type: the only operation allowed on TypeId values is to compare
414 // them for equality using the == operator.
415 typedef const void * TypeId;
416 
417 template <typename T>
418 class TypeIdHelper
419 {
420 public:
421  // dummy_ must not have a const type. Otherwise an overly eager
422  // compiler (e.g. MSVC 7.1 & 8.0) may try to merge
423  // TypeIdHelper<T>::dummy_ for different Ts as an "optimization".
424  static bool dummy_;
425 };
426 
427 template <typename T>
428 bool TypeIdHelper<T>::dummy_ = false;
429 
430 // GetTypeId<T>() returns the ID of type T. Different values will be
431 // returned for different types. Calling the function twice with the
432 // same type argument is guaranteed to return the same ID.
433 template <typename T>
434 TypeId GetTypeId()
435 {
436  // The compiler is required to allocate a different
437  // TypeIdHelper<T>::dummy_ variable for each T used to instantiate
438  // the template. Therefore, the address of dummy_ is guaranteed to
439  // be unique.
440  return &(TypeIdHelper<T>::dummy_);
441 }
442 
443 // Returns the type ID of ::testing::Test. Always call this instead
444 // of GetTypeId< ::testing::Test>() to get the type ID of
445 // ::testing::Test, as the latter may give the wrong result due to a
446 // suspected linker bug when compiling Google Test as a Mac OS X
447 // framework.
448 GTEST_API_ TypeId GetTestTypeId();
449 
450 // Defines the abstract factory interface that creates instances
451 // of a Test object.
452 class TestFactoryBase
453 {
454 public:
455  virtual ~TestFactoryBase() {}
456 
457  // Creates a test instance to run. The instance is both created and destroyed
458  // within TestInfoImpl::Run()
459  virtual Test * CreateTest() = 0;
460 
461 protected:
463 
464 private:
466 };
467 
468 // This class provides implementation of TeastFactoryBase interface.
469 // It is used in TEST and TEST_F macros.
470 template <class TestClass>
471 class TestFactoryImpl : public TestFactoryBase
472 {
473 public:
474  virtual Test * CreateTest() { return new TestClass; }
475 };
476 
477 #if GTEST_OS_WINDOWS
478 
479 // Predicate-formatters for implementing the HRESULT checking macros
480 // {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}
481 // We pass a long instead of HRESULT to avoid causing an
482 // include dependency for the HRESULT type.
483 GTEST_API_ AssertionResult IsHRESULTSuccess(const char * expr,
484  long hr); // NOLINT
485 GTEST_API_ AssertionResult IsHRESULTFailure(const char * expr,
486  long hr); // NOLINT
487 
488 #endif // GTEST_OS_WINDOWS
489 
490 // Types of SetUpTestCase() and TearDownTestCase() functions.
491 typedef void (*SetUpTestCaseFunc)();
492 typedef void (*TearDownTestCaseFunc)();
493 
494 // Creates a new TestInfo object and registers it with Google Test;
495 // returns the created object.
496 //
497 // Arguments:
498 //
499 // test_case_name: name of the test case
500 // name: name of the test
501 // type_param the name of the test's type parameter, or NULL if
502 // this is not a typed or a type-parameterized test.
503 // value_param text representation of the test's value parameter,
504 // or NULL if this is not a type-parameterized test.
505 // fixture_class_id: ID of the test fixture class
506 // set_up_tc: pointer to the function that sets up the test case
507 // tear_down_tc: pointer to the function that tears down the test case
508 // factory: pointer to the factory that creates a test object.
509 // The newly created TestInfo instance will assume
510 // ownership of the factory object.
512  const char * test_case_name,
513  const char * name,
514  const char * type_param,
515  const char * value_param,
516  TypeId fixture_class_id,
517  SetUpTestCaseFunc set_up_tc,
518  TearDownTestCaseFunc tear_down_tc,
519  TestFactoryBase * factory);
520 
521 // If *pstr starts with the given prefix, modifies *pstr to be right
522 // past the prefix and returns true; otherwise leaves *pstr unchanged
523 // and returns false. None of pstr, *pstr, and prefix can be NULL.
524 GTEST_API_ bool SkipPrefix(const char * prefix, const char ** pstr);
525 
526 #if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
527 
528 // State of the definition of a type-parameterized test case.
529 class GTEST_API_ TypedTestCasePState
530 {
531 public:
532  TypedTestCasePState() : registered_(false) {}
533 
534  // Adds the given test name to defined_test_names_ and return true
535  // if the test case hasn't been registered; otherwise aborts the
536  // program.
537  bool AddTestName(const char * file, int line, const char * case_name,
538  const char * test_name)
539  {
540  if (registered_)
541  {
542  fprintf(stderr, "%s Test %s must be defined before "
543  "REGISTER_TYPED_TEST_CASE_P(%s, ...).\n",
544  FormatFileLocation(file, line).c_str(), test_name, case_name);
545  fflush(stderr);
546  posix::Abort();
547  }
548 
549  defined_test_names_.insert(test_name);
550  return true;
551  }
552 
553  // Verifies that registered_tests match the test names in
554  // defined_test_names_; returns registered_tests if successful, or
555  // aborts the program otherwise.
556  const char * VerifyRegisteredTestNames(
557  const char * file, int line, const char * registered_tests);
558 
559 private:
560  bool registered_;
561  ::std::set<const char *> defined_test_names_;
562 };
563 
564 // Skips to the first non-space char after the first comma in 'str';
565 // returns NULL if no comma is found in 'str'.
566 inline const char * SkipComma(const char * str)
567 {
568  const char * comma = strchr(str, ',');
569 
570  if (comma == NULL)
571  {
572  return NULL;
573  }
574 
575  while (IsSpace(*(++comma))) {}
576 
577  return comma;
578 }
579 
580 // Returns the prefix of 'str' before the first comma in it; returns
581 // the entire string if it contains no comma.
582 inline std::string GetPrefixUntilComma(const char * str)
583 {
584  const char * comma = strchr(str, ',');
585  return comma == NULL ? str : std::string(str, comma);
586 }
587 
588 // TypeParameterizedTest<Fixture, TestSel, Types>::Register()
589 // registers a list of type-parameterized tests with Google Test. The
590 // return value is insignificant - we just need to return something
591 // such that we can call this function in a namespace scope.
592 //
593 // Implementation note: The GTEST_TEMPLATE_ macro declares a template
594 // template parameter. It's defined in gtest-type-util.h.
595 template <GTEST_TEMPLATE_ Fixture, class TestSel, typename Types>
596 class TypeParameterizedTest
597 {
598 public:
599  // 'index' is the index of the test in the type list 'Types'
600  // specified in INSTANTIATE_TYPED_TEST_CASE_P(Prefix, TestCase,
601  // Types). Valid values for 'index' are [0, N - 1] where N is the
602  // length of Types.
603  static bool Register(const char * prefix, const char * case_name,
604  const char * test_names, int index)
605  {
606  typedef typename Types::Head Type;
607  typedef Fixture<Type> FixtureClass;
608  typedef typename GTEST_BIND_(TestSel, Type) TestClass;
609 
610  // First, registers the first type-parameterized test in the type
611  // list.
613  (std::string(prefix) + (prefix[0] == '\0' ? "" : "/") + case_name + "/"
614  + StreamableToString(index)).c_str(),
615  GetPrefixUntilComma(test_names).c_str(),
616  GetTypeName<Type>().c_str(),
617  NULL, // No value parameter.
618  GetTypeId<FixtureClass>(),
619  TestClass::SetUpTestCase,
620  TestClass::TearDownTestCase,
622 
623  // Next, recurses (at compile time) with the tail of the type list.
624  return TypeParameterizedTest<Fixture, TestSel, typename Types::Tail>
625  ::Register(prefix, case_name, test_names, index + 1);
626  }
627 };
628 
629 // The base case for the compile time recursion.
630 template <GTEST_TEMPLATE_ Fixture, class TestSel>
631 class TypeParameterizedTest<Fixture, TestSel, Types0>
632 {
633 public:
634  static bool Register(const char * /*prefix*/, const char * /*case_name*/,
635  const char * /*test_names*/, int /*index*/)
636  {
637  return true;
638  }
639 };
640 
641 // TypeParameterizedTestCase<Fixture, Tests, Types>::Register()
642 // registers *all combinations* of 'Tests' and 'Types' with Google
643 // Test. The return value is insignificant - we just need to return
644 // something such that we can call this function in a namespace scope.
645 template <GTEST_TEMPLATE_ Fixture, typename Tests, typename Types>
646 class TypeParameterizedTestCase
647 {
648 public:
649  static bool Register(const char * prefix, const char * case_name,
650  const char * test_names)
651  {
652  typedef typename Tests::Head Head;
653 
654  // First, register the first test in 'Test' for each type in 'Types'.
655  TypeParameterizedTest<Fixture, Head, Types>::Register(
656  prefix, case_name, test_names, 0);
657 
658  // Next, recurses (at compile time) with the tail of the test list.
659  return TypeParameterizedTestCase<Fixture, typename Tests::Tail, Types>
660  ::Register(prefix, case_name, SkipComma(test_names));
661  }
662 };
663 
664 // The base case for the compile time recursion.
665 template <GTEST_TEMPLATE_ Fixture, typename Types>
666 class TypeParameterizedTestCase<Fixture, Templates0, Types>
667 {
668 public:
669  static bool Register(const char * /*prefix*/, const char * /*case_name*/,
670  const char * /*test_names*/)
671  {
672  return true;
673  }
674 };
675 
676 #endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
677 
678 // Returns the current OS stack trace as an std::string.
679 //
680 // The maximum number of stack frames to be included is specified by
681 // the gtest_stack_trace_depth flag. The skip_count parameter
682 // specifies the number of top frames to be skipped, which doesn't
683 // count against the number of frames to be included.
684 //
685 // For example, if Foo() calls Bar(), which in turn calls
686 // GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in
687 // the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't.
689  UnitTest * unit_test, int skip_count);
690 
691 // Helpers for suppressing warnings on unreachable code or constant
692 // condition.
693 
694 // Always returns true.
695 GTEST_API_ bool AlwaysTrue();
696 
697 // Always returns false.
698 inline bool AlwaysFalse() { return !AlwaysTrue(); }
699 
700 // Helper for suppressing false warning from Clang on a const char*
701 // variable declared in a conditional expression always being NULL in
702 // the else branch.
703 struct GTEST_API_ ConstCharPtr
704 {
705  ConstCharPtr(const char * str) : value(str) {}
706  operator bool() const { return true; }
707  const char * value;
708 };
709 
710 // A simple Linear Congruential Generator for generating random
711 // numbers with a uniform distribution. Unlike rand() and srand(), it
712 // doesn't use global state (and therefore can't interfere with user
713 // code). Unlike rand_r(), it's portable. An LCG isn't very random,
714 // but it's good enough for our purposes.
715 class GTEST_API_ Random
716 {
717 public:
718  static const UInt32 kMaxRange = 1u << 31;
719 
720  explicit Random(UInt32 seed) : state_(seed) {}
721 
722  void Reseed(UInt32 seed) { state_ = seed; }
723 
724  // Generates a random number from [0, range). Crashes if 'range' is
725  // 0 or greater than kMaxRange.
726  UInt32 Generate(UInt32 range);
727 
728 private:
729  UInt32 state_;
731 };
732 
733 // Defining a variable of type CompileAssertTypesEqual<T1, T2> will cause a
734 // compiler error iff T1 and T2 are different types.
735 template <typename T1, typename T2>
737 
738 template <typename T>
739 struct CompileAssertTypesEqual<T, T>
740 {
741 };
742 
743 // Removes the reference from a type if it is a reference type,
744 // otherwise leaves it unchanged. This is the same as
745 // tr1::remove_reference, which is not widely available yet.
746 template <typename T>
747 struct RemoveReference { typedef T type; }; // NOLINT
748 template <typename T>
749 struct RemoveReference<T &> { typedef T type; }; // NOLINT
750 
751 // A handy wrapper around RemoveReference that works when the argument
752 // T depends on template parameters.
753 #define GTEST_REMOVE_REFERENCE_(T) \
754  typename ::testing::internal::RemoveReference<T>::type
755 
756 // Removes const from a type if it is a const type, otherwise leaves
757 // it unchanged. This is the same as tr1::remove_const, which is not
758 // widely available yet.
759 template <typename T>
760 struct RemoveConst { typedef T type; }; // NOLINT
761 template <typename T>
762 struct RemoveConst<const T> { typedef T type; }; // NOLINT
763 
764 // MSVC 8.0, Sun C++, and IBM XL C++ have a bug which causes the above
765 // definition to fail to remove the const in 'const int[3]' and 'const
766 // char[3][4]'. The following specialization works around the bug.
767 template <typename T, size_t N>
768 struct RemoveConst<const T[N]>
769 {
770  typedef typename RemoveConst<T>::type type[N];
771 };
772 
773 #if defined(_MSC_VER) && _MSC_VER < 1400
774 // This is the only specialization that allows VC++ 7.1 to remove const in
775 // 'const int[3] and 'const int[3][4]'. However, it causes trouble with GCC
776 // and thus needs to be conditionally compiled.
777 template <typename T, size_t N>
778 struct RemoveConst<T[N]>
779 {
780  typedef typename RemoveConst<T>::type type[N];
781 };
782 #endif
783 
784 // A handy wrapper around RemoveConst that works when the argument
785 // T depends on template parameters.
786 #define GTEST_REMOVE_CONST_(T) \
787  typename ::testing::internal::RemoveConst<T>::type
788 
789 // Turns const U&, U&, const U, and U all into U.
790 #define GTEST_REMOVE_REFERENCE_AND_CONST_(T) \
791  GTEST_REMOVE_CONST_(GTEST_REMOVE_REFERENCE_(T))
792 
793 // Adds reference to a type if it is not a reference type,
794 // otherwise leaves it unchanged. This is the same as
795 // tr1::add_reference, which is not widely available yet.
796 template <typename T>
797 struct AddReference { typedef T & type; }; // NOLINT
798 template <typename T>
799 struct AddReference<T &> { typedef T & type; }; // NOLINT
800 
801 // A handy wrapper around AddReference that works when the argument T
802 // depends on template parameters.
803 #define GTEST_ADD_REFERENCE_(T) \
804  typename ::testing::internal::AddReference<T>::type
805 
806 // Adds a reference to const on top of T as necessary. For example,
807 // it transforms
808 //
809 // char ==> const char&
810 // const char ==> const char&
811 // char& ==> const char&
812 // const char& ==> const char&
813 //
814 // The argument T must depend on some template parameters.
815 #define GTEST_REFERENCE_TO_CONST_(T) \
816  GTEST_ADD_REFERENCE_(const GTEST_REMOVE_REFERENCE_(T))
817 
818 // ImplicitlyConvertible<From, To>::value is a compile-time bool
819 // constant that's true iff type From can be implicitly converted to
820 // type To.
821 template <typename From, typename To>
822 class ImplicitlyConvertible
823 {
824 private:
825  // We need the following helper functions only for their types.
826  // They have no implementations.
827 
828  // MakeFrom() is an expression whose type is From. We cannot simply
829  // use From(), as the type From may not have a public default
830  // constructor.
831  static From MakeFrom();
832 
833  // These two functions are overloaded. Given an expression
834  // Helper(x), the compiler will pick the first version if x can be
835  // implicitly converted to type To; otherwise it will pick the
836  // second version.
837  //
838  // The first version returns a value of size 1, and the second
839  // version returns a value of size 2. Therefore, by checking the
840  // size of Helper(x), which can be done at compile time, we can tell
841  // which version of Helper() is used, and hence whether x can be
842  // implicitly converted to type To.
843  static char Helper(To);
844  static char (&Helper(...))[2]; // NOLINT
845 
846  // We have to put the 'public' section after the 'private' section,
847  // or MSVC refuses to compile the code.
848 public:
849  // MSVC warns about implicitly converting from double to int for
850  // possible loss of data, so we need to temporarily disable the
851  // warning.
852 #ifdef _MSC_VER
853 # pragma warning(push) // Saves the current warning state.
854 # pragma warning(disable:4244) // Temporarily disables warning 4244.
855 
856  static const bool value =
857  sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1;
858 # pragma warning(pop) // Restores the warning state.
859 #elif defined(__BORLANDC__)
860  // C++Builder cannot use member overload resolution during template
861  // instantiation. The simplest workaround is to use its C++0x type traits
862  // functions (C++Builder 2009 and above only).
863  static const bool value = __is_convertible(From, To);
864 #else
865  static const bool value =
866  sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1;
867 #endif // _MSV_VER
868 };
869 template <typename From, typename To>
870 const bool ImplicitlyConvertible<From, To>::value;
871 
872 // IsAProtocolMessage<T>::value is a compile-time bool constant that's
873 // true iff T is type ProtocolMessage, proto2::Message, or a subclass
874 // of those.
875 template <typename T>
876 struct IsAProtocolMessage
877  : public bool_constant <
878  ImplicitlyConvertible<const T *, const ::ProtocolMessage *>::value ||
879  ImplicitlyConvertible<const T *, const ::proto2::Message *>::value >
880 {
881 };
882 
883 // When the compiler sees expression IsContainerTest<C>(0), if C is an
884 // STL-style container class, the first overload of IsContainerTest
885 // will be viable (since both C::iterator* and C::const_iterator* are
886 // valid types and NULL can be implicitly converted to them). It will
887 // be picked over the second overload as 'int' is a perfect match for
888 // the type of argument 0. If C::iterator or C::const_iterator is not
889 // a valid type, the first overload is not viable, and the second
890 // overload will be picked. Therefore, we can determine whether C is
891 // a container class by checking the type of IsContainerTest<C>(0).
892 // The value of the expression is insignificant.
893 //
894 // Note that we look for both C::iterator and C::const_iterator. The
895 // reason is that C++ injects the name of a class as a member of the
896 // class itself (e.g. you can refer to class iterator as either
897 // 'iterator' or 'iterator::iterator'). If we look for C::iterator
898 // only, for example, we would mistakenly think that a class named
899 // iterator is an STL container.
900 //
901 // Also note that the simpler approach of overloading
902 // IsContainerTest(typename C::const_iterator*) and
903 // IsContainerTest(...) doesn't work with Visual Age C++ and Sun C++.
904 typedef int IsContainer;
905 template <class C>
906 IsContainer IsContainerTest(int /* dummy */,
907  typename C::iterator * /* it */ = NULL,
908  typename C::const_iterator * /* const_it */ = NULL)
909 {
910  return 0;
911 }
912 
913 typedef char IsNotContainer;
914 template <class C>
915 IsNotContainer IsContainerTest(long /* dummy */) { return '\0'; }
916 
917 // EnableIf<condition>::type is void when 'Cond' is true, and
918 // undefined when 'Cond' is false. To use SFINAE to make a function
919 // overload only apply when a particular expression is true, add
920 // "typename EnableIf<expression>::type* = 0" as the last parameter.
921 template<bool> struct EnableIf;
922 template<> struct EnableIf<true> { typedef void type; }; // NOLINT
923 
924 // Utilities for native arrays.
925 
926 // ArrayEq() compares two k-dimensional native arrays using the
927 // elements' operator==, where k can be any integer >= 0. When k is
928 // 0, ArrayEq() degenerates into comparing a single pair of values.
929 
930 template <typename T, typename U>
931 bool ArrayEq(const T * lhs, size_t size, const U * rhs);
932 
933 // This generic version is used when k is 0.
934 template <typename T, typename U>
935 inline bool ArrayEq(const T & lhs, const U & rhs) { return lhs == rhs; }
936 
937 // This overload is used when k >= 1.
938 template <typename T, typename U, size_t N>
939 inline bool ArrayEq(const T(&lhs)[N], const U(&rhs)[N])
940 {
941  return internal::ArrayEq(lhs, N, rhs);
942 }
943 
944 // This helper reduces code bloat. If we instead put its logic inside
945 // the previous ArrayEq() function, arrays with different sizes would
946 // lead to different copies of the template code.
947 template <typename T, typename U>
948 bool ArrayEq(const T * lhs, size_t size, const U * rhs)
949 {
950  for (size_t i = 0; i != size; i++)
951  {
952  if (!internal::ArrayEq(lhs[i], rhs[i]))
953  { return false; }
954  }
955 
956  return true;
957 }
958 
959 // Finds the first element in the iterator range [begin, end) that
960 // equals elem. Element may be a native array type itself.
961 template <typename Iter, typename Element>
962 Iter ArrayAwareFind(Iter begin, Iter end, const Element & elem)
963 {
964  for (Iter it = begin; it != end; ++it)
965  {
966  if (internal::ArrayEq(*it, elem))
967  { return it; }
968  }
969 
970  return end;
971 }
972 
973 // CopyArray() copies a k-dimensional native array using the elements'
974 // operator=, where k can be any integer >= 0. When k is 0,
975 // CopyArray() degenerates into copying a single value.
976 
977 template <typename T, typename U>
978 void CopyArray(const T * from, size_t size, U * to);
979 
980 // This generic version is used when k is 0.
981 template <typename T, typename U>
982 inline void CopyArray(const T & from, U * to) { *to = from; }
983 
984 // This overload is used when k >= 1.
985 template <typename T, typename U, size_t N>
986 inline void CopyArray(const T(&from)[N], U(*to)[N])
987 {
988  internal::CopyArray(from, N, *to);
989 }
990 
991 // This helper reduces code bloat. If we instead put its logic inside
992 // the previous CopyArray() function, arrays with different sizes
993 // would lead to different copies of the template code.
994 template <typename T, typename U>
995 void CopyArray(const T * from, size_t size, U * to)
996 {
997  for (size_t i = 0; i != size; i++)
998  {
999  internal::CopyArray(from[i], to + i);
1000  }
1001 }
1002 
1003 // The relation between an NativeArray object (see below) and the
1004 // native array it represents.
1006 {
1007  kReference, // The NativeArray references the native array.
1008  kCopy // The NativeArray makes a copy of the native array and
1009  // owns the copy.
1010 };
1011 
1012 // Adapts a native array to a read-only STL-style container. Instead
1013 // of the complete STL container concept, this adaptor only implements
1014 // members useful for Google Mock's container matchers. New members
1015 // should be added as needed. To simplify the implementation, we only
1016 // support Element being a raw type (i.e. having no top-level const or
1017 // reference modifier). It's the client's responsibility to satisfy
1018 // this requirement. Element can be an array type itself (hence
1019 // multi-dimensional arrays are supported).
1020 template <typename Element>
1021 class NativeArray
1022 {
1023 public:
1024  // STL-style container typedefs.
1025  typedef Element value_type;
1026  typedef Element * iterator;
1027  typedef const Element * const_iterator;
1028 
1029  // Constructs from a native array.
1030  NativeArray(const Element * array, size_t count, RelationToSource relation)
1031  {
1032  Init(array, count, relation);
1033  }
1034 
1035  // Copy constructor.
1037  {
1038  Init(rhs.array_, rhs.size_, rhs.relation_to_source_);
1039  }
1040 
1042  {
1043  // Ensures that the user doesn't instantiate NativeArray with a
1044  // const or reference type.
1045  static_cast<void>(StaticAssertTypeEqHelper<Element,
1046  GTEST_REMOVE_REFERENCE_AND_CONST_(Element)>());
1047 
1048  if (relation_to_source_ == kCopy)
1049  { delete[] array_; }
1050  }
1051 
1052  // STL-style container methods.
1053  size_t size() const { return size_; }
1054  const_iterator begin() const { return array_; }
1055  const_iterator end() const { return array_ + size_; }
1056  bool operator==(const NativeArray & rhs) const
1057  {
1058  return size() == rhs.size() &&
1059  ArrayEq(begin(), size(), rhs.begin());
1060  }
1061 
1062 private:
1063  // Initializes this object; makes a copy of the input array if
1064  // 'relation' is kCopy.
1065  void Init(const Element * array, size_t a_size, RelationToSource relation)
1066  {
1067  if (relation == kReference)
1068  {
1069  array_ = array;
1070  }
1071 
1072  else
1073  {
1074  Element * const copy = new Element[a_size];
1075  CopyArray(array, a_size, copy);
1076  array_ = copy;
1077  }
1078 
1079  size_ = a_size;
1080  relation_to_source_ = relation;
1081  }
1082 
1083  const Element * array_;
1084  size_t size_;
1085  RelationToSource relation_to_source_;
1086 
1088 };
1089 
1090 } // namespace internal
1091 } // namespace testing
1092 
1093 #define GTEST_MESSAGE_AT_(file, line, message, result_type) \
1094  ::testing::internal::AssertHelper(result_type, file, line, message) \
1095  = ::testing::Message()
1096 
1097 #define GTEST_MESSAGE_(message, result_type) \
1098  GTEST_MESSAGE_AT_(__FILE__, __LINE__, message, result_type)
1099 
1100 #define GTEST_FATAL_FAILURE_(message) \
1101  return GTEST_MESSAGE_(message, ::testing::TestPartResult::kFatalFailure)
1102 
1103 #define GTEST_NONFATAL_FAILURE_(message) \
1104  GTEST_MESSAGE_(message, ::testing::TestPartResult::kNonFatalFailure)
1105 
1106 #define GTEST_SUCCESS_(message) \
1107  GTEST_MESSAGE_(message, ::testing::TestPartResult::kSuccess)
1108 
1109 // Suppresses MSVC warnings 4072 (unreachable code) for the code following
1110 // statement if it returns or throws (or doesn't return or throw in some
1111 // situations).
1112 #define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) \
1113  if (::testing::internal::AlwaysTrue()) { statement; }
1114 
1115 #define GTEST_TEST_THROW_(statement, expected_exception, fail) \
1116  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
1117  if (::testing::internal::ConstCharPtr gtest_msg = "") { \
1118  bool gtest_caught_expected = false; \
1119  try { \
1120  GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
1121  } \
1122  catch (expected_exception const&) { \
1123  gtest_caught_expected = true; \
1124  } \
1125  catch (...) { \
1126  gtest_msg.value = \
1127  "Expected: " #statement " throws an exception of type " \
1128  #expected_exception ".\n Actual: it throws a different type."; \
1129  goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
1130  } \
1131  if (!gtest_caught_expected) { \
1132  gtest_msg.value = \
1133  "Expected: " #statement " throws an exception of type " \
1134  #expected_exception ".\n Actual: it throws nothing."; \
1135  goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \
1136  } \
1137  } else \
1138  GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__): \
1139  fail(gtest_msg.value)
1140 
1141 #define GTEST_TEST_NO_THROW_(statement, fail) \
1142  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
1143  if (::testing::internal::AlwaysTrue()) { \
1144  try { \
1145  GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
1146  } \
1147  catch (...) { \
1148  goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \
1149  } \
1150  } else \
1151  GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__): \
1152  fail("Expected: " #statement " doesn't throw an exception.\n" \
1153  " Actual: it throws.")
1154 
1155 #define GTEST_TEST_ANY_THROW_(statement, fail) \
1156  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
1157  if (::testing::internal::AlwaysTrue()) { \
1158  bool gtest_caught_any = false; \
1159  try { \
1160  GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
1161  } \
1162  catch (...) { \
1163  gtest_caught_any = true; \
1164  } \
1165  if (!gtest_caught_any) { \
1166  goto GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__); \
1167  } \
1168  } else \
1169  GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__): \
1170  fail("Expected: " #statement " throws an exception.\n" \
1171  " Actual: it doesn't.")
1172 
1173 
1174 // Implements Boolean test assertions such as EXPECT_TRUE. expression can be
1175 // either a boolean expression or an AssertionResult. text is a textual
1176 // represenation of expression as it was passed into the EXPECT_TRUE.
1177 #define GTEST_TEST_BOOLEAN_(expression, text, actual, expected, fail) \
1178  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
1179  if (const ::testing::AssertionResult gtest_ar_ = \
1180  ::testing::AssertionResult(expression)) \
1181  ; \
1182  else \
1183  fail(::testing::internal::GetBoolAssertionFailureMessage(\
1184  gtest_ar_, text, #actual, #expected).c_str())
1185 
1186 #define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \
1187  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
1188  if (::testing::internal::AlwaysTrue()) { \
1189  ::testing::internal::HasNewFatalFailureHelper gtest_fatal_failure_checker; \
1190  GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
1191  if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \
1192  goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \
1193  } \
1194  } else \
1195  GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__): \
1196  fail("Expected: " #statement " doesn't generate new fatal " \
1197  "failures in the current thread.\n" \
1198  " Actual: it does.")
1199 
1200 // Expands to the name of the class that implements the given test.
1201 #define GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
1202  test_case_name##_##test_name##_Test
1203 
1204 // Helper macro for defining tests.
1205 #define GTEST_TEST_(test_case_name, test_name, parent_class, parent_id)\
1206 class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\
1207  public:\
1208  GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\
1209  private:\
1210  virtual void TestBody();\
1211  static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_;\
1212  GTEST_DISALLOW_COPY_AND_ASSIGN_(\
1213  GTEST_TEST_CLASS_NAME_(test_case_name, test_name));\
1214 };\
1215 \
1216 ::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_case_name, test_name)\
1217  ::test_info_ =\
1218  ::testing::internal::MakeAndRegisterTestInfo(\
1219  #test_case_name, #test_name, NULL, NULL, \
1220  (parent_id), \
1221  parent_class::SetUpTestCase, \
1222  parent_class::TearDownTestCase, \
1223  new ::testing::internal::TestFactoryImpl<\
1224  GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\
1225 void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
1226 
1227 #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
static Bits DistanceBetweenSignAndMagnitudeNumbers(const Bits &sam1, const Bits &sam2)
#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)
int * count
#define GTEST_API_
::std::string PrintToString(const T &value)
const char Message[]
Definition: strings.h:102
GTEST_API_ int g_init_gtest_count
GTEST_API_::std::string FormatFileLocation(const char *file, int line)
TypeWithSize< 4 >::UInt UInt32
bool SkipPrefix(const char *prefix, const char **pstr)
TestInfo * MakeAndRegisterTestInfo(const char *test_case_name, const char *name, const char *type_param, const char *value_param, TypeId fixture_class_id, SetUpTestCaseFunc set_up_tc, TearDownTestCaseFunc tear_down_tc, TestFactoryBase *factory)
name
Definition: setup.py:38
std::string StreamableToString(const T &streamable)
bool ArrayEq(const T *lhs, size_t size, const U *rhs)
message
Definition: server.py:50
std::string GetCurrentOsStackTraceExceptTop(UnitTest *, int skip_count)
#define GTEST_DISALLOW_ASSIGN_(type)
void Init(const Element *array, size_t a_size, RelationToSource relation)
const char kStackTraceMarker[]
std::string AppendUserMessage(const std::string &gtest_msg, const Message &user_msg)
AssertionResult EqFailure(const char *expected_expression, const char *actual_expression, const std::string &expected_value, const std::string &actual_value, bool ignoring_case)
std::string GetBoolAssertionFailureMessage(const AssertionResult &assertion_result, const char *expression_text, const char *actual_predicate_value, const char *expected_predicate_value)
FMT_API int fprintf(std::FILE *f, CStringRef format, ArgList args)
Definition: format.cc:891
void CopyArray(const T *from, size_t size, U *to)
Iter ArrayAwareFind(Iter begin, Iter end, const Element &elem)
char IsNullLiteralHelper(Secret *p)
#define GTEST_ATTRIBUTE_UNUSED_
IsContainer IsContainerTest(int, typename C::iterator *=NULL, typename C::const_iterator *=NULL)
NativeArray(const Element *array, size_t count, RelationToSource relation)


ros_opcua_impl_freeopcua
Author(s): Denis Štogl
autogenerated on Tue Jan 19 2021 03:06:12