diff --git a/wiki/GoogleTestAdvancedGuide.wiki b/wiki/GoogleTestAdvancedGuide.wiki index f82d8b14..253a42c8 100644 --- a/wiki/GoogleTestAdvancedGuide.wiki +++ b/wiki/GoogleTestAdvancedGuide.wiki @@ -807,7 +807,7 @@ are initialized). _Availability:_ Linux, Windows, Mac. -== Value-parameterized tests == += Value-Parameterized Tests = _Value-parameterized tests_ allow you to test your code with different parameters without writing multiple copies of the same test. This is @@ -831,7 +831,7 @@ class FooTest : public testing::TestWithParam { }}} Then, use the `TEST_P` macro to define as many test patterns using -this fixture as you want. The _`P`_ suffix is for "parameterized" or +this fixture as you want. The `_P` suffix is for "parameterized" or "pattern", whichever you prefer to think. {{{ @@ -848,16 +848,16 @@ TEST_P(FooTest, HasBlahBlah) { }}} Finally, you can use `INSTANTIATE_TEST_CASE_P` to instantiate the test -case with any set of parameters you want. gUnit defines a number of +case with any set of parameters you want. Google Test defines a number of functions for generating test parameters. They return what we call (surprise!) _parameter generators_. Here is a summary of them, which are all in the `testing` namespace: -|| `Range(begin, end [, step])` || Yields values `{begin, begin+step, begin+step+step, ...}`. The values do not include `end`. `step` defaults to 1. || +|| `Range(begin, end[, step])` || Yields values `{begin, begin+step, begin+step+step, ...}`. The values do not include `end`. `step` defaults to 1. || || `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)`. || || `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 `` 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 [http://code.google.com/p/googletest/source/browse/trunk/include/gtest/internal/gtest-port.h 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 `` 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 [http://code.google.com/p/googletest/source/browse/trunk/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 [http://code.google.com/p/googletest/source/browse/trunk/include/gtest/gtest-param-test.h source code]. @@ -884,7 +884,7 @@ names: * `InstantiationName/FooTest.HasBlahBlah/1` for `"miny"` * `InstantiationName/FooTest.HasBlahBlah/2` for `"moe"` -You can use these names in [#TestFilter --gtest_filter]. +You can use these names in [#Running_a_Subset_of_the_Tests --gtest_filter]. This statement will instantiate all tests from `FooTest` again, each with parameter values `"cat"` and `"dog"`: @@ -910,7 +910,7 @@ You can see [http://code.google.com/p/googletest/source/browse/trunk/samples/sample7_unittest.cc these] [http://code.google.com/p/googletest/source/browse/trunk/samples/sample8_unittest.cc files] for more examples. -_Availability_: Linux, Windows (requires MSVC 8.0 or above), Mac.; Since version 1.2.0. +_Availability_: Linux, Windows (requires MSVC 8.0 or above), Mac; since version 1.2.0. = Typed Tests = @@ -1083,7 +1083,7 @@ two cases to consider: * Static functions (_not_ the same as static member functions!) or unnamed namespaces, and * Private or protected class members -== Static functions == +== Static Functions == Both static functions and definitions/declarations in an unnamed namespace are only visible within the same translation unit. To test them, you can `#include` @@ -1098,7 +1098,7 @@ production `.cc` files and your tests are allowed to include this internal header, but your clients are not. This way, you can fully test your internal implementation without leaking it to your clients. -== Private class members == +== Private Class Members == Private class members are only accessible from within the class or by friends. To access a class' private members, you can declare your test fixture as a @@ -1273,7 +1273,7 @@ and/or command line flags. For the flags to work, your programs must call If an option is specified both by an environment variable and by a flag, the latter takes precedence. -== Turning Assertion Failures into Break-Points: `GTEST_BREAK_ON_FAILURE` and `--gtest_break_on_failure` == +== Turning Assertion Failures into Break-Points == When running test programs under a debugger, it's very convenient if the debugger can catch an assertion failure and automatically drop into interactive @@ -1285,7 +1285,7 @@ command line flag. _Availability:_ Linux, Windows, Mac. -== Suppressing Pop-ups Caused by Exceptions: `GTEST_CATCH_EXCEPTIONS` and `--gtest_catch_exceptions` == +== Suppressing Pop-ups Caused by Exceptions == On Windows, Google Test may be used with exceptions enabled. Even when exceptions are disabled, an application can still throw structured exceptions @@ -1303,7 +1303,7 @@ _Availability:_ Windows. `GTEST_CATCH_EXCEPTIONS` and Mac, even if exceptions are enabled. It is possible to add support for catching exceptions on these platforms, but it is not implemented yet. -== Running a Subset of the Tests: `GTEST_FILTER` and `--gtest_filter` == +== Running a Subset of the Tests == By default, a Google Test program runs all tests the user has defined. Sometimes, you want to run only a subset of the tests (e.g. for debugging or @@ -1333,7 +1333,7 @@ For example: _Availability:_ Linux, Windows, Mac. -== Listing Test Names: `--gtest_list_tests` == +== Listing Test Names == Sometimes it is necessary to list the available tests in a program before running them so that a filter may be applied if needed. Including the flag @@ -1352,7 +1352,7 @@ corresponding environment variable for this flag. _Availability:_ Linux, Windows, Mac. -== Generating an XML Report: GTEST_OUTPUT and `--gtest_output` == +== Generating an XML Report == Google Test can emit a detailed XML report to a file in addition to its normal textual output. The report contains the duration of each test, and thus can @@ -1428,7 +1428,7 @@ Things to note: _Availability:_ Linux, Windows, Mac. -== Colored Terminal Output: `GTEST_COLOR` and `--gtest_color` == +== Colored Terminal Output == Google Test can use colors in its terminal output to make it easier to spot the separation between tests, and whether tests passed. @@ -1442,7 +1442,7 @@ non-Windows platforms) the `TERM` environment variable is set to `xterm` or _Availability:_ Linux, Windows, Mac. -== Printing the Elapsed Time: `GTEST_PRINT_TIME` and `--gtest_print_time` == +== Printing the Elapsed Time == By default, Google Test does not show you the time it takes to run each test. To see that, run the test program with the @@ -1452,7 +1452,7 @@ same effect. _Availability:_ Linux, Windows, Mac. -== Repeating the Tests: `GTEST_REPEAT` and `--gtest_repeat` == +== Repeating the Tests == Once in a while you'll run into a test whose result is hit-or-miss. Perhaps it will fail only 1% of the time, making it rather hard to reproduce the bug under