# The gtest/gtest_main targets carry header search path
# The gtest/gtest_main targets carry header search path
# dependencies automatically when using CMake 2.8.11 or
# dependencies automatically when using CMake 2.8.11 or
...
@@ -182,6 +183,17 @@ technique is discussed in more detail in
...
@@ -182,6 +183,17 @@ technique is discussed in more detail in
which also contains a link to a fully generalized implementation
which also contains a link to a fully generalized implementation
of the technique.
of the technique.
##### Visual Studio Dynamic vs Static Runtimes #####
By default, new Visual Studio projects link the C runtimes dynamically
but Google Test links them statically.
This will generate an error that looks something like the following:
gtest.lib(gtest-all.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in main.obj
Google Test already has a CMake option for this: `gtest_force_shared_crt`
Enabling this option will make gtest link the runtimes dynamically too,
(The stuff inside the angled brackets for the `static_cast` operator is the
(The stuff inside the angled brackets for the `static_cast` operator is the
...
@@ -512,14 +512,14 @@ bool IsNegative(T x) {
...
@@ -512,14 +512,14 @@ bool IsNegative(T x) {
you can use it in a predicate assertion like this:
you can use it in a predicate assertion like this:
``` cpp
``` cpp
ASSERT_PRED1(IsNegative*<int>*,-5);
ASSERT_PRED1(IsNegative<int>,-5);
```
```
Things are more interesting if your template has more than one parameters. The
Things are more interesting if your template has more than one parameters. The
following won't compile:
following won't compile:
``` cpp
``` cpp
ASSERT_PRED2(*GreaterThan<int,int>*,5,0);
ASSERT_PRED2(GreaterThan<int,int>,5,0);
```
```
...
@@ -528,7 +528,7 @@ which is one more than expected. The workaround is to wrap the predicate
...
@@ -528,7 +528,7 @@ which is one more than expected. The workaround is to wrap the predicate
function in parentheses:
function in parentheses:
``` cpp
``` cpp
ASSERT_PRED2(*(GreaterThan<int,int>)*,5,0);
ASSERT_PRED2((GreaterThan<int,int>),5,0);
```
```
...
@@ -1034,7 +1034,7 @@ namespace bar {
...
@@ -1034,7 +1034,7 @@ namespace bar {
TEST(CoolTest, DoSomething) {
TEST(CoolTest, DoSomething) {
SUCCEED();
SUCCEED();
}
}
} // namespace foo
} // namespace bar
```
```
However, the following code is **not allowed** and will produce a runtime error from Google Test because the test methods are using different test fixture classes with the same test case name.
However, the following code is **not allowed** and will produce a runtime error from Google Test because the test methods are using different test fixture classes with the same test case name.
...
@@ -1052,7 +1052,7 @@ class CoolTest : public ::testing::Test {}; // Fixture: bar::CoolTest
...
@@ -1052,7 +1052,7 @@ class CoolTest : public ::testing::Test {}; // Fixture: bar::CoolTest
TEST_F(CoolTest, DoSomething) {
TEST_F(CoolTest, DoSomething) {
SUCCEED();
SUCCEED();
}
}
} // namespace foo
} // namespace bar
```
```
## How do I build Google Testing Framework with Xcode 4? ##
## How do I build Google Testing Framework with Xcode 4? ##
* The implementation is in a single Python script and thus ultra portable: no build or installation is needed and it works cross platforms.
* The implementation is in a single Python script and thus ultra portable: no build or installation is needed and it works cross platforms.
* Pump tries to be smart with respect to [Google's style guide](http://code.google.com/p/google-styleguide/): it breaks long lines (easy to have when they are generated) at acceptable places to fit within 80 columns and indent the continuation lines correctly.
* Pump tries to be smart with respect to [Google's style guide](https://github.com/google/styleguide): it breaks long lines (easy to have when they are generated) at acceptable places to fit within 80 columns and indent the continuation lines correctly.
* The format is human-readable and more concise than XML.
* The format is human-readable and more concise than XML.
* The format works relatively well with Emacs' C++ mode.
* The format works relatively well with Emacs' C++ mode.