Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sample10_unittest.cc File Reference
#include <stdio.h>
#include <stdlib.h>
#include "gtest/gtest.h"
Include dependency graph for sample10_unittest.cc:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 108 of file sample10_unittest.cc.

108 {
109 InitGoogleTest(&argc, argv);
110
111 bool check_for_leaks = false;
112 if (argc > 1 && strcmp(argv[1], "--check_for_leaks") == 0 )
113 check_for_leaks = true;
114 else
115 printf("%s\n", "Run this program with --check_for_leaks to enable "
116 "custom leak checking in the tests.");
117
118 // If we are given the --check_for_leaks command line flag, installs the
119 // leak checker.
120 if (check_for_leaks) {
121 TestEventListeners& listeners = UnitTest::GetInstance()->listeners();
122
123 // Adds the leak checker to the end of the test event listener list,
124 // after the default text output printer and the default XML report
125 // generator.
126 //
127 // The order is important - it ensures that failures generated in the
128 // leak checker's OnTestEnd() method are processed by the text and XML
129 // printers *before* their OnTestEnd() methods are called, such that
130 // they are attributed to the right test. Remember that a listener
131 // receives an OnXyzStart event *after* listeners preceding it in the
132 // list received that event, and receives an OnXyzEnd event *before*
133 // listeners preceding it.
134 //
135 // We don't need to worry about deleting the new listener later, as
136 // Google Test will do it.
137 listeners.Append(new LeakChecker);
138 }
139 return RUN_ALL_TESTS();
140}
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
Definition gtest.h:2328
char ** argv
LOGGING_API void printf(Category category, const char *format,...)
Definition Logging.cpp:30
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
Definition gtest.cc:5787
Here is the call graph for this function: