diff --git a/wiki/GoogleTestPrimer.wiki b/wiki/GoogleTestPrimer.wiki index 45acb7c2..8e23350a 100644 --- a/wiki/GoogleTestPrimer.wiki +++ b/wiki/GoogleTestPrimer.wiki @@ -1,9 +1,9 @@ #summary Getting started with Google C++ Testing Framework #labels Featured -= Google C++ Testing Framework Primer = + -== Introduction: Why Google C++ Testing Framework? == += Introduction: Why Google C++ Testing Framework? = _Google C++ Testing Framework_ helps you write better C++ tests. @@ -26,7 +26,7 @@ So let's go! _Note:_ We occasionally refer to Google C++ Testing Framework informally as _Google Test_. -== Basic Concepts == += Basic Concepts = When using Google Test, you start by writing _assertions_, which are statements that check whether a condition is true. An assertion's result can be _success_, @@ -46,7 +46,7 @@ A _test program_ can contain multiple test cases. We'll now explain how to write a test program, starting at the individual assertion level and building up to tests and test cases. -== Assertions == += Assertions = Google Test assertions are macros that resemble function calls. You test a class or function by making assertions about its behavior. When an assertion @@ -83,7 +83,7 @@ macro--in particular, C strings and `string` objects. If a wide string (`wchar_t*`, `TCHAR*` in `UNICODE` mode on Windows, or `std::wstring`) is streamed to an assertion, it will be translated to UTF-8 when printed. -=== Basic Assertions === +== Basic Assertions == These assertions do basic true/false condition testing. || *Fatal assertion* || *Nonfatal assertion* || *Verifies* || @@ -97,7 +97,7 @@ assertion failure means its containing test fails. _Availability_: Linux, Windows, Mac. -=== Binary Comparison === +== Binary Comparison == This section describes assertions that compare two values. @@ -142,7 +142,7 @@ and `wstring`). _Availability_: Linux, Windows, Mac. -=== String Comparison === +== String Comparison == The assertions in this group compare two *C strings*. If you want to compare two `string` objects, use `EXPECT_EQ`, `EXPECT_NE`, and etc instead. @@ -167,7 +167,7 @@ See also: For more string comparison tricks (substring, prefix, suffix, and regular expression matching, for example), see the [AdvancedGuide Advanced Google Test Guide]. -== Simple Tests == += Simple Tests = To create a test: # Use the `TEST()` macro to define and name a test function, These are ordinary C++ functions that don't return a value. @@ -217,7 +217,7 @@ case `FactorialTest`. _Availability_: Linux, Windows, Mac. -== Test Fixtures: Using the Same Data Configuration for Multiple Tests == += Test Fixtures: Using the Same Data Configuration for Multiple Tests = If you find yourself writing two or more tests that operate on similar data, you can use a _test fixture_. It allows you to reuse the same configuration of @@ -337,7 +337,7 @@ _Availability_: Linux, Windows, Mac. _Note_: Google Test automatically saves all _Google Test_ flags when a test object is constructed, and restores them when it is destructed. -== Invoking the Tests == += Invoking the Tests = `TEST()` and `TEST_F()` implicitly register their tests with Google Test. So, unlike with many other C++ testing frameworks, you don't have to re-list all your defined tests in order to run them. @@ -369,7 +369,7 @@ tests) and thus is not supported. _Availability_: Linux, Windows, Mac. -== Writing the main() Function == += Writing the main() Function = You can start from this boilerplate: {{{ @@ -440,13 +440,13 @@ in programs compiled in `UNICODE` mode as well. But maybe you think that writing all those main() functions is too much work? We agree with you completely and that's why Google Test provides a basic implementation of main(). If it fits your needs, then just link your test with gtest_main library and you are good to go. -== Where to Go from Here == += Where to Go from Here = Congratulations! You've learned the Google Test basics. You can start writing and running Google Test tests, read some GoogleTestSamples, or continue with GoogleTestAdvancedGuide, which describes many more useful Google Test features. -== Known Limitations == += Known Limitations = Google Test is designed to be thread-safe. However, we haven't had time to implement the synchronization primitives on various platforms