Google Cloud C++ Client  2.7.0
C++ Client Library for Google Cloud Platform
Functions
google::cloud::mocks Namespace Reference

Contains helpers for testing the Google Cloud C++ Client Libraries. More...

Functions

template<typename T >
StreamRange< T > MakeStreamRange (std::vector< T > values, Status final_status={})
 Construct a StreamRange<T> for use in tests. More...
 

Detailed Description

Contains helpers for testing the Google Cloud C++ Client Libraries.

The symbols defined in this namespace are offered for public consumption. They are not just for maintainers of the client library.

Function Documentation

◆ MakeStreamRange()

template<typename T >
StreamRange<T> google::cloud::mocks::MakeStreamRange ( std::vector< T >  values,
Status  final_status = {} 
)

Construct a StreamRange<T> for use in tests.

Parameters
valuesThe successfully returned T values.
final_statusThe final Status of the range. Defaults to an OK Status.
auto sr = MakeStreamRange<T>({t1, t2});
for (StatusOr<int> const& v : sr) {
// Yields t1 -> t2
}
sr = MakeStreamRange<T>({t1, t2}, BadStatus());
for (StatusOr<int> const& v : sr) {
// Yields t1 -> t2 -> BadStatus()
}

Definition at line 52 of file mock_stream_range.h.