Lines Matching defs:Test
32 // The Google C++ Testing Framework (Google Test)
34 // This header file defines the public API for Google Test. It should be
35 // included by any test program that uses Google Test.
47 // Acknowledgment: Google Test borrowed the idea of automatic test
60 #include "gtest/gtest-death-test.h"
62 #include "gtest/gtest-param-test.h"
65 #include "gtest/gtest-test-part.h"
66 #include "gtest/gtest-typed-test.h"
93 // This flag controls whether Google Test catches all test-thrown exceptions
99 // to let Google Test decide.
106 // This flag causes the Google Test to list tests. None of the tests listed
110 // This flag controls whether Google Test emits a detailed XML report to a file
114 // This flags control whether Google Test prints the elapsed time for each
115 // test.
125 // This flag controls whether Google Test includes Google Test internal
142 // platforms test results are streamed to the specified port on
172 class Test;
185 // 1. Defining predicate functions to be used with Boolean test assertions
270 // Returns the text streamed into this AssertionResult. Test assertions
308 // with test assertions.
326 // In Google Test, a unit test program contains one or many TestCases, and
329 // When you define a test using the TEST macro, you don't need to
330 // explicitly derive from Test - the TEST macro automatically does
333 // The only time you derive from Test is when defining a test fixture
336 // class FooTest : public testing::Test {
346 // Test is not copyable.
347 class GTEST_API_ Test {
352 // a test case.
356 // The d'tor is virtual as we intend to inherit from Test.
357 virtual ~Test();
359 // Sets up the stuff shared by all tests in this test case.
361 // Google Test will call Foo::SetUpTestCase() before running the first
362 // test in test case Foo. Hence a sub-class can define its own
367 // Tears down the stuff shared by all tests in this test case.
369 // Google Test will call Foo::TearDownTestCase() after running the last
370 // test in test case Foo. Hence a sub-class can define its own
375 // Returns true iff the current test has a fatal failure.
378 // Returns true iff the current test has a non-fatal failure.
381 // Returns true iff the current test has a (either fatal or
385 // Logs a property for the current test, test case, or for the entire
386 // invocation of the test program when used outside of the context of a
387 // test case. Only the last value for a given key is remembered. These
389 // not members of the test fixture. Calls to RecordProperty made during
390 // lifespan of the test (from the moment its constructor starts to the
397 // Test) will be output as attributes of the <testsuites> element.
402 // Creates a Test object.
403 Test();
405 // Sets up the test fixture.
408 // Tears down the test fixture.
412 // Returns true iff the current test has the same fixture class as
413 // the first test in the current test case.
416 // Runs the test after the test fixture has been set up.
418 // A sub-class must implement this to define the test logic.
421 // Instead, use the TEST or TEST_F macro.
424 // Sets up, executes, and tears down the test.
431 // Uses a GTestFlagSaver to save and restore all Google Test flags.
435 // wondering why it is never called by Google Test. The declaration of
440 // will be a conflict if a user declares void Setup() in his test
444 test fixture.
454 GTEST_DISALLOW_COPY_AND_ASSIGN_(Test);
459 // A copyable object representing a user specified test property which can be
494 // The result of a single Test. This includes a list of
496 // death tests there are in the Test, and how much time it took to run
497 // the Test.
508 // Gets the number of all test parts. This is the sum of the number
509 // of successful test parts and the number of failed test parts.
512 // Returns the number of the test properties.
515 // Returns true iff the test passed (i.e. no test part failed).
518 // Returns true iff the test failed.
521 // Returns true iff the test fatally failed.
524 // Returns true iff the test has a non-fatal failure.
530 // Returns the i-th test part result among all the results. i can range
535 // Returns the i-th test property. i can range from 0 to
563 // Adds a test property to the list. The property is validated and may add
572 // Adds a failure if the key is a reserved attribute of Google Test
578 // Adds a test part result to the list.
581 // Returns the death test count.
584 // Increments the death test count, returning the new count.
587 // Clears the test part results.
610 // A TestInfo object stores the following information about a test:
612 // Test case name
613 // Test name
614 // Whether the test should be run
615 // A function pointer that creates the test object when invoked
616 // Test result
627 // Returns the test case name.
630 // Returns the test name.
634 // or a type-parameterized test.
642 // is not a value-parameterized test.
649 // Returns true if this test should run, that is if the test is not
653 // Google Test allows the user to filter the tests by their full names.
654 // The full name of a test Bar in test case Foo is defined as
659 // negative patterns (tests to exclude). A test is run if it
667 // Returns true iff this test will appear in the XML report.
675 // Returns the result of the test.
682 friend class Test;
692 Test::SetUpTestCaseFunc set_up_tc,
693 Test::TearDownTestCaseFunc tear_down_tc,
700 const char* a_type_param, // NULL if not a type-parameterized test
701 const char* a_value_param, // NULL if not a value-parameterized test
705 // Increments the number of death tests encountered in this test so
711 // Creates the test object, runs it, records its result, and then
719 // These fields are immutable properties of the test.
720 const std::string test_case_name_; // Test case name
721 const std::string name_; // Test name
723 // type-parameterized test.
726 // value-parameterized test.
728 const internal::TypeId fixture_class_id_; // ID of the test fixture class
729 bool should_run_; // True iff this test should run
730 bool is_disabled_; // True iff this test is disabled
731 bool matches_filter_; // True if this test matches the
734 // the test object
737 // test for the second time.
743 // A test case, which consists of a vector of TestInfos.
755 // name: name of the test case
756 // a_type_param: the name of the test's type parameter, or NULL if
757 // this is not a type-parameterized test.
758 // set_up_tc: pointer to the function that sets up the test case
759 // tear_down_tc: pointer to the function that tears down the test case
761 Test::SetUpTestCaseFunc set_up_tc,
762 Test::TearDownTestCaseFunc tear_down_tc);
771 // type-parameterized test case.
778 // Returns true if any test in this test case should run.
781 // Gets the number of successful tests in this test case.
784 // Gets the number of failed tests in this test case.
790 // Gets the number of disabled tests in this test case.
796 // Get the number of tests in this test case that should run.
799 // Gets the number of all tests in this test case.
802 // Returns true iff the test case passed.
805 // Returns true iff the test case failed.
811 // Returns the i-th test among all the tests. i can range from 0 to
815 // Returns the TestResult that holds test properties recorded during
820 friend class Test;
831 // Returns the i-th test among all the tests. i can range from 0 to
838 // Adds a TestInfo to this test case. Will delete the TestInfo upon
842 // Clears the results of all tests in this test case.
845 // Clears the results of all tests in the given test case.
850 // Runs every test in this TestCase.
861 // Returns true iff test passed.
866 // Returns true iff test failed.
871 // Returns true iff the test is disabled and will be reported in the XML
877 // Returns true iff test is disabled.
882 // Returns true iff this test will appear in the XML report.
887 // Returns true if the given test should run.
892 // Shuffles the tests in this test case.
895 // Restores the test order to before the first shuffle.
898 // Name of the test case.
901 // type-parameterized test.
906 // Provides a level of indirection for the test list to allow easy
907 // shuffling and restoring the test order. The i-th element in this
908 // vector is the index of the i-th test in the shuffled test list.
910 // Pointer to the function that sets up the test case.
911 Test::SetUpTestCaseFunc set_up_tc_;
912 // Pointer to the function that tears down the test case.
913 Test::TearDownTestCaseFunc tear_down_tc_;
914 // True iff any test in this test case should run.
918 // Holds test properties recorded during execution of SetUpTestCase and
935 // as in some cases Google Test is used where exceptions are enabled, and
963 // Fired before any test activity starts.
978 // Fired before the test case starts.
981 // Fired before the test starts.
987 // Fired after the test ends.
990 // Fired after the test case ends.
1003 // Fired after all test activities have ended.
1031 // TestEventListeners lets users add listeners to track events in Google Test.
1037 // Appends an event listener to the end of the list. Google Test assumes
1039 // the test program finishes).
1134 // Returns the working directory when the first TEST() or TEST_F()
1138 // Returns the TestCase object for the test that's currently running,
1139 // or NULL if no test is running.
1143 // Returns the TestInfo object for the test that's currently running,
1144 // or NULL if no test is running.
1148 // Returns the random seed used at the start of the current test run.
1160 // Gets the number of successful test cases.
1163 // Gets the number of failed test cases.
1166 // Gets the number of all test cases.
1169 // Gets the number of all test cases that contain at least one test
1194 // Gets the time of the test program start, in ms from the start of the
1201 // Returns true iff the unit test passed (i.e. all test cases passed).
1204 // Returns true iff the unit test failed (i.e. some test case failed
1208 // Gets the i-th test case among all the test cases. i can range from 0 to
1212 // Returns the TestResult containing information on test failures and
1213 // properties logged outside of individual test cases.
1217 // inside Google Test.
1221 // Registers and returns a global test environment. When a test
1222 // program is run, all global test environments will be set-up in
1224 // have finished, all global test environments will be torn-down in
1233 // Google Test assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc)
1244 // inside a test, to current TestCase's ad_hoc_test_result_ when invoked
1250 // Gets the i-th test case among all the test cases. i can range from 0 to
1260 friend class Test;
1278 // Google Test trace stack.
1282 // Pops a trace from the per-thread Google Test trace stack.
1300 // A convenient wrapper for adding an environment for the test
1322 // Initializes Google Test. This must be called before calling
1324 // flags that Google Test recognizes. Whenever a Google Test flag is
1327 // No value is returned. Instead, the Google Test flag variables are
1766 // A value-parameterized class must inherit from both ::testing::Test and
1768 // from ::testing::TestWithParam, but more complicated test hierarchies
1769 // may need to inherit from Test and WithParamInterface at different levels.
1771 // This interface has support for accessing the test parameter value via
1805 // The current parameter value. Is also available in the test fixture's
1808 // like writing 'WithParamInterface<bool>::GetParam()' for a test that
1812 << "GetParam() can only be called inside a value-parameterized test "
1819 // remains alive and unchanged throughout the current test.
1824 // Static value used for accessing parameter during a test lifetime.
1827 // TestClass must be a subclass of WithParamInterface<T> and Test.
1838 class TestWithParam : public Test, public WithParamInterface<T> {
1843 // Macros for indicating success/failure in test code.
1845 // ADD_FAILURE unconditionally adds a failure to the current test.
1847 // current test successful, as a test is only successful when it has
1940 // When they are not, Google Test prints both the tested expressions and
2077 // Google Test uses ULP-based comparison to automatically pick a default
2121 // Macros that test for HRESULT failure and success, these are only useful
2126 // When expr unexpectedly fails or succeeds, Google Test prints the
2160 // number, and the given message) to be included in every test failure
2210 // Defines a test.
2212 // The first parameter is the name of the test case, and the second
2213 // parameter is the name of the test within the test case.
2215 // The convention is to end the test case name with "Test". For
2216 // example, a test case for the Foo class can be named FooTest.
2218 // The user should put his test code between braces after using this
2221 // TEST(FooTest, InitializesCorrectly) {
2227 // ::testing::Test>() here to get the type ID of testing::Test. This
2228 // is to work around a suspected linker bug when using Google Test as
2230 // ::testing::Test>() to return different values depending on whether
2231 // the call is from the Google Test framework itself or from user test
2233 // value, as it always calls GetTypeId<>() from the Google Test
2237 ::testing::Test, ::testing::internal::GetTestTypeId())
2239 // Define this macro to 1 to omit the definition of TEST(), which
2242 # define TEST(test_case_name, test_name) GTEST_TEST(test_case_name, test_name)
2245 // Defines a test that uses a test fixture.
2247 // The first parameter is the name of the test fixture class, which
2248 // also doubles as the test case name. The second parameter is the
2249 // name of the test within the test case.
2251 // A test fixture class must be declared earlier. The user should put
2252 // his test code between braces after using this macro. Example:
2254 // class FooTest : public testing::Test {