diff options
author | Caleb Morse <morse.caleb@gmail.com> | 2015-12-04 01:13:23 (GMT) |
---|---|---|
committer | Caleb Morse <cdmorse@sandia.gov> | 2015-12-04 02:23:56 (GMT) |
commit | ebd1d0887cdb6339667f42e413c45d372f96a5d6 (patch) | |
tree | a482c94f3900d021c81f0b1ea42978a588e91eda /googletest/docs/AdvancedGuide.md | |
parent | 1f8fe13618a5b23c937140a7c9ad498cd93392e1 (diff) | |
download | googletest-ebd1d0887cdb6339667f42e413c45d372f96a5d6.zip googletest-ebd1d0887cdb6339667f42e413c45d372f96a5d6.tar.gz googletest-ebd1d0887cdb6339667f42e413c45d372f96a5d6.tar.bz2 |
Fix link to FAQ in Primer.mdrefs/pull/654/head
Diffstat (limited to 'googletest/docs/AdvancedGuide.md')
-rw-r--r-- | googletest/docs/AdvancedGuide.md | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/googletest/docs/AdvancedGuide.md b/googletest/docs/AdvancedGuide.md index c24aa48..5ad10e1 100644 --- a/googletest/docs/AdvancedGuide.md +++ b/googletest/docs/AdvancedGuide.md @@ -265,7 +265,7 @@ int SmallestPrimeCommonDivisor(int m, int n) { ... } int n) { if (MutuallyPrime(m, n)) return ::testing::AssertionSuccess(); - + return ::testing::AssertionFailure() << m_expr << " and " << n_expr << " (" << m << " and " << n << ") are not mutually prime, " << "as they have a common divisor " @@ -804,7 +804,7 @@ For example, 11: EXPECT_EQ(1, Bar(n)); 12: EXPECT_EQ(2, Bar(n + 1)); 13: } -14: +14: 15: TEST(FooTest, Bar) { 16: { 17: SCOPED_TRACE("A"); // This trace point will be included in @@ -1199,9 +1199,9 @@ which are all in the `testing` namespace: | `Values(v1, v2, ..., vN)` | Yields values `{v1, v2, ..., vN}`. | | `ValuesIn(container)` and `ValuesIn(begin, end)` | Yields values from a C-style array, an STL-style container, or an iterator range `[begin, end)`. `container`, `begin`, and `end` can be expressions whose values are determined at run time. | | `Bool()` | Yields sequence `{false, true}`. | -| `Combine(g1, g2, ..., gN)` | Yields all combinations (the Cartesian product for the math savvy) of the values generated by the `N` generators. This is only available if your system provides the `<tr1/tuple>` header. If you are sure your system does, and Google Test disagrees, you can override it by defining `GTEST_HAS_TR1_TUPLE=1`. See comments in [include/gtest/internal/gtest-port.h](https://github.com/google/googletest/blob/master/googletest/include/gtest/internal/gtest-port.h) for more information. | +| `Combine(g1, g2, ..., gN)` | Yields all combinations (the Cartesian product for the math savvy) of the values generated by the `N` generators. This is only available if your system provides the `<tr1/tuple>` header. If you are sure your system does, and Google Test disagrees, you can override it by defining `GTEST_HAS_TR1_TUPLE=1`. See comments in [include/gtest/internal/gtest-port.h](../include/gtest/internal/gtest-port.h) for more information. | -For more details, see the comments at the definitions of these functions in the [source code](https://github.com/google/googletest/blob/master/googletest/include/gtest/gtest-param-test.h). +For more details, see the comments at the definitions of these functions in the [source code](../include/gtest/gtest-param-test.h). The following statement will instantiate tests from the `FooTest` test case each with parameter values `"meeny"`, `"miny"`, and `"moe"`. @@ -1249,8 +1249,8 @@ tests in the given test case, whether their definitions come before or _after_ the `INSTANTIATE_TEST_CASE_P` statement. You can see -[these](https://github.com/google/googletest/blob/master/googletest/samples/sample7_unittest.cc) -[files](https://github.com/google/googletest/blob/master/googletest/samples/sample8_unittest.cc) for more examples. +[these](../samples/sample7_unittest.cc) +[files](../samples/sample8_unittest.cc) for more examples. _Availability_: Linux, Windows (requires MSVC 8.0 or above), Mac; since version 1.2.0. @@ -1646,8 +1646,8 @@ _Availability:_ Linux, Windows, Mac; since v1.4.0. ## Defining Event Listeners ## To define a event listener, you subclass either -[testing::TestEventListener](https://github.com/google/googletest/blob/master/googletest/include/gtest/gtest.h#L991) -or [testing::EmptyTestEventListener](https://github.com/google/googletest/blob/master/googletest/include/gtest/gtest.h#L1044). +[testing::TestEventListener](../include/gtest/gtest.h#L991) +or [testing::EmptyTestEventListener](../include/gtest/gtest.h#L1044). The former is an (abstract) interface, where <i>each pure virtual method<br> can be overridden to handle a test event</i> (For example, when a test starts, the `OnTestStart()` method will be called.). The latter provides @@ -1656,10 +1656,10 @@ subclass only needs to override the methods it cares about. When an event is fired, its context is passed to the handler function as an argument. The following argument types are used: - * [UnitTest](https://github.com/google/googletest/blob/master/googletest/include/gtest/gtest.h#L1151) reflects the state of the entire test program, - * [TestCase](https://github.com/google/googletest/blob/master/googletest/include/gtest/gtest.h#L778) has information about a test case, which can contain one or more tests, - * [TestInfo](https://github.com/google/googletest/blob/master/googletest/include/gtest/gtest.h#L644) contains the state of a test, and - * [TestPartResult](https://github.com/google/googletest/blob/master/googletest/include/gtest/gtest-test-part.h#L47) represents the result of a test assertion. + * [UnitTest](../include/gtest/gtest.h#L1151) reflects the state of the entire test program, + * [TestCase](../include/gtest/gtest.h#L778) has information about a test case, which can contain one or more tests, + * [TestInfo](../include/gtest/gtest.h#L644) contains the state of a test, and + * [TestPartResult](../include/gtest/gtest-test-part.h#L47) represents the result of a test assertion. An event handler function can examine the argument it receives to find out interesting information about the event and the test program's @@ -1695,7 +1695,7 @@ state. Here's an example: To use the event listener you have defined, add an instance of it to the Google Test event listener list (represented by class -[TestEventListeners](https://github.com/google/googletest/blob/master/googletest/include/gtest/gtest.h#L1064) +[TestEventListeners](../include/gtest/gtest.h#L1064) - note the "s" at the end of the name) in your `main()` function, before calling `RUN_ALL_TESTS()`: ``` @@ -1723,7 +1723,7 @@ event listener list and delete it. You can do so by adding one line: Now, sit back and enjoy a completely different output from your tests. For more details, you can read this -[sample](https://github.com/google/googletest/blob/master/googletest/samples/sample9_unittest.cc). +[sample](../samples/sample9_unittest.cc). You may append more than one listener to the list. When an `On*Start()` or `OnTestPartResult()` event is fired, the listeners will receive it in @@ -1748,7 +1748,7 @@ failures. This ensures that failures generated by the latter are attributed to the right test by the former. We have a sample of failure-raising listener -[here](https://github.com/google/googletest/blob/master/googletest/samples/sample10_unittest.cc). +[here](../samples/sample10_unittest.cc). # Running Test Programs: Advanced Options # @@ -2173,7 +2173,7 @@ and you should see an `OUTPUT_DIR` directory being created with files `gtest/gtest.h` and `gtest/gtest-all.cc` in it. These files contain everything you need to use Google Test. Just copy them to anywhere you want and you are ready to write tests. You can use the -[scripts/test/Makefile](https://github.com/google/googletest/blob/master/googletest/scripts/test/Makefile) +[scripts/test/Makefile](../scripts/test/Makefile) file as an example on how to compile your tests against them. # Where to Go from Here # |