Home | History | Annotate | Download | only in src

Lines Matching defs:Test

32 // The Google C++ Testing Framework (Google Test)
129 // Indicates that this translation unit is part of Google Test's
151 // A test whose test case name or test name matches this filter is
155 // A test case whose name matches this filter is considered a death
156 // test case and will be run before test cases whose name doesn't
160 // A test filter that matches everything.
166 // The environment variable name for the test shard index.
168 // The environment variable name for the total number of test shards.
170 // The environment variable name for the test shard status file.
203 " should catch exceptions and treat them as test failures.");
219 "exclude). A test is run if it matches one of the positive "
233 "within that directory, with file-names based on the test "
246 "Random number seed to use when shuffling test orders. Must be in range "
252 "How many times to repeat each test. Specify a negative number "
258 "printing test failure stack traces.");
276 "test results. Example: \"localhost:555\". The flag is effective only on "
308 // Google Test. Useful for catching the user mistake of not initializing
309 // Google Test before calling RUN_ALL_TESTS().
312 // Test. g_init_gtest_count is set to the number of times
330 // Returns true iff the test case passed.
335 // Returns true iff the test case failed.
340 // Returns true iff test_case contains at least one test that should
439 // works well enough for matching test names, which are short.
478 // Returns true iff the user-specified filter matches the test case
479 // name and the test name.
503 // test if any pattern in it matches the test.
509 // Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the
513 // Google Test should handle a SEH exception if:
538 // The c'tor sets this object as the test part result reporter used by
539 // Google Test. The 'result' parameter specifies where to report the
548 // The c'tor sets this object as the test part result reporter used by
549 // Google Test. The 'result' parameter specifies where to report the
569 // The d'tor restores the test part result reporter used by Google Test
580 // Increments the test part result count and remembers the result.
589 // Returns the type ID of ::testing::Test. We should always call this
590 // instead of GetTypeId< ::testing::Test>() to get the type ID of
591 // testing::Test. This is to work around a suspected linker bug when
592 // using Google Test as a framework on Mac OS X. The bug causes
593 // GetTypeId< ::testing::Test>() to return different values depending
594 // on whether the call is from the Google Test framework itself or
595 // from user test code. GetTestTypeId() is guaranteed to always
597 // gtest.cc, which is within the Google Test framework.
599 return GetTypeId<Test>();
602 // The value of GetTestTypeId() as seen from within the Google Test
606 // This predicate-formatter checks that 'results' contains a test part
646 // test part results, what type of failure we expect, and what
681 // Returns the global test part result reporter.
688 // Sets the global test part result reporter.
695 // Returns the test part result reporter for the current thread.
701 // Sets the test part result reporter for the current thread.
707 // Gets the number of successful test cases.
712 // Gets the number of failed test cases.
717 // Gets the number of all test cases.
722 // Gets the number of all test cases that contain at least one test
1677 // Appends the user-supplied message to the Google-Test-generated message.
1703 // Returns the i-th test part result among all the results. i can
1712 // Returns the i-th test property. i can range from 0 to
1721 // Clears the test part results.
1726 // Adds a test part result to the list.
1731 // Adds a test property to the list. If a property with the same key as the
1846 // Returns true iff the test failed.
1855 // Returns true iff the test part fatally failed.
1860 // Returns true iff the test fatally failed.
1865 // Returns true iff the test part non-fatally failed.
1870 // Returns true iff the test has a non-fatal failure.
1875 // Gets the number of all test parts. This is the sum of the number
1876 // of successful test parts and the number of failed test parts.
1881 // Returns the number of the test properties.
1886 // class Test
1888 // Creates a Test object.
1890 // The c'tor saves the values of all Google Test flags.
1891 Test::Test()
1895 // The d'tor restores the values of all Google Test flags.
1896 Test::~Test() {
1900 // Sets up the test fixture.
1903 void Test::SetUp() {
1906 // Tears down the test fixture.
1909 void Test::TearDown() {
1913 void Test::RecordProperty(const std::string& key, const std::string& value) {
1918 void Test::RecordProperty(const std::string& key, int value) {
1940 // Google Test requires all tests in the same test case to use the same test
1941 // fixture class. This function checks if the current test has the
1942 // same fixture class as the first test in the current test case. If
1943 // yes, it returns true; otherwise it generates a Google Test failure and
1945 bool Test::HasSameFixtureClass() {
1949 // Info about the first test in the current test case.
1954 // Info about the current test.
1960 // Is the first test defined using TEST?
1962 // Is this test defined using TEST?
1966 // The user mixed TEST and TEST_F in this test case - we'll tell
1969 // Gets the name of the TEST and the name of the TEST_F. Note
1978 << "All tests in the same test case must use the same test fixture\n"
1979 << "class, so mixing TEST_F and TEST in the same test case is\n"
1980 << "illegal. In test case " << this_test_info->test_case_name()
1982 << "test " << TEST_F_name << " is defined using TEST_F but\n"
1983 << "test " << TEST_name << " is defined using TEST. You probably\n"
1984 << "want to change the TEST to TEST_F or move it to another test\n"
1990 << "All tests in the same test case must use the same test fixture\n"
1991 << "class. However, in test case "
1993 << "you defined test " << first_test_name
1994 << " and test " << this_test_name << "\n"
1995 << "using two different test fixture classes. This can happen if\n"
1998 << "of the classes to put the tests into different test cases.";
2008 // Adds an "exception thrown" fatal failure to the current test. This
2027 // Adds an "exception thrown" fatal failure to the current test.
2088 // NOTE: The user code can affect the way in which Google Test handles
2095 // // Perform the test method.
2108 // throw statement in the code under test. For this reason, we perform
2109 // the check early, sacrificing the ability to affect Google Test's
2117 // Test assertion with the intention of letting another testing
2140 // Runs the test and updates the test result.
2141 void Test::Run() {
2146 internal::HandleExceptionsInMethodIfSupported(this, &Test::SetUp, "SetUp()");
2147 // We will run the test only if SetUp() was successful.
2151 this, &Test::TestBody, "the test body");
2155 // always call TearDown(), even if SetUp() or the test body has
2159 this, &Test::TearDown, "TearDown()");
2162 // Returns true iff the current test has a fatal failure.
2163 bool Test::HasFatalFailure() {
2167 // Returns true iff the current test has a non-fatal failure.
2168 bool Test::HasNonfatalFailure() {
2175 // Constructs a TestInfo object. It assumes ownership of the test factory
2199 // Creates a new TestInfo object and registers it with Google Test;
2204 // test_case_name: name of the test case
2205 // name: name of the test
2206 // type_param: the name of the test's type parameter, or NULL if
2207 // this is not a typed or a type-parameterized test.
2208 // value_param: text representation of the test's value parameter,
2209 // or NULL if this is not a value-parameterized test.
2210 // fixture_class_id: ID of the test fixture class
2211 // set_up_tc: pointer to the function that sets up the test case
2212 // tear_down_tc: pointer to the function that tears down the test case
2213 // factory: pointer to the factory that creates a test object.
2237 << "Attempted redefinition of test case " << test_case_name << ".\n"
2238 << "All tests in the same test case must use the same test fixture\n"
2239 << "class. However, in test case " << test_case_name << ", you tried\n"
2240 << "to define a test using a fixture class different from the one\n"
2244 << "test cases.";
2255 // A predicate that checks the test name of a TestInfo against a known
2271 // Returns true iff the test name of test_info matches name_.
2298 // Creates the test object, runs it, records its result, and then
2303 // Tells UnitTest where to store test result.
2309 // Notifies the unit test event listeners that a test is about to start.
2316 // Creates the test object.
2317 Test* const test = internal::HandleExceptionsInMethodIfSupported(
2319 "the test fixture's constructor");
2321 // Runs the test only if the test object was created and its
2323 if ((test != NULL) && !Test::HasFatalFailure()) {
2326 test->Run();
2329 // Deletes the test object.
2332 test, &Test::DeleteSelf_, "the test fixture's destructor");
2336 // Notifies the unit test event listener that a test has just finished.
2340 // test.
2346 // Gets the number of successful tests in this test case.
2351 // Gets the number of failed tests in this test case.
2361 // Gets the number of disabled tests in this test case.
2371 // Get the number of tests in this test case that should run.
2385 // name: name of the test case
2386 // a_type_param: the name of the test case's type parameter, or NULL if
2387 // this is not a typed or a type-parameterized test case.
2388 // set_up_tc: pointer to the function that sets up the test case
2389 // tear_down_tc: pointer to the function that tears down the test case
2391 Test::SetUpTestCaseFunc set_up_tc,
2392 Test::TearDownTestCaseFunc tear_down_tc)
2403 // Deletes every Test in the collection.
2407 // Returns the i-th test among all the tests. i can range from 0 to
2414 // Returns the i-th test among all the tests. i can range from 0 to
2421 // Adds a test to this test case. Will delete the test upon
2428 // Runs every test in this TestCase.
2456 // Clears the results of all tests in this test case.
2462 // Shuffles the tests in this test case.
2467 // Restores the test order to before the first shuffle.
2488 return FormatCountableNoun(test_count, "test", "tests");
2491 // Formats the count of test cases.
2493 return FormatCountableNoun(test_case_count, "test case", "test cases");
2499 // between the two when viewing the test result.
2535 // If the test program runs in Visual Studio or a debugger, the
2536 // following statements add the test part result message to the Output
2584 // Returns true iff Google Test should use colors in the output.
2667 // Text printed in Google Test's text output and --gunit_list_tests
2668 // output to label the type parameter and value parameter for a test.
2695 static void PrintTestName(const char * test_case, const char * test) {
2696 printf("%s.%s", test_case, test);
2736 "Note: This is test shard %d of %s.\n",
2757 printf("Global test environment set-up.\n");
2763 FormatCountableNoun(test_case.test_to_run_count(), "test", "tests");
2784 // If the test part succeeded, we don't need to do anything.
2816 FormatCountableNoun(test_case.test_to_run_count(), "test", "tests");
2827 printf("Global test environment tear-down\n");
2877 num_failures == 1 ? "TEST" : "TESTS");
2888 num_disabled == 1 ? "TEST" : "TESTS");
2890 // Ensure that Google Test output is printed before, e.g., heapchecker output.
2907 // in death test child processes.
2927 // in death test child processes.
3072 // Produces a string representing the test properties in a result as space
3094 // Called after the unit test ends.
3199 // This is how Google Test concepts map to the DTD:
3203 // <testcase name="test-name"> <-- corresponds to a TestInfo object
3397 // Produces a string representing the test properties in a result as space
3418 // arbitrarily long test failure message and stack trace.
3485 // trace stack maintained by Google Test.
3536 // don't want to fail the test because of this.
3662 // Gets the number of successful test cases.
3667 // Gets the number of failed test cases.
3672 // Gets the number of all test cases.
3677 // Gets the number of all test cases that contain at least one test
3712 // Gets the time of the test program start, in ms from the start of the
3723 // Returns true iff the unit test passed (i.e. all test cases passed).
3726 // Returns true iff the unit test failed (i.e. some test case failed
3730 // Gets the i-th test case among all the test cases. i can range from 0 to
3736 // Returns the TestResult containing information on test failures and
3737 // properties logged outside of individual test cases.
3742 // Gets the i-th test case among all the test cases. i can range from 0 to
3749 // inside Google Test.
3754 // Registers and returns a global test environment. When a test
3755 // program is run, all global test environments will be set-up in the
3757 // finished, all global test environments will be torn-down in the
3773 // Adds a TestPartResult to the current TestResult object. All Google Test
3811 // in the code (perhaps in order to use Google Test assertions
3840 // inside a test, to current TestCase's ad_hoc_test_result_ when invoked
3858 // Google Test implements this protocol for catching that a test
3859 // program exits before returning control to Google Test:
3861 // 1. Upon start, Google Test creates a file whose absolute path
3864 // 2. When Google Test has finished its work, it deletes the file.
3866 // This allows a test runner to set TEST_PREMATURE_EXIT_FILE before
3867 // running a Google-Test-based test program and check the existence
3868 // of the file at the end of the test execution to see if it has
3871 // If we are in the child process of a death test, don't
3876 // premature-exit file will be left undeleted, causing a test runner
3878 // test as having failed.
3888 // Either the user wants Google Test to catch exceptions thrown by the
3889 // tests or this is executing in the context of death test child
3900 // Death test children can be terminated with _abort(). On Windows,
3910 // executed. Google Test will notify the user of any unexpected
3929 "auxiliary test code (environments or event listeners)") ? 0 : 1;
3932 // Returns the working directory when the first TEST() or TEST_F() was
3938 // Returns the TestCase object for the test that's currently running,
3939 // or NULL if no test is running.
3946 // Returns the TestInfo object for the test that's currently running,
3947 // or NULL if no test is running.
3954 // Returns the random seed used at the start of the current test run.
3978 // Google Test trace stack.
3985 // Pops a trace from the per-thread Google Test trace stack.
4044 // context of a test, to current test case's ad_hoc_test_result when invoke
4066 // Disables event forwarding if the control is currently in a death test
4089 // Initializes event listeners for streaming test results in string form.
4132 // Configures listeners for streaming test results to the specified server.
4168 // test_case_name: name of the test case
4169 // type_param: the name of the test case's type parameter, or NULL if
4170 // this is not a typed or a type-parameterized test case.
4171 // set_up_tc: pointer to the function that sets up the test case
4172 // tear_down_tc: pointer to the function that tears down the test case
4175 Test::SetUpTestCaseFunc set_up_tc,
4176 Test::TearDownTestCaseFunc tear_down_tc) {
4189 // Is this a death test case?
4192 // Yes. Inserts the test case after the last death test case
4193 // defined so far. This only works when the test cases haven't
4194 // been shuffled. Otherwise we may end up running a death test
4195 // after a non-death test.
4215 // thrown during a test, the test is considered to be failed, but the
4226 "\nThis test program did NOT call ::testing::InitGoogleTest "
4231 // Do not run any test if the --help flag was specified.
4239 // Even if sharding is not on, test runners may want to use the
4240 // GTEST_SHARD_STATUS_FILE to query whether the test supports the sharding
4245 // death test.
4255 // Compares the full test names with the filter to decide which
4271 // True iff at least one test has failed.
4280 // when we are inside the subprocess of a death test.
4285 // We want to preserve failures generated by ad-hoc test
4291 // Shuffles test cases and tests if requested.
4295 // such that a test event listener can see the actual test order
4300 // Tells the unit test event listeners that the tests are about to start.
4303 // Runs each test case if there is at least one test to run.
4312 if (!Test::HasFatalFailure()) {
4328 // Tells the unit test event listener that the tests have just finished.
4336 // Restores the original test order after the iteration. This
4365 "Could not write to the test shard status file \"%s\" "
4379 // disabled because it must only be applied to the original test
4440 // Given the total number of shards, the shard index, and the test id,
4441 // returns true iff the test should be run on this shard. The test id is
4442 // some arbitrary but unique non-negative integer assigned to each test
4448 // Compares the name of each test with the user-specified filter to
4449 // decide whether the test should be run, then records the result in
4475 // A test is disabled if test case name or test name matches
4592 // Returns the TestResult for the test that's currently running, or
4593 // the TestResult for the ad hoc test if no test is running.
4599 // Shuffles all test cases, and the tests within each test case,
4602 // Shuffles the death test cases.
4605 // Shuffles the non-death test cases.
4609 // Shuffles the tests inside each test case.
4615 // Restores the test cases and tests to their order before the first shuffle.
4618 // Unshuffles the tests in each test case.
4620 // Resets the index of each test case.
4761 // Determines whether a string has a prefix that Google Test uses for its
4763 // If Google Test detects that a command line flag has its prefix but is not
4765 // GTEST_INTERNAL_PREFIX_ followed by "internal_" are considered Google Test
4786 // capturing to Google Test.
4825 "Test Selection:\n"
4828 " TEST(Foo, Bar) is \"Foo.Bar\".\n"
4837 "Test Execution:\n"
4843 " Random number seed to use for shuffling test orders (between 1 and\n"
4846 "Test Output:\n"
4850 " Don't print the elapsed time of each test.\n"
4857 " Stream test results to the given server.\n"
4863 " Set the default death test style.\n"
4870 " Do not report exceptions as test failures. Instead, allow them\n"
4885 // Parses the command line for Google Test flags, without initializing
4886 // other parts of Google Test. The type parameter CharType can be
4898 // Do we see a Google Test flag?
4943 // Both help flag and unrecognized Google Test flags (excluding
4952 // Test with another testing framework.
4957 // Parses the command line for Google Test flags, without initializing
4958 // other parts of Google Test.
4996 // Initializes Google Test. This must be called before calling
4998 // flags that Google Test recognizes. Whenever a Google Test flag is
5001 // No value is returned. Instead, the Google Test flag variables are