webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
gtest-internal-inl.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 // Utility functions and classes used by the Google C++ testing framework.
31 //
32 // Author: wan@google.com (Zhanyong Wan)
33 //
34 // This file contains purely Google Test's internal implementation. Please
35 // DO NOT #INCLUDE IT IN A USER PROGRAM.
36 
37 #ifndef GTEST_SRC_GTEST_INTERNAL_INL_H_
38 #define GTEST_SRC_GTEST_INTERNAL_INL_H_
39 
40 // GTEST_IMPLEMENTATION_ is defined to 1 iff the current translation unit is
41 // part of Google Test's implementation; otherwise it's undefined.
42 #if !GTEST_IMPLEMENTATION_
43 // A user is trying to include this from his code - just say no.
44 #error "gtest-internal-inl.h is part of Google Test's internal implementation."
45 #error "It must not be included except by Google Test itself."
46 #endif // GTEST_IMPLEMENTATION_
47 
48 #ifndef _WIN32_WCE
49 #include <errno.h>
50 #endif // !_WIN32_WCE
51 #include <stddef.h>
52 #include <stdlib.h> // For strtoll/_strtoul64/malloc/free.
53 #include <string.h> // For memmove.
54 
55 #include <algorithm>
56 #include <string>
57 #include <vector>
58 
60 
61 #if GTEST_OS_WINDOWS
62 #include <windows.h> // For DWORD.
63 #endif // GTEST_OS_WINDOWS
64 
65 #include <gtest/gtest.h> // NOLINT
66 #include <gtest/gtest-spi.h>
67 
68 namespace testing {
69 
70 // Declares the flags.
71 //
72 // We don't want the users to modify this flag in the code, but want
73 // Google Test's own unit tests to be able to access it. Therefore we
74 // declare it here as opposed to in gtest.h.
75 GTEST_DECLARE_bool_(death_test_use_fork);
76 
77 namespace internal {
78 
79 // The value of GetTestTypeId() as seen from within the Google Test
80 // library. This is solely for testing GetTestTypeId().
82 
83 // Names of the flags (needed for parsing Google Test flags).
84 const char kAlsoRunDisabledTestsFlag[] = "also_run_disabled_tests";
85 const char kBreakOnFailureFlag[] = "break_on_failure";
86 const char kCatchExceptionsFlag[] = "catch_exceptions";
87 const char kColorFlag[] = "color";
88 const char kFilterFlag[] = "filter";
89 const char kListTestsFlag[] = "list_tests";
90 const char kOutputFlag[] = "output";
91 const char kPrintTimeFlag[] = "print_time";
92 const char kRandomSeedFlag[] = "random_seed";
93 const char kRepeatFlag[] = "repeat";
94 const char kShuffleFlag[] = "shuffle";
95 const char kStackTraceDepthFlag[] = "stack_trace_depth";
96 const char kThrowOnFailureFlag[] = "throw_on_failure";
97 
98 // A valid random seed must be in [1, kMaxRandomSeed].
99 const int kMaxRandomSeed = 99999;
100 
101 // g_help_flag is true iff the --help flag or an equivalent form is
102 // specified on the command line.
103 GTEST_API_ extern bool g_help_flag;
104 
105 // Returns the current time in milliseconds.
107 
108 // Returns true iff Google Test should use colors in the output.
109 GTEST_API_ bool ShouldUseColor(bool stdout_is_tty);
110 
111 // Formats the given time in milliseconds as seconds.
113 
114 // Parses a string for an Int32 flag, in the form of "--flag=value".
115 //
116 // On success, stores the value of the flag in *value, and returns
117 // true. On failure, returns false without changing *value.
119  const char* str, const char* flag, Int32* value);
120 
121 // Returns a random seed in range [1, kMaxRandomSeed] based on the
122 // given --gtest_random_seed flag value.
123 inline int GetRandomSeedFromFlag(Int32 random_seed_flag) {
124  const unsigned int raw_seed = (random_seed_flag == 0) ?
125  static_cast<unsigned int>(GetTimeInMillis()) :
126  static_cast<unsigned int>(random_seed_flag);
127 
128  // Normalizes the actual seed to range [1, kMaxRandomSeed] such that
129  // it's easy to type.
130  const int normalized_seed =
131  static_cast<int>((raw_seed - 1U) %
132  static_cast<unsigned int>(kMaxRandomSeed)) + 1;
133  return normalized_seed;
134 }
135 
136 // Returns the first valid random seed after 'seed'. The behavior is
137 // undefined if 'seed' is invalid. The seed after kMaxRandomSeed is
138 // considered to be 1.
139 inline int GetNextRandomSeed(int seed) {
140  GTEST_CHECK_(1 <= seed && seed <= kMaxRandomSeed)
141  << "Invalid random seed " << seed << " - must be in [1, "
142  << kMaxRandomSeed << "].";
143  const int next_seed = seed + 1;
144  return (next_seed > kMaxRandomSeed) ? 1 : next_seed;
145 }
146 
147 // This class saves the values of all Google Test flags in its c'tor, and
148 // restores them in its d'tor.
150  public:
151  // The c'tor.
153  also_run_disabled_tests_ = GTEST_FLAG(also_run_disabled_tests);
154  break_on_failure_ = GTEST_FLAG(break_on_failure);
155  catch_exceptions_ = GTEST_FLAG(catch_exceptions);
156  color_ = GTEST_FLAG(color);
157  death_test_style_ = GTEST_FLAG(death_test_style);
158  death_test_use_fork_ = GTEST_FLAG(death_test_use_fork);
159  filter_ = GTEST_FLAG(filter);
160  internal_run_death_test_ = GTEST_FLAG(internal_run_death_test);
161  list_tests_ = GTEST_FLAG(list_tests);
162  output_ = GTEST_FLAG(output);
163  print_time_ = GTEST_FLAG(print_time);
164  random_seed_ = GTEST_FLAG(random_seed);
165  repeat_ = GTEST_FLAG(repeat);
166  shuffle_ = GTEST_FLAG(shuffle);
167  stack_trace_depth_ = GTEST_FLAG(stack_trace_depth);
168  throw_on_failure_ = GTEST_FLAG(throw_on_failure);
169  }
170 
171  // The d'tor is not virtual. DO NOT INHERIT FROM THIS CLASS.
173  GTEST_FLAG(also_run_disabled_tests) = also_run_disabled_tests_;
174  GTEST_FLAG(break_on_failure) = break_on_failure_;
175  GTEST_FLAG(catch_exceptions) = catch_exceptions_;
176  GTEST_FLAG(color) = color_;
177  GTEST_FLAG(death_test_style) = death_test_style_;
178  GTEST_FLAG(death_test_use_fork) = death_test_use_fork_;
179  GTEST_FLAG(filter) = filter_;
180  GTEST_FLAG(internal_run_death_test) = internal_run_death_test_;
181  GTEST_FLAG(list_tests) = list_tests_;
182  GTEST_FLAG(output) = output_;
183  GTEST_FLAG(print_time) = print_time_;
184  GTEST_FLAG(random_seed) = random_seed_;
185  GTEST_FLAG(repeat) = repeat_;
186  GTEST_FLAG(shuffle) = shuffle_;
187  GTEST_FLAG(stack_trace_depth) = stack_trace_depth_;
188  GTEST_FLAG(throw_on_failure) = throw_on_failure_;
189  }
190  private:
191  // Fields for saving the original values of flags.
192  bool also_run_disabled_tests_;
193  bool break_on_failure_;
194  bool catch_exceptions_;
195  String color_;
196  String death_test_style_;
197  bool death_test_use_fork_;
198  String filter_;
199  String internal_run_death_test_;
200  bool list_tests_;
201  String output_;
202  bool print_time_;
203  internal::Int32 random_seed_;
204  internal::Int32 repeat_;
205  bool shuffle_;
206  internal::Int32 stack_trace_depth_;
207  bool throw_on_failure_;
209 
210 // Converts a Unicode code point to a narrow string in UTF-8 encoding.
211 // code_point parameter is of type UInt32 because wchar_t may not be
212 // wide enough to contain a code point.
213 // The output buffer str must containt at least 32 characters.
214 // The function returns the address of the output buffer.
215 // If the code_point is not a valid Unicode code point
216 // (i.e. outside of Unicode range U+0 to U+10FFFF) it will be output
217 // as '(Invalid Unicode 0xXXXXXXXX)'.
218 GTEST_API_ char* CodePointToUtf8(UInt32 code_point, char* str);
219 
220 // Converts a wide string to a narrow string in UTF-8 encoding.
221 // The wide string is assumed to have the following encoding:
222 // UTF-16 if sizeof(wchar_t) == 2 (on Windows, Cygwin, Symbian OS)
223 // UTF-32 if sizeof(wchar_t) == 4 (on Linux)
224 // Parameter str points to a null-terminated wide string.
225 // Parameter num_chars may additionally limit the number
226 // of wchar_t characters processed. -1 is used when the entire string
227 // should be processed.
228 // If the string contains code points that are not valid Unicode code points
229 // (i.e. outside of Unicode range U+0 to U+10FFFF) they will be output
230 // as '(Invalid Unicode 0xXXXXXXXX)'. If the string is in UTF16 encoding
231 // and contains invalid UTF-16 surrogate pairs, values in those pairs
232 // will be encoded as individual Unicode characters from Basic Normal Plane.
233 GTEST_API_ String WideStringToUtf8(const wchar_t* str, int num_chars);
234 
235 // Reads the GTEST_SHARD_STATUS_FILE environment variable, and creates the file
236 // if the variable is present. If a file already exists at this location, this
237 // function will write over it. If the variable is present, but the file cannot
238 // be created, prints an error and exits.
240 
241 // Checks whether sharding is enabled by examining the relevant
242 // environment variable values. If the variables are present,
243 // but inconsistent (e.g., shard_index >= total_shards), prints
244 // an error and exits. If in_subprocess_for_death_test, sharding is
245 // disabled because it must only be applied to the original test
246 // process. Otherwise, we could filter out death tests we intended to execute.
247 GTEST_API_ bool ShouldShard(const char* total_shards_str,
248  const char* shard_index_str,
249  bool in_subprocess_for_death_test);
250 
251 // Parses the environment variable var as an Int32. If it is unset,
252 // returns default_val. If it is not an Int32, prints an error and
253 // and aborts.
254 GTEST_API_ Int32 Int32FromEnvOrDie(const char* env_var, Int32 default_val);
255 
256 // Given the total number of shards, the shard index, and the test id,
257 // returns true iff the test should be run on this shard. The test id is
258 // some arbitrary but unique non-negative integer assigned to each test
259 // method. Assumes that 0 <= shard_index < total_shards.
261  int total_shards, int shard_index, int test_id);
262 
263 // STL container utilities.
264 
265 // Returns the number of elements in the given container that satisfy
266 // the given predicate.
267 template <class Container, typename Predicate>
268 inline int CountIf(const Container& c, Predicate predicate) {
269  return static_cast<int>(std::count_if(c.begin(), c.end(), predicate));
270 }
271 
272 // Applies a function/functor to each element in the container.
273 template <class Container, typename Functor>
274 void ForEach(const Container& c, Functor functor) {
275  std::for_each(c.begin(), c.end(), functor);
276 }
277 
278 // Returns the i-th element of the vector, or default_value if i is not
279 // in range [0, v.size()).
280 template <typename E>
281 inline E GetElementOr(const std::vector<E>& v, int i, E default_value) {
282  return (i < 0 || i >= static_cast<int>(v.size())) ? default_value : v[i];
283 }
284 
285 // Performs an in-place shuffle of a range of the vector's elements.
286 // 'begin' and 'end' are element indices as an STL-style range;
287 // i.e. [begin, end) are shuffled, where 'end' == size() means to
288 // shuffle to the end of the vector.
289 template <typename E>
290 void ShuffleRange(internal::Random* random, int begin, int end,
291  std::vector<E>* v) {
292  const int size = static_cast<int>(v->size());
293  GTEST_CHECK_(0 <= begin && begin <= size)
294  << "Invalid shuffle range start " << begin << ": must be in range [0, "
295  << size << "].";
296  GTEST_CHECK_(begin <= end && end <= size)
297  << "Invalid shuffle range finish " << end << ": must be in range ["
298  << begin << ", " << size << "].";
299 
300  // Fisher-Yates shuffle, from
301  // http://en.wikipedia.org/wiki/Fisher-Yates_shuffle
302  for (int range_width = end - begin; range_width >= 2; range_width--) {
303  const int last_in_range = begin + range_width - 1;
304  const int selected = begin + random->Generate(range_width);
305  std::swap((*v)[selected], (*v)[last_in_range]);
306  }
307 }
308 
309 // Performs an in-place shuffle of the vector's elements.
310 template <typename E>
311 inline void Shuffle(internal::Random* random, std::vector<E>* v) {
312  ShuffleRange(random, 0, static_cast<int>(v->size()), v);
313 }
314 
315 // A function for deleting an object. Handy for being used as a
316 // functor.
317 template <typename T>
318 static void Delete(T* x) {
319  delete x;
320 }
321 
322 // A predicate that checks the key of a TestProperty against a known key.
323 //
324 // TestPropertyKeyIs is copyable.
326  public:
327  // Constructor.
328  //
329  // TestPropertyKeyIs has NO default constructor.
330  explicit TestPropertyKeyIs(const char* key)
331  : key_(key) {}
332 
333  // Returns true iff the test name of test property matches on key_.
334  bool operator()(const TestProperty& test_property) const {
335  return String(test_property.key()).Compare(key_) == 0;
336  }
337 
338  private:
339  String key_;
340 };
341 
343  public:
344  TestInfoImpl(TestInfo* parent, const char* test_case_name,
345  const char* name, const char* test_case_comment,
346  const char* comment, TypeId fixture_class_id,
348  ~TestInfoImpl();
349 
350  // Returns true if this test should run.
351  bool should_run() const { return should_run_; }
352 
353  // Sets the should_run member.
354  void set_should_run(bool should) { should_run_ = should; }
355 
356  // Returns true if this test is disabled. Disabled tests are not run.
357  bool is_disabled() const { return is_disabled_; }
358 
359  // Sets the is_disabled member.
360  void set_is_disabled(bool is) { is_disabled_ = is; }
361 
362  // Returns true if this test matches the filter specified by the user.
363  bool matches_filter() const { return matches_filter_; }
364 
365  // Sets the matches_filter member.
366  void set_matches_filter(bool matches) { matches_filter_ = matches; }
367 
368  // Returns the test case name.
369  const char* test_case_name() const { return test_case_name_.c_str(); }
370 
371  // Returns the test name.
372  const char* name() const { return name_.c_str(); }
373 
374  // Returns the test case comment.
375  const char* test_case_comment() const { return test_case_comment_.c_str(); }
376 
377  // Returns the test comment.
378  const char* comment() const { return comment_.c_str(); }
379 
380  // Returns the ID of the test fixture class.
381  TypeId fixture_class_id() const { return fixture_class_id_; }
382 
383  // Returns the test result.
384  TestResult* result() { return &result_; }
385  const TestResult* result() const { return &result_; }
386 
387  // Creates the test object, runs it, records its result, and then
388  // deletes it.
389  void Run();
390 
391  // Clears the test result.
392  void ClearResult() { result_.Clear(); }
393 
394  // Clears the test result in the given TestInfo object.
395  static void ClearTestResult(TestInfo * test_info) {
396  test_info->impl()->ClearResult();
397  }
398 
399  private:
400  // These fields are immutable properties of the test.
401  TestInfo* const parent_; // The owner of this object
402  const String test_case_name_; // Test case name
403  const String name_; // Test name
404  const String test_case_comment_; // Test case comment
405  const String comment_; // Test comment
406  const TypeId fixture_class_id_; // ID of the test fixture class
407  bool should_run_; // True iff this test should run
408  bool is_disabled_; // True iff this test is disabled
409  bool matches_filter_; // True if this test matches the
410  // user-specified filter.
411  internal::TestFactoryBase* const factory_; // The factory that creates
412  // the test object
413 
414  // This field is mutable and needs to be reset before running the
415  // test for the second time.
416  TestResult result_;
417 
419 };
420 
421 // Class UnitTestOptions.
422 //
423 // This class contains functions for processing options the user
424 // specifies when running the tests. It has only static members.
425 //
426 // In most cases, the user can specify an option using either an
427 // environment variable or a command line flag. E.g. you can set the
428 // test filter using either GTEST_FILTER or --gtest_filter. If both
429 // the variable and the flag are present, the latter overrides the
430 // former.
432  public:
433  // Functions for processing the gtest_output flag.
434 
435  // Returns the output format, or "" for normal printed output.
436  static String GetOutputFormat();
437 
438  // Returns the absolute path of the requested output file, or the
439  // default (test_detail.xml in the original working directory) if
440  // none was explicitly specified.
441  static String GetAbsolutePathToOutputFile();
442 
443  // Functions for processing the gtest_filter flag.
444 
445  // Returns true iff the wildcard pattern matches the string. The
446  // first ':' or '\0' character in pattern marks the end of it.
447  //
448  // This recursive algorithm isn't very efficient, but is clear and
449  // works well enough for matching test names, which are short.
450  static bool PatternMatchesString(const char *pattern, const char *str);
451 
452  // Returns true iff the user-specified filter matches the test case
453  // name and the test name.
454  static bool FilterMatchesTest(const String &test_case_name,
455  const String &test_name);
456 
457 #if GTEST_OS_WINDOWS
458  // Function for supporting the gtest_catch_exception flag.
459 
460  // Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the
461  // given SEH exception, or EXCEPTION_CONTINUE_SEARCH otherwise.
462  // This function is useful as an __except condition.
463  static int GTestShouldProcessSEH(DWORD exception_code);
464 #endif // GTEST_OS_WINDOWS
465 
466  // Returns true if "name" matches the ':' separated list of glob-style
467  // filters in "filter".
468  static bool MatchesFilter(const String& name, const char* filter);
469 };
470 
471 // Returns the current application's name, removing directory path if that
472 // is present. Used by UnitTestOptions::GetOutputFile.
474 
475 // The role interface for getting the OS stack trace as a string.
477  public:
480 
481  // Returns the current OS stack trace as a String. Parameters:
482  //
483  // max_depth - the maximum number of stack frames to be included
484  // in the trace.
485  // skip_count - the number of top frames to be skipped; doesn't count
486  // against max_depth.
487  virtual String CurrentStackTrace(int max_depth, int skip_count) = 0;
488 
489  // UponLeavingGTest() should be called immediately before Google Test calls
490  // user code. It saves some information about the current stack that
491  // CurrentStackTrace() will use to find and hide Google Test stack frames.
492  virtual void UponLeavingGTest() = 0;
493 
494  private:
496 };
497 
498 // A working implementation of the OsStackTraceGetterInterface interface.
500  public:
501  OsStackTraceGetter() : caller_frame_(NULL) {}
502  virtual String CurrentStackTrace(int max_depth, int skip_count);
503  virtual void UponLeavingGTest();
504 
505  // This string is inserted in place of stack frames that are part of
506  // Google Test's implementation.
507  static const char* const kElidedFramesMarker;
508 
509  private:
510  Mutex mutex_; // protects all internal state
511 
512  // We save the stack frame below the frame that calls user code.
513  // We do this because the address of the frame immediately below
514  // the user code changes between the call to UponLeavingGTest()
515  // and any calls to CurrentStackTrace() from within the user code.
516  void* caller_frame_;
517 
519 };
520 
521 // Information about a Google Test trace point.
522 struct TraceInfo {
523  const char* file;
524  int line;
526 };
527 
528 // This is the default global test part result reporter used in UnitTestImpl.
529 // This class should only be used by UnitTestImpl.
532  public:
534  // Implements the TestPartResultReporterInterface. Reports the test part
535  // result in the current test.
536  virtual void ReportTestPartResult(const TestPartResult& result);
537 
538  private:
539  UnitTestImpl* const unit_test_;
540 
542 };
543 
544 // This is the default per thread test part result reporter used in
545 // UnitTestImpl. This class should only be used by UnitTestImpl.
548  public:
550  // Implements the TestPartResultReporterInterface. The implementation just
551  // delegates to the current global test part result reporter of *unit_test_.
552  virtual void ReportTestPartResult(const TestPartResult& result);
553 
554  private:
555  UnitTestImpl* const unit_test_;
556 
558 };
559 
560 // The private implementation of the UnitTest class. We don't protect
561 // the methods under a mutex, as this class is not accessible by a
562 // user and the UnitTest class that delegates work to this class does
563 // proper locking.
565  public:
566  explicit UnitTestImpl(UnitTest* parent);
567  virtual ~UnitTestImpl();
568 
569  // There are two different ways to register your own TestPartResultReporter.
570  // You can register your own repoter to listen either only for test results
571  // from the current thread or for results from all threads.
572  // By default, each per-thread test result repoter just passes a new
573  // TestPartResult to the global test result reporter, which registers the
574  // test part result for the currently running test.
575 
576  // Returns the global test part result reporter.
577  TestPartResultReporterInterface* GetGlobalTestPartResultReporter();
578 
579  // Sets the global test part result reporter.
580  void SetGlobalTestPartResultReporter(
582 
583  // Returns the test part result reporter for the current thread.
584  TestPartResultReporterInterface* GetTestPartResultReporterForCurrentThread();
585 
586  // Sets the test part result reporter for the current thread.
587  void SetTestPartResultReporterForCurrentThread(
589 
590  // Gets the number of successful test cases.
591  int successful_test_case_count() const;
592 
593  // Gets the number of failed test cases.
594  int failed_test_case_count() const;
595 
596  // Gets the number of all test cases.
597  int total_test_case_count() const;
598 
599  // Gets the number of all test cases that contain at least one test
600  // that should run.
601  int test_case_to_run_count() const;
602 
603  // Gets the number of successful tests.
604  int successful_test_count() const;
605 
606  // Gets the number of failed tests.
607  int failed_test_count() const;
608 
609  // Gets the number of disabled tests.
610  int disabled_test_count() const;
611 
612  // Gets the number of all tests.
613  int total_test_count() const;
614 
615  // Gets the number of tests that should run.
616  int test_to_run_count() const;
617 
618  // Gets the elapsed time, in milliseconds.
619  TimeInMillis elapsed_time() const { return elapsed_time_; }
620 
621  // Returns true iff the unit test passed (i.e. all test cases passed).
622  bool Passed() const { return !Failed(); }
623 
624  // Returns true iff the unit test failed (i.e. some test case failed
625  // or something outside of all tests failed).
626  bool Failed() const {
627  return failed_test_case_count() > 0 || ad_hoc_test_result()->Failed();
628  }
629 
630  // Gets the i-th test case among all the test cases. i can range from 0 to
631  // total_test_case_count() - 1. If i is not in that range, returns NULL.
632  const TestCase* GetTestCase(int i) const {
633  const int index = GetElementOr(test_case_indices_, i, -1);
634  return index < 0 ? NULL : test_cases_[i];
635  }
636 
637  // Gets the i-th test case among all the test cases. i can range from 0 to
638  // total_test_case_count() - 1. If i is not in that range, returns NULL.
640  const int index = GetElementOr(test_case_indices_, i, -1);
641  return index < 0 ? NULL : test_cases_[index];
642  }
643 
644  // Provides access to the event listener list.
645  TestEventListeners* listeners() { return &listeners_; }
646 
647  // Returns the TestResult for the test that's currently running, or
648  // the TestResult for the ad hoc test if no test is running.
649  TestResult* current_test_result();
650 
651  // Returns the TestResult for the ad hoc test.
652  const TestResult* ad_hoc_test_result() const { return &ad_hoc_test_result_; }
653 
654  // Sets the OS stack trace getter.
655  //
656  // Does nothing if the input and the current OS stack trace getter
657  // are the same; otherwise, deletes the old getter and makes the
658  // input the current getter.
659  void set_os_stack_trace_getter(OsStackTraceGetterInterface* getter);
660 
661  // Returns the current OS stack trace getter if it is not NULL;
662  // otherwise, creates an OsStackTraceGetter, makes it the current
663  // getter, and returns it.
664  OsStackTraceGetterInterface* os_stack_trace_getter();
665 
666  // Returns the current OS stack trace as a String.
667  //
668  // The maximum number of stack frames to be included is specified by
669  // the gtest_stack_trace_depth flag. The skip_count parameter
670  // specifies the number of top frames to be skipped, which doesn't
671  // count against the number of frames to be included.
672  //
673  // For example, if Foo() calls Bar(), which in turn calls
674  // CurrentOsStackTraceExceptTop(1), Foo() will be included in the
675  // trace but Bar() and CurrentOsStackTraceExceptTop() won't.
676  String CurrentOsStackTraceExceptTop(int skip_count);
677 
678  // Finds and returns a TestCase with the given name. If one doesn't
679  // exist, creates one and returns it.
680  //
681  // Arguments:
682  //
683  // test_case_name: name of the test case
684  // set_up_tc: pointer to the function that sets up the test case
685  // tear_down_tc: pointer to the function that tears down the test case
686  TestCase* GetTestCase(const char* test_case_name,
687  const char* comment,
688  Test::SetUpTestCaseFunc set_up_tc,
689  Test::TearDownTestCaseFunc tear_down_tc);
690 
691  // Adds a TestInfo to the unit test.
692  //
693  // Arguments:
694  //
695  // set_up_tc: pointer to the function that sets up the test case
696  // tear_down_tc: pointer to the function that tears down the test case
697  // test_info: the TestInfo object
699  Test::TearDownTestCaseFunc tear_down_tc,
700  TestInfo * test_info) {
701  // In order to support thread-safe death tests, we need to
702  // remember the original working directory when the test program
703  // was first invoked. We cannot do this in RUN_ALL_TESTS(), as
704  // the user may have changed the current directory before calling
705  // RUN_ALL_TESTS(). Therefore we capture the current directory in
706  // AddTestInfo(), which is called to register a TEST or TEST_F
707  // before main() is reached.
708  if (original_working_dir_.IsEmpty()) {
711  << "Failed to get the current working directory.";
712  }
713 
714  GetTestCase(test_info->test_case_name(),
715  test_info->test_case_comment(),
716  set_up_tc,
717  tear_down_tc)->AddTestInfo(test_info);
718  }
719 
720 #if GTEST_HAS_PARAM_TEST
721  // Returns ParameterizedTestCaseRegistry object used to keep track of
722  // value-parameterized tests and instantiate and register them.
723  internal::ParameterizedTestCaseRegistry& parameterized_test_registry() {
724  return parameterized_test_registry_;
725  }
726 #endif // GTEST_HAS_PARAM_TEST
727 
728  // Sets the TestCase object for the test that's currently running.
729  void set_current_test_case(TestCase* a_current_test_case) {
730  current_test_case_ = a_current_test_case;
731  }
732 
733  // Sets the TestInfo object for the test that's currently running. If
734  // current_test_info is NULL, the assertion results will be stored in
735  // ad_hoc_test_result_.
736  void set_current_test_info(TestInfo* a_current_test_info) {
737  current_test_info_ = a_current_test_info;
738  }
739 
740  // Registers all parameterized tests defined using TEST_P and
741  // INSTANTIATE_TEST_P, creating regular tests for each test/parameter
742  // combination. This method can be called more then once; it has
743  // guards protecting from registering the tests more then once.
744  // If value-parameterized tests are disabled, RegisterParameterizedTests
745  // is present but does nothing.
746  void RegisterParameterizedTests();
747 
748  // Runs all tests in this UnitTest object, prints the result, and
749  // returns 0 if all tests are successful, or 1 otherwise. If any
750  // exception is thrown during a test on Windows, this test is
751  // considered to be failed, but the rest of the tests will still be
752  // run. (We disable exceptions on Linux and Mac OS X, so the issue
753  // doesn't apply there.)
754  int RunAllTests();
755 
756  // Clears the results of all tests, including the ad hoc test.
757  void ClearResult() {
758  ForEach(test_cases_, TestCase::ClearTestCaseResult);
759  ad_hoc_test_result_.Clear();
760  }
761 
764  IGNORE_SHARDING_PROTOCOL
765  };
766 
767  // Matches the full name of each test against the user-specified
768  // filter to decide whether the test should run, then records the
769  // result in each TestCase and TestInfo object.
770  // If shard_tests == HONOR_SHARDING_PROTOCOL, further filters tests
771  // based on sharding variables in the environment.
772  // Returns the number of tests that should run.
773  int FilterTests(ReactionToSharding shard_tests);
774 
775  // Prints the names of the tests matching the user-specified filter flag.
776  void ListTestsMatchingFilter();
777 
778  const TestCase* current_test_case() const { return current_test_case_; }
779  TestInfo* current_test_info() { return current_test_info_; }
780  const TestInfo* current_test_info() const { return current_test_info_; }
781 
782  // Returns the vector of environments that need to be set-up/torn-down
783  // before/after the tests are run.
784  std::vector<Environment*>& environments() { return environments_; }
785 
786  // Getters for the per-thread Google Test trace stack.
787  std::vector<TraceInfo>& gtest_trace_stack() {
788  return *(gtest_trace_stack_.pointer());
789  }
790  const std::vector<TraceInfo>& gtest_trace_stack() const {
791  return gtest_trace_stack_.get();
792  }
793 
794 #if GTEST_HAS_DEATH_TEST
795  void InitDeathTestSubprocessControlInfo() {
796  internal_run_death_test_flag_.reset(ParseInternalRunDeathTestFlag());
797  }
798  // Returns a pointer to the parsed --gtest_internal_run_death_test
799  // flag, or NULL if that flag was not specified.
800  // This information is useful only in a death test child process.
801  // Must not be called before a call to InitGoogleTest.
802  const InternalRunDeathTestFlag* internal_run_death_test_flag() const {
803  return internal_run_death_test_flag_.get();
804  }
805 
806  // Returns a pointer to the current death test factory.
807  internal::DeathTestFactory* death_test_factory() {
808  return death_test_factory_.get();
809  }
810 
811  void SuppressTestEventsIfInSubprocess();
812 
813  friend class ReplaceDeathTestFactory;
814 #endif // GTEST_HAS_DEATH_TEST
815 
816  // Initializes the event listener performing XML output as specified by
817  // UnitTestOptions. Must not be called before InitGoogleTest.
818  void ConfigureXmlOutput();
819 
820  // Performs initialization dependent upon flag values obtained in
821  // ParseGoogleTestFlagsOnly. Is called from InitGoogleTest after the call to
822  // ParseGoogleTestFlagsOnly. In case a user neglects to call InitGoogleTest
823  // this function is also called from RunAllTests. Since this function can be
824  // called more than once, it has to be idempotent.
825  void PostFlagParsingInit();
826 
827  // Gets the random seed used at the start of the current test iteration.
828  int random_seed() const { return random_seed_; }
829 
830  // Gets the random number generator.
831  internal::Random* random() { return &random_; }
832 
833  // Shuffles all test cases, and the tests within each test case,
834  // making sure that death tests are still run first.
835  void ShuffleTests();
836 
837  // Restores the test cases and tests to their order before the first shuffle.
838  void UnshuffleTests();
839 
840  private:
841  friend class ::testing::UnitTest;
842 
843  // The UnitTest object that owns this implementation object.
844  UnitTest* const parent_;
845 
846  // The working directory when the first TEST() or TEST_F() was
847  // executed.
849 
850  // The default test part result reporters.
851  DefaultGlobalTestPartResultReporter default_global_test_part_result_reporter_;
853  default_per_thread_test_part_result_reporter_;
854 
855  // Points to (but doesn't own) the global test part result reporter.
856  TestPartResultReporterInterface* global_test_part_result_repoter_;
857 
858  // Protects read and write access to global_test_part_result_reporter_.
859  internal::Mutex global_test_part_result_reporter_mutex_;
860 
861  // Points to (but doesn't own) the per-thread test part result reporter.
863  per_thread_test_part_result_reporter_;
864 
865  // The vector of environments that need to be set-up/torn-down
866  // before/after the tests are run.
867  std::vector<Environment*> environments_;
868 
869  // The vector of TestCases in their original order. It owns the
870  // elements in the vector.
871  std::vector<TestCase*> test_cases_;
872 
873  // Provides a level of indirection for the test case list to allow
874  // easy shuffling and restoring the test case order. The i-th
875  // element of this vector is the index of the i-th test case in the
876  // shuffled order.
877  std::vector<int> test_case_indices_;
878 
879 #if GTEST_HAS_PARAM_TEST
880  // ParameterizedTestRegistry object used to register value-parameterized
881  // tests.
882  internal::ParameterizedTestCaseRegistry parameterized_test_registry_;
883 
884  // Indicates whether RegisterParameterizedTests() has been called already.
885  bool parameterized_tests_registered_;
886 #endif // GTEST_HAS_PARAM_TEST
887 
888  // Index of the last death test case registered. Initially -1.
889  int last_death_test_case_;
890 
891  // This points to the TestCase for the currently running test. It
892  // changes as Google Test goes through one test case after another.
893  // When no test is running, this is set to NULL and Google Test
894  // stores assertion results in ad_hoc_test_result_. Initially NULL.
895  TestCase* current_test_case_;
896 
897  // This points to the TestInfo for the currently running test. It
898  // changes as Google Test goes through one test after another. When
899  // no test is running, this is set to NULL and Google Test stores
900  // assertion results in ad_hoc_test_result_. Initially NULL.
901  TestInfo* current_test_info_;
902 
903  // Normally, a user only writes assertions inside a TEST or TEST_F,
904  // or inside a function called by a TEST or TEST_F. Since Google
905  // Test keeps track of which test is current running, it can
906  // associate such an assertion with the test it belongs to.
907  //
908  // If an assertion is encountered when no TEST or TEST_F is running,
909  // Google Test attributes the assertion result to an imaginary "ad hoc"
910  // test, and records the result in ad_hoc_test_result_.
911  TestResult ad_hoc_test_result_;
912 
913  // The list of event listeners that can be used to track events inside
914  // Google Test.
915  TestEventListeners listeners_;
916 
917  // The OS stack trace getter. Will be deleted when the UnitTest
918  // object is destructed. By default, an OsStackTraceGetter is used,
919  // but the user can set this field to use a custom getter if that is
920  // desired.
921  OsStackTraceGetterInterface* os_stack_trace_getter_;
922 
923  // True iff PostFlagParsingInit() has been called.
924  bool post_flag_parse_init_performed_;
925 
926  // The random number seed used at the beginning of the test run.
927  int random_seed_;
928 
929  // Our random number generator.
930  internal::Random random_;
931 
932  // How long the test took to run, in milliseconds.
933  TimeInMillis elapsed_time_;
934 
935 #if GTEST_HAS_DEATH_TEST
936  // The decomposed components of the gtest_internal_run_death_test flag,
937  // parsed when RUN_ALL_TESTS is called.
938  internal::scoped_ptr<InternalRunDeathTestFlag> internal_run_death_test_flag_;
940 #endif // GTEST_HAS_DEATH_TEST
941 
942  // A per-thread stack of traces created by the SCOPED_TRACE() macro.
944 
946 }; // class UnitTestImpl
947 
948 // Convenience function for accessing the global UnitTest
949 // implementation object.
951  return UnitTest::GetInstance()->impl();
952 }
953 
954 // Internal helper functions for implementing the simple regular
955 // expression matcher.
956 GTEST_API_ bool IsInSet(char ch, const char* str);
957 GTEST_API_ bool IsDigit(char ch);
958 GTEST_API_ bool IsPunct(char ch);
959 GTEST_API_ bool IsRepeat(char ch);
960 GTEST_API_ bool IsWhiteSpace(char ch);
961 GTEST_API_ bool IsWordChar(char ch);
962 GTEST_API_ bool IsValidEscape(char ch);
963 GTEST_API_ bool AtomMatchesChar(bool escaped, char pattern, char ch);
964 GTEST_API_ bool ValidateRegex(const char* regex);
965 GTEST_API_ bool MatchRegexAtHead(const char* regex, const char* str);
967  bool escaped, char ch, char repeat, const char* regex, const char* str);
968 GTEST_API_ bool MatchRegexAnywhere(const char* regex, const char* str);
969 
970 // Parses the command line for Google Test flags, without initializing
971 // other parts of Google Test.
972 GTEST_API_ void ParseGoogleTestFlagsOnly(int* argc, char** argv);
973 GTEST_API_ void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv);
974 
975 #if GTEST_HAS_DEATH_TEST
976 
977 // Returns the message describing the last system error, regardless of the
978 // platform.
979 String GetLastErrnoDescription();
980 
981 #if GTEST_OS_WINDOWS
982 // Provides leak-safe Windows kernel handle ownership.
983 class AutoHandle {
984  public:
985  AutoHandle() : handle_(INVALID_HANDLE_VALUE) {}
986  explicit AutoHandle(HANDLE handle) : handle_(handle) {}
987 
988  ~AutoHandle() { Reset(); }
989 
990  HANDLE Get() const { return handle_; }
991  void Reset() { Reset(INVALID_HANDLE_VALUE); }
992  void Reset(HANDLE handle) {
993  if (handle != handle_) {
994  if (handle_ != INVALID_HANDLE_VALUE)
995  ::CloseHandle(handle_);
996  handle_ = handle;
997  }
998  }
999 
1000  private:
1001  HANDLE handle_;
1002 
1003  GTEST_DISALLOW_COPY_AND_ASSIGN_(AutoHandle);
1004 };
1005 #endif // GTEST_OS_WINDOWS
1006 
1007 // Attempts to parse a string into a positive integer pointed to by the
1008 // number parameter. Returns true if that is possible.
1009 // GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we can use
1010 // it here.
1011 template <typename Integer>
1012 bool ParseNaturalNumber(const ::std::string& str, Integer* number) {
1013  // Fail fast if the given string does not begin with a digit;
1014  // this bypasses strtoXXX's "optional leading whitespace and plus
1015  // or minus sign" semantics, which are undesirable here.
1016  if (str.empty() || !isdigit(str[0])) {
1017  return false;
1018  }
1019  errno = 0;
1020 
1021  char* end;
1022  // BiggestConvertible is the largest integer type that system-provided
1023  // string-to-number conversion routines can return.
1024 #if GTEST_OS_WINDOWS && !defined(__GNUC__)
1025  // MSVC and C++ Builder define __int64 instead of the standard long long.
1026  typedef unsigned __int64 BiggestConvertible;
1027  const BiggestConvertible parsed = _strtoui64(str.c_str(), &end, 10);
1028 #else
1029  typedef unsigned long long BiggestConvertible; // NOLINT
1030  const BiggestConvertible parsed = strtoull(str.c_str(), &end, 10);
1031 #endif // GTEST_OS_WINDOWS && !defined(__GNUC__)
1032  const bool parse_success = *end == '\0' && errno == 0;
1033 
1034  // TODO(vladl@google.com): Convert this to compile time assertion when it is
1035  // available.
1036  GTEST_CHECK_(sizeof(Integer) <= sizeof(parsed));
1037 
1038  const Integer result = static_cast<Integer>(parsed);
1039  if (parse_success && static_cast<BiggestConvertible>(result) == parsed) {
1040  *number = result;
1041  return true;
1042  }
1043  return false;
1044 }
1045 #endif // GTEST_HAS_DEATH_TEST
1046 
1047 // TestResult contains some private methods that should be hidden from
1048 // Google Test user but are required for testing. This class allow our tests
1049 // to access them.
1050 //
1051 // This class is supplied only for the purpose of testing Google Test's own
1052 // constructs. Do not use it in user tests, either directly or indirectly.
1054  public:
1055  static void RecordProperty(TestResult* test_result,
1056  const TestProperty& property) {
1057  test_result->RecordProperty(property);
1058  }
1059 
1060  static void ClearTestPartResults(TestResult* test_result) {
1061  test_result->ClearTestPartResults();
1062  }
1063 
1064  static const std::vector<testing::TestPartResult>& test_part_results(
1065  const TestResult& test_result) {
1066  return test_result.test_part_results();
1067  }
1068 };
1069 
1070 } // namespace internal
1071 } // namespace testing
1072 
1073 #endif // GTEST_SRC_GTEST_INTERNAL_INL_H_
void set_current_test_info(TestInfo *a_current_test_info)
Definition: gtest-internal-inl.h:736
GTEST_API_ bool g_help_flag
Definition: gtest.cc:174
class UnitTestImpl * GetUnitTestImpl()
Definition: gtest-internal-inl.h:950
std::vector< TraceInfo > & gtest_trace_stack()
Definition: gtest-internal-inl.h:787
Definition: gtest-internal-inl.h:564
const char kColorFlag[]
Definition: gtest-internal-inl.h:87
const char kAlsoRunDisabledTestsFlag[]
Definition: gtest-internal-inl.h:84
Definition: gtest-test-part.h:143
static void ClearTestPartResults(TestResult *test_result)
Definition: gtest-internal-inl.h:1060
int GetRandomSeedFromFlag(Int32 random_seed_flag)
Definition: gtest-internal-inl.h:123
void Reset()
Definition: metrics_default.cc:285
GTEST_API_ bool IsRepeat(char ch)
EGLStreamKHR EGLint EGLint EGLint size
Definition: eglext.h:984
Definition: testutils.h:40
E GetElementOr(const std::vector< E > &v, int i, E default_value)
Definition: gtest-internal-inl.h:281
Definition: gtest-filepath.h:59
TestInfo * current_test_info()
Definition: gtest-internal-inl.h:779
uint32_t flag
Definition: ssl_lib.c:2732
int c
Definition: cpp_unittests.cpp:275
def Run(command)
Definition: gtest_break_on_failure_unittest.py:86
GLuint GLuint end
Definition: gl2ext.h:323
TypeId fixture_class_id() const
Definition: gtest-internal-inl.h:381
class GTEST_API_ testing::internal::ScopedTrace GTEST_ATTRIBUTE_UNUSED_
long seed
Definition: float-mm.c:84
int GetNextRandomSeed(int seed)
Definition: gtest-internal-inl.h:139
OsStackTraceGetterInterface()
Definition: gtest-internal-inl.h:478
GTEST_API_ bool IsWordChar(char ch)
GTEST_API_ bool ValidateRegex(const char *regex)
GTEST_API_ bool ShouldUseColor(bool stdout_is_tty)
Definition: gtest.cc:2580
std::vector< Environment * > & environments()
Definition: gtest-internal-inl.h:784
Functor for_each(Functor f)
Definition: Brigand.h:1335
GTEST_API_ bool ShouldRunTestOnShard(int total_shards, int shard_index, int test_id)
Definition: gtest.cc:4154
void set_matches_filter(bool matches)
Definition: gtest-internal-inl.h:366
void AddTestInfo(Test::SetUpTestCaseFunc set_up_tc, Test::TearDownTestCaseFunc tear_down_tc, TestInfo *test_info)
Definition: gtest-internal-inl.h:698
void ClearResult()
Definition: gtest-internal-inl.h:757
double U(int64_t x, double alpha)
Definition: metric_recorder.cc:414
Definition: gtest-internal-inl.h:1053
const char kListTestsFlag[]
Definition: gtest-internal-inl.h:89
GTEST_DECLARE_bool_(also_run_disabled_tests)
GTEST_API_ char * CodePointToUtf8(UInt32 code_point, char *str)
Definition: gtest.cc:1456
GTEST_API_ bool IsPunct(char ch)
GTEST_API_ std::string FormatTimeInMillisAsSeconds(TimeInMillis ms)
Definition: gtest.cc:3183
typename lazy::count_if< List, Pred >::type count_if
Definition: Brigand.h:529
Definition: gtest-internal-inl.h:530
void set_should_run(bool should)
Definition: gtest-internal-inl.h:354
void ClearResult()
Definition: gtest-internal-inl.h:392
#define GTEST_API_
Definition: gtest-port.h:615
GTEST_API_ bool ShouldShard(const char *total_shards_str, const char *shard_index_str, bool in_subprocess_for_death_test)
Definition: gtest.cc:4091
const char * name() const
Definition: gtest-internal-inl.h:372
const TestCase * GetTestCase(int i) const
Definition: gtest-internal-inl.h:632
virtual ~OsStackTraceGetterInterface()
Definition: gtest-internal-inl.h:479
Definition: gtest-test-part.h:47
GTEST_API_ bool AtomMatchesChar(bool escaped, char pattern, char ch)
TypeWithSize< 8 >::Int TimeInMillis
Definition: gtest-port.h:1494
Definition: gtest-internal-inl.h:149
GTEST_API_ bool MatchRegexAnywhere(const char *regex, const char *str)
bool should_run() const
Definition: gtest-internal-inl.h:351
static const std::vector< testing::TestPartResult > & test_part_results(const TestResult &test_result)
Definition: gtest-internal-inl.h:1064
#define GTEST_FLAG(name)
Definition: gtest-port.h:1499
int line
Definition: gtest-internal-inl.h:524
void set_is_disabled(bool is)
Definition: gtest-internal-inl.h:360
#define output
Definition: wire_format_lite.h:418
TypeWithSize< 4 >::UInt UInt32
Definition: gtest-port.h:1491
const char kRandomSeedFlag[]
Definition: gtest-internal-inl.h:92
const void * TypeId
Definition: gtest-internal.h:490
TypeWithSize< 4 >::Int Int32
Definition: gtest-port.h:1490
#define strtoull
Definition: windows_port.h:121
TestResult * result()
Definition: gtest-internal-inl.h:384
TestSubObjConstructor T
Definition: TestTypedefs.idl:84
EGLSurface EGLint x
Definition: eglext.h:950
GTEST_API_ bool IsDigit(char ch)
rtc::scoped_refptr< PeerConnectionFactoryInterface > factory(webrtc::CreatePeerConnectionFactory(network_thread.get(), worker_thread.get(), signaling_thread.get(), nullptr, encoder_factory, decoder_factory))
Definition: peerconnection_jni.cc:1838
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: gl2ext.h:818
#define GTEST_CHECK_(condition)
Definition: gtest-port.h:810
int RunAllTests()
Definition: gtest_output_test_.cc:314
GLuint index
Definition: gl2.h:383
GLuint color
Definition: gl2ext.h:1371
EGLAttrib * value
Definition: eglext.h:120
~GTestFlagSaver()
Definition: gtest-internal-inl.h:172
GTEST_API_ const TypeId kTestTypeIdInGoogleTest
Definition: gtest.cc:576
const char * file
Definition: gtest-internal-inl.h:523
void(* SetUpTestCaseFunc)()
Definition: gtest-internal.h:576
Definition: gtest-string.h:81
bool Passed() const
Definition: gtest-internal-inl.h:622
void(* TearDownTestCaseFunc)()
Definition: gtest-internal.h:577
const int kMaxRandomSeed
Definition: gtest-internal-inl.h:99
GTEST_API_ bool MatchRegexAtHead(const char *regex, const char *str)
EGLImageKHR EGLint * name
Definition: eglext.h:851
const AtomicString & number()
Definition: InputTypeNames.cpp:100
ReactionToSharding
Definition: gtest-internal-inl.h:762
const char * argv[]
Definition: DumpRenderTree.cpp:1631
String message
Definition: gtest-internal-inl.h:525
DOMException E
Definition: TestTypedefs.idl:86
GTEST_API_ FilePath GetCurrentExecutableName()
Definition: gtest.cc:359
static const char *const kElidedFramesMarker
Definition: gtest-internal-inl.h:507
GTEST_API_ TimeInMillis GetTimeInMillis()
Definition: gtest.cc:743
const char * comment() const
Definition: gtest-internal-inl.h:378
internal::Random * random()
Definition: gtest-internal-inl.h:831
GTEST_API_ bool MatchRepetitionAndRegexAtHead(bool escaped, char ch, char repeat, const char *regex, const char *str)
const char kBreakOnFailureFlag[]
Definition: gtest-internal-inl.h:85
const char kRepeatFlag[]
Definition: gtest-internal-inl.h:93
const char * test_case_name() const
Definition: gtest-internal-inl.h:369
GTEST_API_ String WideStringToUtf8(const wchar_t *str, int num_chars)
Definition: gtest.cc:1525
const GLfloat * v
Definition: gl2.h:514
const char kCatchExceptionsFlag[]
Definition: gtest-internal-inl.h:86
const TestCase * current_test_case() const
Definition: gtest-internal-inl.h:778
void set_current_test_case(TestCase *a_current_test_case)
Definition: gtest-internal-inl.h:729
void ShuffleRange(internal::Random *random, int begin, int end, std::vector< E > *v)
Definition: gtest-internal-inl.h:290
OsStackTraceGetter()
Definition: gtest-internal-inl.h:501
TestEventListeners * listeners()
Definition: gtest-internal-inl.h:645
str
Definition: make-dist.py:305
GLsizei const GLchar *const * string
Definition: gl2.h:479
Definition: document.h:393
result
Definition: target-blank-opener-post-window.php:5
boolean repeat
Definition: KeyboardEvent.idl:63
int CountIf(const Container &c, Predicate predicate)
Definition: gtest-internal-inl.h:268
GTEST_API_ bool IsWhiteSpace(char ch)
bool matches_filter() const
Definition: gtest-internal-inl.h:363
Definition: gtest-internal-inl.h:325
const char kFilterFlag[]
Definition: gtest-internal-inl.h:88
static void ClearTestResult(TestInfo *test_info)
Definition: gtest-internal-inl.h:395
bool is(Ref< ArgType > &source)
Definition: Ref.h:220
TestPropertyKeyIs(const char *key)
Definition: gtest-internal-inl.h:330
Definition: gtest-internal-inl.h:431
FilePath original_working_dir_
Definition: gtest-options_test.cc:140
for i
Definition: complexityMeasures.m:24
bool Failed() const
Definition: gtest-internal-inl.h:626
Definition: bind.h:198
UInt32 Generate(UInt32 range)
Definition: gtest.cc:273
GTEST_API_ void ParseGoogleTestFlagsOnly(int *argc, char **argv)
Definition: gtest.cc:4650
void Shuffle(internal::Random *random, std::vector< E > *v)
Definition: gtest-internal-inl.h:311
const char kStackTraceDepthFlag[]
Definition: gtest-internal-inl.h:95
bool is_disabled() const
Definition: gtest-internal-inl.h:357
const char kPrintTimeFlag[]
Definition: gtest-internal-inl.h:91
Definition: gtest-port.h:1228
const std::vector< TraceInfo > & gtest_trace_stack() const
Definition: gtest-internal-inl.h:790
#define NULL
Definition: common_types.h:41
Definition: gtest-internal-inl.h:499
#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)
Definition: gtest-port.h:573
TimeInMillis elapsed_time() const
Definition: gtest-internal-inl.h:619
const char * test_case_comment() const
Definition: gtest-internal-inl.h:375
static FilePath GetCurrentDir()
Definition: gtest-filepath.cc:100
int random_seed() const
Definition: gtest-internal-inl.h:828
Definition: gtest-internal-inl.h:342
Definition: gtest-internal-inl.h:476
TestCase
Definition: gtest_test_utils.py:62
Definition: gtest-port.h:1209
GTEST_API_ bool IsValidEscape(char ch)
const char kThrowOnFailureFlag[]
Definition: gtest-internal-inl.h:96
void ForEach(const Container &c, Functor functor)
Definition: gtest-internal-inl.h:274
Definition: gtest-internal.h:525
GTEST_API_ bool IsInSet(char ch, const char *str)
Definition: gtest-port.h:659
GTEST_API_ Int32 Int32FromEnvOrDie(const char *env_var, Int32 default_val)
Definition: gtest.cc:4136
EGLImageKHR EGLint EGLint * handle
Definition: eglext.h:851
CFArrayRef CFTypeRef key
Definition: AVFoundationCFSoftLinking.h:129
void WriteToShardStatusFileIfNeeded()
Definition: gtest.cc:4069
const char kShuffleFlag[]
Definition: gtest-internal-inl.h:94
TestCase * GetMutableTestCase(int i)
Definition: gtest-internal-inl.h:639
void swap(optional< T > &x, optional< T > &y) __NOEXCEPT_(__NOEXCEPT_(x.swap(y)))
Definition: Optional.h:1047
const TestResult * ad_hoc_test_result() const
Definition: gtest-internal-inl.h:652
const char kOutputFlag[]
Definition: gtest-internal-inl.h:90
const TestResult * result() const
Definition: gtest-internal-inl.h:385
const TestInfo * current_test_info() const
Definition: gtest-internal-inl.h:780
Definition: GetPutInfo.h:232
bool operator()(const TestProperty &test_property) const
Definition: gtest-internal-inl.h:334
Definition: gtest-internal.h:770
void * handle_
Definition: system_delay_unittest.cc:41
GTEST_API_ bool ParseInt32Flag(const char *str, const char *flag, Int32 *value)
Definition: gtest.cc:4429
static void RecordProperty(TestResult *test_result, const TestProperty &property)
Definition: gtest-internal-inl.h:1055
Definition: gtest-internal-inl.h:522
GTestFlagSaver()
Definition: gtest-internal-inl.h:152