| `ValuesIn(container)` or `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 as `std::tuple` *n*-tuples all combinations (Cartesian product) of the values generated by the given *n* generators `g1`, `g2`, ..., `gN`. |
+| `ConvertGenerator<T>(g)` | Yields values generated by generator `g`, `static_cast` to `T`. |
The optional last argument *`name_generator`* is a function or functor that
generates custom test name suffixes based on the test parameters. The function
```cpp
INSTANTIATE_TEST_SUITE_P(
MyInstantiation, MyTestSuite,
- ::testing::Values(...),
- [](const ::testing::TestParamInfo<MyTestSuite::ParamType>& info) {
+ testing::Values(...),
+ [](const testing::TestParamInfo<MyTestSuite::ParamType>& info) {
// Can use info.param here to generate the test suffix
std::string name = ...
return name;
```cpp
template <typename T>
-class MyFixture : public ::testing::Test {
+class MyFixture : public testing::Test {
public:
...
using List = std::list<T>;
```cpp
namespace my_namespace {
-class MyClassTest : public ::testing::Test {
+class MyClassTest : public testing::Test {
...
};
### AssertionResult {#AssertionResult}
-`::testing::AssertionResult`
+`testing::AssertionResult`
A class for indicating whether an assertion was successful.
### AssertionException {#AssertionException}
-`::testing::AssertionException`
+`testing::AssertionException`
Exception which can be thrown from
[`TestEventListener::OnTestPartResult`](#TestEventListener::OnTestPartResult).
### EmptyTestEventListener {#EmptyTestEventListener}
-`::testing::EmptyTestEventListener`
+`testing::EmptyTestEventListener`
Provides an empty implementation of all methods in the
[`TestEventListener`](#TestEventListener) interface, such that a subclass only
### Environment {#Environment}
-`::testing::Environment`
+`testing::Environment`
Represents a global test environment. See
[Global Set-Up and Tear-Down](../advanced.md#global-set-up-and-tear-down).
### ScopedTrace {#ScopedTrace}
-`::testing::ScopedTrace`
+`testing::ScopedTrace`
An instance of this class causes a trace to be included in every test failure
message generated by code in the scope of the lifetime of the `ScopedTrace`
Example usage:
```cpp
-::testing::ScopedTrace trace("file.cc", 123, "message");
+testing::ScopedTrace trace("file.cc", 123, "message");
```
The resulting trace includes the given source file path and line number, and the
### Test {#Test}
-`::testing::Test`
+`testing::Test`
The abstract class that all tests inherit from. `Test` is not copyable.
### TestWithParam {#TestWithParam}
-`::testing::TestWithParam<T>`
+`testing::TestWithParam<T>`
A convenience class which inherits from both [`Test`](#Test) and
[`WithParamInterface<T>`](#WithParamInterface).
### TestInfo {#TestInfo}
-`::testing::TestInfo`
+`testing::TestInfo`
Stores information about a test.
### TestParamInfo {#TestParamInfo}
-`::testing::TestParamInfo<T>`
+`testing::TestParamInfo<T>`
Describes a parameter to a value-parameterized test. The type `T` is the type of
the parameter.
### UnitTest {#UnitTest}
-`::testing::UnitTest`
+`testing::UnitTest`
This class contains information about the test program.
### TestEventListener {#TestEventListener}
-`::testing::TestEventListener`
+`testing::TestEventListener`
The interface for tracing execution of tests. The methods below are listed in
the order the corresponding events are fired.
### TestEventListeners {#TestEventListeners}
-`::testing::TestEventListeners`
+`testing::TestEventListeners`
Lets users add listeners to track events in GoogleTest.
### TestPartResult {#TestPartResult}
-`::testing::TestPartResult`
+`testing::TestPartResult`
A copyable object representing the result of a test part (i.e. an assertion or
an explicit `FAIL()`, `ADD_FAILURE()`, or `SUCCESS()`).
### TestProperty {#TestProperty}
-`::testing::TestProperty`
+`testing::TestProperty`
A copyable object representing a user-specified test property which can be
output as a key/value string pair.
### TestResult {#TestResult}
-`::testing::TestResult`
+`testing::TestResult`
Contains information about the result of a single test.
### TimeInMillis {#TimeInMillis}
-`::testing::TimeInMillis`
+`testing::TimeInMillis`
An integer type representing time in milliseconds.
### Types {#Types}
-`::testing::Types<T...>`
+`testing::Types<T...>`
Represents a list of types for use in typed tests and type-parameterized tests.
The template argument `T...` can be any number of types, for example:
```
-::testing::Types<char, int, unsigned int>
+testing::Types<char, int, unsigned int>
```
See [Typed Tests](../advanced.md#typed-tests) and
### WithParamInterface {#WithParamInterface}
-`::testing::WithParamInterface<T>`
+`testing::WithParamInterface<T>`
The pure interface class that all value-parameterized tests inherit from.
### InitGoogleTest {#InitGoogleTest}
-`void ::testing::InitGoogleTest(int* argc, char** argv)` \
-`void ::testing::InitGoogleTest(int* argc, wchar_t** argv)` \
-`void ::testing::InitGoogleTest()`
+`void testing::InitGoogleTest(int* argc, char** argv)` \
+`void testing::InitGoogleTest(int* argc, wchar_t** argv)` \
+`void testing::InitGoogleTest()`
Initializes GoogleTest. This must be called before calling
[`RUN_ALL_TESTS()`](#RUN_ALL_TESTS). In particular, it parses the command line
### AddGlobalTestEnvironment {#AddGlobalTestEnvironment}
-`Environment* ::testing::AddGlobalTestEnvironment(Environment* env)`
+`Environment* testing::AddGlobalTestEnvironment(Environment* env)`
Adds a test environment to the test program. Must be called before
[`RUN_ALL_TESTS()`](#RUN_ALL_TESTS) is called. See
```cpp
template <typename Factory>
-TestInfo* ::testing::RegisterTest(const char* test_suite_name, const char* test_name,
+TestInfo* testing::RegisterTest(const char* test_suite_name, const char* test_name,
const char* type_param, const char* value_param,
const char* file, int line, Factory factory)
```
### AssertionSuccess {#AssertionSuccess}
-`AssertionResult ::testing::AssertionSuccess()`
+`AssertionResult testing::AssertionSuccess()`
Creates a successful assertion result. See
[`AssertionResult`](#AssertionResult).
### AssertionFailure {#AssertionFailure}
-`AssertionResult ::testing::AssertionFailure()`
+`AssertionResult testing::AssertionFailure()`
Creates a failed assertion result. Use the `<<` operator to store a failure
message:
```cpp
-::testing::AssertionFailure() << "My failure message";
+testing::AssertionFailure() << "My failure message";
```
See [`AssertionResult`](#AssertionResult).
### StaticAssertTypeEq {#StaticAssertTypeEq}
-`::testing::StaticAssertTypeEq<T1, T2>()`
+`testing::StaticAssertTypeEq<T1, T2>()`
Compile-time assertion for type equality. Compiles if and only if `T1` and `T2`
are the same type. The value it returns is irrelevant.
### PrintToString {#PrintToString}
-`std::string ::testing::PrintToString(x)`
+`std::string testing::PrintToString(x)`
Prints any value `x` using GoogleTest's value printer.
### PrintToStringParamName {#PrintToStringParamName}
-`std::string ::testing::PrintToStringParamName(TestParamInfo<T>& info)`
+`std::string testing::PrintToStringParamName(TestParamInfo<T>& info)`
A built-in parameterized test name generator which returns the result of
[`PrintToString`](#PrintToString) called on `info.param`. Does not work when the