update google on windows

This commit is contained in:
Bassem Girgis
2019-08-13 22:25:01 -05:00
parent b40a3bee82
commit e3da37a623
140 changed files with 5198 additions and 2189 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -56,8 +56,7 @@ static void BM_memcpy(benchmark::State& state) {
memset(src, 'x', state.range(0)); memset(src, 'x', state.range(0));
for (auto _ : state) for (auto _ : state)
memcpy(dst, src, state.range(0)); memcpy(dst, src, state.range(0));
state.SetBytesProcessed(int64_t(state.iterations()) * state.SetBytesProcessed(state.iterations() * state.range(0));
int64_t(state.range(0)));
delete[] src; delete[] dst; delete[] src; delete[] dst;
} }
BENCHMARK(BM_memcpy)->Arg(8)->Arg(64)->Arg(512)->Arg(1<<10)->Arg(8<<10); BENCHMARK(BM_memcpy)->Arg(8)->Arg(64)->Arg(512)->Arg(1<<10)->Arg(8<<10);
@@ -72,29 +71,30 @@ BENCHMARK(BM_memcpy)->Range(8, 8<<10);
// example, the following code defines a family of microbenchmarks for // example, the following code defines a family of microbenchmarks for
// measuring the speed of set insertion. // measuring the speed of set insertion.
static void BM_SetInsert(benchmark::State& state) { static void BM_SetInsert(benchmark::State& state) {
set<int> data;
for (auto _ : state) { for (auto _ : state) {
state.PauseTiming(); state.PauseTiming();
set<int> data = ConstructRandomSet(state.range(0)); data = ConstructRandomSet(state.range(0));
state.ResumeTiming(); state.ResumeTiming();
for (int j = 0; j < state.range(1); ++j) for (int j = 0; j < state.range(1); ++j)
data.insert(RandomNumber()); data.insert(RandomNumber());
} }
} }
BENCHMARK(BM_SetInsert) BENCHMARK(BM_SetInsert)
->Args({1<<10, 1}) ->Args({1<<10, 128})
->Args({1<<10, 8}) ->Args({2<<10, 128})
->Args({1<<10, 64}) ->Args({4<<10, 128})
->Args({8<<10, 128})
->Args({1<<10, 512}) ->Args({1<<10, 512})
->Args({8<<10, 1}) ->Args({2<<10, 512})
->Args({8<<10, 8}) ->Args({4<<10, 512})
->Args({8<<10, 64})
->Args({8<<10, 512}); ->Args({8<<10, 512});
// The preceding code is quite repetitive, and can be replaced with // The preceding code is quite repetitive, and can be replaced with
// the following short-hand. The following macro will pick a few // the following short-hand. The following macro will pick a few
// appropriate arguments in the product of the two specified ranges // appropriate arguments in the product of the two specified ranges
// and will generate a microbenchmark for each such pair. // and will generate a microbenchmark for each such pair.
BENCHMARK(BM_SetInsert)->Ranges({{1<<10, 8<<10}, {1, 512}}); BENCHMARK(BM_SetInsert)->Ranges({{1<<10, 8<<10}, {128, 512}});
// For more complex patterns of inputs, passing a custom function // For more complex patterns of inputs, passing a custom function
// to Apply allows programmatic specification of an // to Apply allows programmatic specification of an
@@ -121,8 +121,7 @@ template <class Q> int BM_Sequential(benchmark::State& state) {
q.Wait(&v); q.Wait(&v);
} }
// actually messages, not bytes: // actually messages, not bytes:
state.SetBytesProcessed( state.SetBytesProcessed(state.iterations() * state.range(0));
static_cast<int64_t>(state.iterations())*state.range(0));
} }
BENCHMARK_TEMPLATE(BM_Sequential, WaitQueue<int>)->Range(1<<0, 1<<10); BENCHMARK_TEMPLATE(BM_Sequential, WaitQueue<int>)->Range(1<<0, 1<<10);
@@ -163,7 +162,6 @@ BENCHMARK(BM_test)->Unit(benchmark::kMillisecond);
#ifndef BENCHMARK_BENCHMARK_H_ #ifndef BENCHMARK_BENCHMARK_H_
#define BENCHMARK_BENCHMARK_H_ #define BENCHMARK_BENCHMARK_H_
// The _MSVC_LANG check should detect Visual Studio 2015 Update 3 and newer. // The _MSVC_LANG check should detect Visual Studio 2015 Update 3 and newer.
#if __cplusplus >= 201103L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) #if __cplusplus >= 201103L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L)
#define BENCHMARK_HAS_CXX11 #define BENCHMARK_HAS_CXX11
@@ -171,17 +169,18 @@ BENCHMARK(BM_test)->Unit(benchmark::kMillisecond);
#include <stdint.h> #include <stdint.h>
#include <algorithm>
#include <cassert> #include <cassert>
#include <cstddef> #include <cstddef>
#include <iosfwd> #include <iosfwd>
#include <string>
#include <vector>
#include <map> #include <map>
#include <set> #include <set>
#include <string>
#include <vector>
#if defined(BENCHMARK_HAS_CXX11) #if defined(BENCHMARK_HAS_CXX11)
#include <type_traits>
#include <initializer_list> #include <initializer_list>
#include <type_traits>
#include <utility> #include <utility>
#endif #endif
@@ -225,21 +224,36 @@ BENCHMARK(BM_test)->Unit(benchmark::kMillisecond);
#define BENCHMARK_INTERNAL_TOSTRING2(x) #x #define BENCHMARK_INTERNAL_TOSTRING2(x) #x
#define BENCHMARK_INTERNAL_TOSTRING(x) BENCHMARK_INTERNAL_TOSTRING2(x) #define BENCHMARK_INTERNAL_TOSTRING(x) BENCHMARK_INTERNAL_TOSTRING2(x)
#if defined(__GNUC__) #if defined(__GNUC__) || defined(__clang__)
#define BENCHMARK_BUILTIN_EXPECT(x, y) __builtin_expect(x, y) #define BENCHMARK_BUILTIN_EXPECT(x, y) __builtin_expect(x, y)
#define BENCHMARK_DEPRECATED_MSG(msg) __attribute__((deprecated(msg))) #define BENCHMARK_DEPRECATED_MSG(msg) __attribute__((deprecated(msg)))
#else #else
#define BENCHMARK_BUILTIN_EXPECT(x, y) x #define BENCHMARK_BUILTIN_EXPECT(x, y) x
#define BENCHMARK_DEPRECATED_MSG(msg) #define BENCHMARK_DEPRECATED_MSG(msg)
#define BENCHMARK_WARNING_MSG(msg) __pragma(message(__FILE__ "(" BENCHMARK_INTERNAL_TOSTRING(__LINE__) ") : warning note: " msg)) #define BENCHMARK_WARNING_MSG(msg) \
__pragma(message(__FILE__ "(" BENCHMARK_INTERNAL_TOSTRING( \
__LINE__) ") : warning note: " msg))
#endif #endif
#if defined(__GNUC__) && !defined(__clang__) #if defined(__GNUC__) && !defined(__clang__)
#define BENCHMARK_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) #define BENCHMARK_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
#endif #endif
#ifndef __has_builtin
#define __has_builtin(x) 0
#endif
#if defined(__GNUC__) || __has_builtin(__builtin_unreachable)
#define BENCHMARK_UNREACHABLE() __builtin_unreachable()
#elif defined(_MSC_VER)
#define BENCHMARK_UNREACHABLE() __assume(false)
#else
#define BENCHMARK_UNREACHABLE() ((void)0)
#endif
namespace benchmark { namespace benchmark {
class BenchmarkReporter; class BenchmarkReporter;
class MemoryManager;
void Initialize(int* argc, char** argv); void Initialize(int* argc, char** argv);
@@ -252,7 +266,7 @@ bool ReportUnrecognizedArguments(int argc, char** argv);
// of each matching benchmark. Otherwise run each matching benchmark and // of each matching benchmark. Otherwise run each matching benchmark and
// report the results. // report the results.
// //
// The second and third overload use the specified 'console_reporter' and // The second and third overload use the specified 'display_reporter' and
// 'file_reporter' respectively. 'file_reporter' will write to the file // 'file_reporter' respectively. 'file_reporter' will write to the file
// specified // specified
// by '--benchmark_output'. If '--benchmark_output' is not given the // by '--benchmark_output'. If '--benchmark_output' is not given the
@@ -260,16 +274,13 @@ bool ReportUnrecognizedArguments(int argc, char** argv);
// //
// RETURNS: The number of matching benchmarks. // RETURNS: The number of matching benchmarks.
size_t RunSpecifiedBenchmarks(); size_t RunSpecifiedBenchmarks();
size_t RunSpecifiedBenchmarks(BenchmarkReporter* console_reporter); size_t RunSpecifiedBenchmarks(BenchmarkReporter* display_reporter);
size_t RunSpecifiedBenchmarks(BenchmarkReporter* console_reporter, size_t RunSpecifiedBenchmarks(BenchmarkReporter* display_reporter,
BenchmarkReporter* file_reporter); BenchmarkReporter* file_reporter);
// If this routine is called, peak memory allocation past this point in the // Register a MemoryManager instance that will be used to collect and report
// benchmark is reported at the end of the benchmark report line. (It is // allocation measurements for benchmark runs.
// computed by running the benchmark once with a single iteration and a memory void RegisterMemoryManager(MemoryManager* memory_manager);
// tracer.)
// TODO(dominic)
// void MemoryUsage();
namespace internal { namespace internal {
class Benchmark; class Benchmark;
@@ -288,13 +299,11 @@ BENCHMARK_UNUSED static int stream_init_anchor = InitializeStreams();
} // namespace internal } // namespace internal
#if (!defined(__GNUC__) && !defined(__clang__)) || defined(__pnacl__) || \ #if (!defined(__GNUC__) && !defined(__clang__)) || defined(__pnacl__) || \
defined(EMSCRIPTN) defined(__EMSCRIPTEN__)
# define BENCHMARK_HAS_NO_INLINE_ASSEMBLY #define BENCHMARK_HAS_NO_INLINE_ASSEMBLY
#endif #endif
// The DoNotOptimize(...) function can be used to prevent a value or // The DoNotOptimize(...) function can be used to prevent a value or
// expression from being optimized away by the compiler. This function is // expression from being optimized away by the compiler. This function is
// intended to add little to no overhead. // intended to add little to no overhead.
@@ -302,14 +311,18 @@ BENCHMARK_UNUSED static int stream_init_anchor = InitializeStreams();
#ifndef BENCHMARK_HAS_NO_INLINE_ASSEMBLY #ifndef BENCHMARK_HAS_NO_INLINE_ASSEMBLY
template <class Tp> template <class Tp>
inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp const& value) { inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp const& value) {
// Clang doesn't like the 'X' constraint on `value` and certain GCC versions asm volatile("" : : "r,m"(value) : "memory");
// don't like the 'g' constraint. Attempt to placate them both. }
template <class Tp>
inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp& value) {
#if defined(__clang__) #if defined(__clang__)
asm volatile("" : : "g"(value) : "memory"); asm volatile("" : "+r,m"(value) : : "memory");
#else #else
asm volatile("" : : "i,r,m"(value) : "memory"); asm volatile("" : "+m,r"(value) : : "memory");
#endif #endif
} }
// Force the compiler to flush pending writes to global memory. Acts as an // Force the compiler to flush pending writes to global memory. Acts as an
// effective read/write barrier // effective read/write barrier
inline BENCHMARK_ALWAYS_INLINE void ClobberMemory() { inline BENCHMARK_ALWAYS_INLINE void ClobberMemory() {
@@ -322,9 +335,7 @@ inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp const& value) {
_ReadWriteBarrier(); _ReadWriteBarrier();
} }
inline BENCHMARK_ALWAYS_INLINE void ClobberMemory() { inline BENCHMARK_ALWAYS_INLINE void ClobberMemory() { _ReadWriteBarrier(); }
_ReadWriteBarrier();
}
#else #else
template <class Tp> template <class Tp>
inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp const& value) { inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp const& value) {
@@ -333,39 +344,63 @@ inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp const& value) {
// FIXME Add ClobberMemory() for non-gnu and non-msvc compilers // FIXME Add ClobberMemory() for non-gnu and non-msvc compilers
#endif #endif
// This class is used for user-defined counters. // This class is used for user-defined counters.
class Counter { class Counter {
public: public:
enum Flags { enum Flags {
kDefaults = 0, kDefaults = 0,
// Mark the counter as a rate. It will be presented divided // Mark the counter as a rate. It will be presented divided
// by the duration of the benchmark. // by the duration of the benchmark.
kIsRate = 1, kIsRate = 1U << 0U,
// Mark the counter as a thread-average quantity. It will be // Mark the counter as a thread-average quantity. It will be
// presented divided by the number of threads. // presented divided by the number of threads.
kAvgThreads = 2, kAvgThreads = 1U << 1U,
// Mark the counter as a thread-average rate. See above. // Mark the counter as a thread-average rate. See above.
kAvgThreadsRate = kIsRate|kAvgThreads kAvgThreadsRate = kIsRate | kAvgThreads,
// Mark the counter as a constant value, valid/same for *every* iteration.
// When reporting, it will be *multiplied* by the iteration count.
kIsIterationInvariant = 1U << 2U,
// Mark the counter as a constant rate.
// When reporting, it will be *multiplied* by the iteration count
// and then divided by the duration of the benchmark.
kIsIterationInvariantRate = kIsRate | kIsIterationInvariant,
// Mark the counter as a iteration-average quantity.
// It will be presented divided by the number of iterations.
kAvgIterations = 1U << 3U,
// Mark the counter as a iteration-average rate. See above.
kAvgIterationsRate = kIsRate | kAvgIterations
};
enum OneK {
// 1'000 items per 1k
kIs1000 = 1000,
// 1'024 items per 1k
kIs1024 = 1024
}; };
double value; double value;
Flags flags; Flags flags;
OneK oneK;
BENCHMARK_ALWAYS_INLINE BENCHMARK_ALWAYS_INLINE
Counter(double v = 0., Flags f = kDefaults) : value(v), flags(f) {} Counter(double v = 0., Flags f = kDefaults, OneK k = kIs1000)
: value(v), flags(f), oneK(k) {}
BENCHMARK_ALWAYS_INLINE operator double const& () const { return value; }
BENCHMARK_ALWAYS_INLINE operator double & () { return value; }
BENCHMARK_ALWAYS_INLINE operator double const&() const { return value; }
BENCHMARK_ALWAYS_INLINE operator double&() { return value; }
}; };
// A helper for user code to create unforeseen combinations of Flags, without
// having to do this cast manually each time, or providing this operator.
Counter::Flags inline operator|(const Counter::Flags& LHS,
const Counter::Flags& RHS) {
return static_cast<Counter::Flags>(static_cast<int>(LHS) |
static_cast<int>(RHS));
}
// This is the container for the user-defined counters. // This is the container for the user-defined counters.
typedef std::map<std::string, Counter> UserCounters; typedef std::map<std::string, Counter> UserCounters;
// TimeUnit is passed to a benchmark in order to specify the order of magnitude // TimeUnit is passed to a benchmark in order to specify the order of magnitude
// for the measured time. // for the measured time.
enum TimeUnit { kNanosecond, kMicrosecond, kMillisecond }; enum TimeUnit { kNanosecond, kMicrosecond, kMillisecond };
@@ -376,36 +411,49 @@ enum TimeUnit { kNanosecond, kMicrosecond, kMillisecond };
// calculated automatically to the best fit. // calculated automatically to the best fit.
enum BigO { oNone, o1, oN, oNSquared, oNCubed, oLogN, oNLogN, oAuto, oLambda }; enum BigO { oNone, o1, oN, oNSquared, oNCubed, oLogN, oNLogN, oAuto, oLambda };
typedef uint64_t IterationCount;
// BigOFunc is passed to a benchmark in order to specify the asymptotic // BigOFunc is passed to a benchmark in order to specify the asymptotic
// computational complexity for the benchmark. // computational complexity for the benchmark.
typedef double(BigOFunc)(int); typedef double(BigOFunc)(IterationCount);
// StatisticsFunc is passed to a benchmark in order to compute some descriptive // StatisticsFunc is passed to a benchmark in order to compute some descriptive
// statistics over all the measurements of some type // statistics over all the measurements of some type
typedef double(StatisticsFunc)(const std::vector<double>&); typedef double(StatisticsFunc)(const std::vector<double>&);
namespace internal {
struct Statistics { struct Statistics {
std::string name_; std::string name_;
StatisticsFunc* compute_; StatisticsFunc* compute_;
Statistics(std::string name, StatisticsFunc* compute) Statistics(const std::string& name, StatisticsFunc* compute)
: name_(name), compute_(compute) {} : name_(name), compute_(compute) {}
}; };
namespace internal { struct BenchmarkInstance;
class ThreadTimer; class ThreadTimer;
class ThreadManager; class ThreadManager;
enum ReportMode enum AggregationReportMode
#if defined(BENCHMARK_HAS_CXX11) #if defined(BENCHMARK_HAS_CXX11)
: unsigned : unsigned
#else #else
#endif #endif
{ {
RM_Unspecified, // The mode has not been manually specified // The mode has not been manually specified
RM_Default, // The mode is user-specified as default. ARM_Unspecified = 0,
RM_ReportAggregatesOnly // The mode is user-specified.
// This may or may not be set when the following bit-flags are set.
ARM_Default = 1U << 0U,
// File reporter should only output aggregates.
ARM_FileReportAggregatesOnly = 1U << 1U,
// Display reporter should only output aggregates
ARM_DisplayReportAggregatesOnly = 1U << 2U,
// Both reporters should only display aggregates.
ARM_ReportAggregatesOnly =
ARM_FileReportAggregatesOnly | ARM_DisplayReportAggregatesOnly
}; };
} // namespace internal } // namespace internal
// State is passed to a running Benchmark and contains state for the // State is passed to a running Benchmark and contains state for the
@@ -428,16 +476,19 @@ class State {
// Returns true if the benchmark should continue through another iteration. // Returns true if the benchmark should continue through another iteration.
// NOTE: A benchmark may not return from the test until KeepRunning() has // NOTE: A benchmark may not return from the test until KeepRunning() has
// returned false. // returned false.
bool KeepRunning() { bool KeepRunning();
if (BENCHMARK_BUILTIN_EXPECT(!started_, false)) {
StartKeepRunning(); // Returns true iff the benchmark should run n more iterations.
} // REQUIRES: 'n' > 0.
bool const res = --total_iterations_; // NOTE: A benchmark must not return from the test until KeepRunningBatch()
if (BENCHMARK_BUILTIN_EXPECT(!res, false)) { // has returned false.
FinishKeepRunning(); // NOTE: KeepRunningBatch() may overshoot by up to 'n' iterations.
} //
return res; // Intended usage:
} // while (state.KeepRunningBatch(1000)) {
// // process 1000 elements
// }
bool KeepRunningBatch(IterationCount n);
// REQUIRES: timer is running and 'SkipWithError(...)' has not been called // REQUIRES: timer is running and 'SkipWithError(...)' has not been called
// by the current thread. // by the current thread.
@@ -498,16 +549,21 @@ class State {
// Set the number of bytes processed by the current benchmark // Set the number of bytes processed by the current benchmark
// execution. This routine is typically called once at the end of a // execution. This routine is typically called once at the end of a
// throughput oriented benchmark. If this routine is called with a // throughput oriented benchmark.
// value > 0, the report is printed in MB/sec instead of nanoseconds
// per iteration.
// //
// REQUIRES: a benchmark has exited its benchmarking loop. // REQUIRES: a benchmark has exited its benchmarking loop.
BENCHMARK_ALWAYS_INLINE BENCHMARK_ALWAYS_INLINE
void SetBytesProcessed(size_t bytes) { bytes_processed_ = bytes; } void SetBytesProcessed(int64_t bytes) {
counters["bytes_per_second"] =
Counter(static_cast<double>(bytes), Counter::kIsRate, Counter::kIs1024);
}
BENCHMARK_ALWAYS_INLINE BENCHMARK_ALWAYS_INLINE
size_t bytes_processed() const { return bytes_processed_; } int64_t bytes_processed() const {
if (counters.find("bytes_per_second") != counters.end())
return static_cast<int64_t>(counters.at("bytes_per_second"));
return 0;
}
// If this routine is called with complexity_n > 0 and complexity report is // If this routine is called with complexity_n > 0 and complexity report is
// requested for the // requested for the
@@ -515,10 +571,10 @@ class State {
// and complexity_n will // and complexity_n will
// represent the length of N. // represent the length of N.
BENCHMARK_ALWAYS_INLINE BENCHMARK_ALWAYS_INLINE
void SetComplexityN(int complexity_n) { complexity_n_ = complexity_n; } void SetComplexityN(int64_t complexity_n) { complexity_n_ = complexity_n; }
BENCHMARK_ALWAYS_INLINE BENCHMARK_ALWAYS_INLINE
int complexity_length_n() { return complexity_n_; } int64_t complexity_length_n() { return complexity_n_; }
// If this routine is called with items > 0, then an items/s // If this routine is called with items > 0, then an items/s
// label is printed on the benchmark report line for the currently // label is printed on the benchmark report line for the currently
@@ -527,10 +583,17 @@ class State {
// //
// REQUIRES: a benchmark has exited its benchmarking loop. // REQUIRES: a benchmark has exited its benchmarking loop.
BENCHMARK_ALWAYS_INLINE BENCHMARK_ALWAYS_INLINE
void SetItemsProcessed(size_t items) { items_processed_ = items; } void SetItemsProcessed(int64_t items) {
counters["items_per_second"] =
Counter(static_cast<double>(items), benchmark::Counter::kIsRate);
}
BENCHMARK_ALWAYS_INLINE BENCHMARK_ALWAYS_INLINE
size_t items_processed() const { return items_processed_; } int64_t items_processed() const {
if (counters.find("items_per_second") != counters.end())
return static_cast<int64_t>(counters.at("items_per_second"));
return 0;
}
// If this routine is called, the specified label is printed at the // If this routine is called, the specified label is printed at the
// end of the benchmark report line for the currently executing // end of the benchmark report line for the currently executing
@@ -538,7 +601,7 @@ class State {
// static void BM_Compress(benchmark::State& state) { // static void BM_Compress(benchmark::State& state) {
// ... // ...
// double compress = input_size / output_size; // double compress = input_size / output_size;
// state.SetLabel(StringPrintf("compress:%.1f%%", 100.0*compression)); // state.SetLabel(StrFormat("compress:%.1f%%", 100.0*compression));
// } // }
// Produces output that looks like: // Produces output that looks like:
// BM_Compress 50 50 14115038 compress:27.3% // BM_Compress 50 50 14115038 compress:27.3%
@@ -552,34 +615,49 @@ class State {
// Range arguments for this run. CHECKs if the argument has been set. // Range arguments for this run. CHECKs if the argument has been set.
BENCHMARK_ALWAYS_INLINE BENCHMARK_ALWAYS_INLINE
int range(std::size_t pos = 0) const { int64_t range(std::size_t pos = 0) const {
assert(range_.size() > pos); assert(range_.size() > pos);
return range_[pos]; return range_[pos];
} }
BENCHMARK_DEPRECATED_MSG("use 'range(0)' instead") BENCHMARK_DEPRECATED_MSG("use 'range(0)' instead")
int range_x() const { return range(0); } int64_t range_x() const { return range(0); }
BENCHMARK_DEPRECATED_MSG("use 'range(1)' instead") BENCHMARK_DEPRECATED_MSG("use 'range(1)' instead")
int range_y() const { return range(1); } int64_t range_y() const { return range(1); }
BENCHMARK_ALWAYS_INLINE BENCHMARK_ALWAYS_INLINE
size_t iterations() const { return (max_iterations - total_iterations_) + 1; } IterationCount iterations() const {
if (BENCHMARK_BUILTIN_EXPECT(!started_, false)) {
return 0;
}
return max_iterations - total_iterations_ + batch_leftover_;
}
private
: // items we expect on the first cache line (ie 64 bytes of the struct)
// When total_iterations_ is 0, KeepRunning() and friends will return false.
// May be larger than max_iterations.
IterationCount total_iterations_;
// When using KeepRunningBatch(), batch_leftover_ holds the number of
// iterations beyond max_iters that were run. Used to track
// completed_iterations_ accurately.
IterationCount batch_leftover_;
public:
const IterationCount max_iterations;
private: private:
bool started_; bool started_;
bool finished_; bool finished_;
size_t total_iterations_;
std::vector<int> range_;
size_t bytes_processed_;
size_t items_processed_;
int complexity_n_;
bool error_occurred_; bool error_occurred_;
private: // items we don't need on the first cache line
std::vector<int64_t> range_;
int64_t complexity_n_;
public: public:
// Container for user-defined counters. // Container for user-defined counters.
UserCounters counters; UserCounters counters;
@@ -587,27 +665,66 @@ class State {
const int thread_index; const int thread_index;
// Number of threads concurrently executing the benchmark. // Number of threads concurrently executing the benchmark.
const int threads; const int threads;
const size_t max_iterations;
// TODO(EricWF) make me private
State(size_t max_iters, const std::vector<int>& ranges, int thread_i,
int n_threads, internal::ThreadTimer* timer,
internal::ThreadManager* manager);
private: private:
State(IterationCount max_iters, const std::vector<int64_t>& ranges,
int thread_i, int n_threads, internal::ThreadTimer* timer,
internal::ThreadManager* manager);
void StartKeepRunning(); void StartKeepRunning();
// Implementation of KeepRunning() and KeepRunningBatch().
// is_batch must be true unless n is 1.
bool KeepRunningInternal(IterationCount n, bool is_batch);
void FinishKeepRunning(); void FinishKeepRunning();
internal::ThreadTimer* timer_; internal::ThreadTimer* timer_;
internal::ThreadManager* manager_; internal::ThreadManager* manager_;
BENCHMARK_DISALLOW_COPY_AND_ASSIGN(State);
friend struct internal::BenchmarkInstance;
}; };
inline BENCHMARK_ALWAYS_INLINE bool State::KeepRunning() {
return KeepRunningInternal(1, /*is_batch=*/false);
}
inline BENCHMARK_ALWAYS_INLINE bool State::KeepRunningBatch(IterationCount n) {
return KeepRunningInternal(n, /*is_batch=*/true);
}
inline BENCHMARK_ALWAYS_INLINE bool State::KeepRunningInternal(IterationCount n,
bool is_batch) {
// total_iterations_ is set to 0 by the constructor, and always set to a
// nonzero value by StartKepRunning().
assert(n > 0);
// n must be 1 unless is_batch is true.
assert(is_batch || n == 1);
if (BENCHMARK_BUILTIN_EXPECT(total_iterations_ >= n, true)) {
total_iterations_ -= n;
return true;
}
if (!started_) {
StartKeepRunning();
if (!error_occurred_ && total_iterations_ >= n) {
total_iterations_ -= n;
return true;
}
}
// For non-batch runs, total_iterations_ must be 0 by now.
if (is_batch && total_iterations_ != 0) {
batch_leftover_ = n - total_iterations_;
total_iterations_ = 0;
return true;
}
FinishKeepRunning();
return false;
}
struct State::StateIterator { struct State::StateIterator {
struct BENCHMARK_UNUSED Value {}; struct BENCHMARK_UNUSED Value {};
typedef std::forward_iterator_tag iterator_category; typedef std::forward_iterator_tag iterator_category;
typedef Value value_type; typedef Value value_type;
typedef Value reference; typedef Value reference;
typedef Value pointer; typedef Value pointer;
typedef std::ptrdiff_t difference_type;
private: private:
friend class State; friend class State;
@@ -637,14 +754,14 @@ struct State::StateIterator {
} }
private: private:
size_t cached_; IterationCount cached_;
State* const parent_; State* const parent_;
}; };
BENCHMARK_ALWAYS_INLINE inline State::StateIterator State::begin() { inline BENCHMARK_ALWAYS_INLINE State::StateIterator State::begin() {
return StateIterator(this); return StateIterator(this);
} }
BENCHMARK_ALWAYS_INLINE inline State::StateIterator State::end() { inline BENCHMARK_ALWAYS_INLINE State::StateIterator State::end() {
StartKeepRunning(); StartKeepRunning();
return StateIterator(); return StateIterator();
} }
@@ -669,7 +786,7 @@ class Benchmark {
// Run this benchmark once with "x" as the extra argument passed // Run this benchmark once with "x" as the extra argument passed
// to the function. // to the function.
// REQUIRES: The function passed to the constructor must accept an arg1. // REQUIRES: The function passed to the constructor must accept an arg1.
Benchmark* Arg(int x); Benchmark* Arg(int64_t x);
// Run this benchmark with the given time unit for the generated output report // Run this benchmark with the given time unit for the generated output report
Benchmark* Unit(TimeUnit unit); Benchmark* Unit(TimeUnit unit);
@@ -677,23 +794,23 @@ class Benchmark {
// Run this benchmark once for a number of values picked from the // Run this benchmark once for a number of values picked from the
// range [start..limit]. (start and limit are always picked.) // range [start..limit]. (start and limit are always picked.)
// REQUIRES: The function passed to the constructor must accept an arg1. // REQUIRES: The function passed to the constructor must accept an arg1.
Benchmark* Range(int start, int limit); Benchmark* Range(int64_t start, int64_t limit);
// Run this benchmark once for all values in the range [start..limit] with // Run this benchmark once for all values in the range [start..limit] with
// specific step // specific step
// REQUIRES: The function passed to the constructor must accept an arg1. // REQUIRES: The function passed to the constructor must accept an arg1.
Benchmark* DenseRange(int start, int limit, int step = 1); Benchmark* DenseRange(int64_t start, int64_t limit, int step = 1);
// Run this benchmark once with "args" as the extra arguments passed // Run this benchmark once with "args" as the extra arguments passed
// to the function. // to the function.
// REQUIRES: The function passed to the constructor must accept arg1, arg2 ... // REQUIRES: The function passed to the constructor must accept arg1, arg2 ...
Benchmark* Args(const std::vector<int>& args); Benchmark* Args(const std::vector<int64_t>& args);
// Equivalent to Args({x, y}) // Equivalent to Args({x, y})
// NOTE: This is a legacy C++03 interface provided for compatibility only. // NOTE: This is a legacy C++03 interface provided for compatibility only.
// New code should use 'Args'. // New code should use 'Args'.
Benchmark* ArgPair(int x, int y) { Benchmark* ArgPair(int64_t x, int64_t y) {
std::vector<int> args; std::vector<int64_t> args;
args.push_back(x); args.push_back(x);
args.push_back(y); args.push_back(y);
return Args(args); return Args(args);
@@ -702,7 +819,7 @@ class Benchmark {
// Run this benchmark once for a number of values picked from the // Run this benchmark once for a number of values picked from the
// ranges [start..limit]. (starts and limits are always picked.) // ranges [start..limit]. (starts and limits are always picked.)
// REQUIRES: The function passed to the constructor must accept arg1, arg2 ... // REQUIRES: The function passed to the constructor must accept arg1, arg2 ...
Benchmark* Ranges(const std::vector<std::pair<int, int> >& ranges); Benchmark* Ranges(const std::vector<std::pair<int64_t, int64_t> >& ranges);
// Equivalent to ArgNames({name}) // Equivalent to ArgNames({name})
Benchmark* ArgName(const std::string& name); Benchmark* ArgName(const std::string& name);
@@ -714,8 +831,8 @@ class Benchmark {
// Equivalent to Ranges({{lo1, hi1}, {lo2, hi2}}). // Equivalent to Ranges({{lo1, hi1}, {lo2, hi2}}).
// NOTE: This is a legacy C++03 interface provided for compatibility only. // NOTE: This is a legacy C++03 interface provided for compatibility only.
// New code should use 'Ranges'. // New code should use 'Ranges'.
Benchmark* RangePair(int lo1, int hi1, int lo2, int hi2) { Benchmark* RangePair(int64_t lo1, int64_t hi1, int64_t lo2, int64_t hi2) {
std::vector<std::pair<int, int> > ranges; std::vector<std::pair<int64_t, int64_t> > ranges;
ranges.push_back(std::make_pair(lo1, hi1)); ranges.push_back(std::make_pair(lo1, hi1));
ranges.push_back(std::make_pair(lo2, hi2)); ranges.push_back(std::make_pair(lo2, hi2));
return Ranges(ranges); return Ranges(ranges);
@@ -741,7 +858,7 @@ class Benchmark {
// NOTE: This function should only be used when *exact* iteration control is // NOTE: This function should only be used when *exact* iteration control is
// needed and never to control or limit how long a benchmark runs, where // needed and never to control or limit how long a benchmark runs, where
// `--benchmark_min_time=N` or `MinTime(...)` should be used instead. // `--benchmark_min_time=N` or `MinTime(...)` should be used instead.
Benchmark* Iterations(size_t n); Benchmark* Iterations(IterationCount n);
// Specify the amount of times to repeat this benchmark. This option overrides // Specify the amount of times to repeat this benchmark. This option overrides
// the `benchmark_repetitions` flag. // the `benchmark_repetitions` flag.
@@ -751,13 +868,24 @@ class Benchmark {
// Specify if each repetition of the benchmark should be reported separately // Specify if each repetition of the benchmark should be reported separately
// or if only the final statistics should be reported. If the benchmark // or if only the final statistics should be reported. If the benchmark
// is not repeated then the single result is always reported. // is not repeated then the single result is always reported.
// Applies to *ALL* reporters (display and file).
Benchmark* ReportAggregatesOnly(bool value = true); Benchmark* ReportAggregatesOnly(bool value = true);
// If a particular benchmark is I/O bound, runs multiple threads internally or // Same as ReportAggregatesOnly(), but applies to display reporter only.
// if for some reason CPU timings are not representative, call this method. If Benchmark* DisplayAggregatesOnly(bool value = true);
// called, the elapsed time will be used to control how many iterations are
// run, and in the printing of items/second or MB/seconds values. If not // By default, the CPU time is measured only for the main thread, which may
// called, the cpu time used by the benchmark will be used. // be unrepresentative if the benchmark uses threads internally. If called,
// the total CPU time spent by all the threads will be measured instead.
// By default, the only the main thread CPU time will be measured.
Benchmark* MeasureProcessCPUTime();
// If a particular benchmark should use the Wall clock instead of the CPU time
// (be it either the CPU time of the main thread only (default), or the
// total CPU usage of the benchmark), call this method. If called, the elapsed
// (wall) time will be used to control how many iterations are run, and in the
// printing of items/second or MB/seconds values.
// If not called, the CPU time used by the benchmark will be used.
Benchmark* UseRealTime(); Benchmark* UseRealTime();
// If a benchmark must measure time manually (e.g. if GPU execution time is // If a benchmark must measure time manually (e.g. if GPU execution time is
@@ -812,9 +940,6 @@ class Benchmark {
virtual void Run(State& state) = 0; virtual void Run(State& state) = 0;
// Used inside the benchmark implementation
struct Instance;
protected: protected:
explicit Benchmark(const char* name); explicit Benchmark(const char* name);
Benchmark(Benchmark const&); Benchmark(Benchmark const&);
@@ -822,20 +947,19 @@ class Benchmark {
int ArgsCnt() const; int ArgsCnt() const;
static void AddRange(std::vector<int>* dst, int lo, int hi, int mult);
private: private:
friend class BenchmarkFamilies; friend class BenchmarkFamilies;
std::string name_; std::string name_;
ReportMode report_mode_; AggregationReportMode aggregation_report_mode_;
std::vector<std::string> arg_names_; // Args for all benchmark runs std::vector<std::string> arg_names_; // Args for all benchmark runs
std::vector<std::vector<int> > args_; // Args for all benchmark runs std::vector<std::vector<int64_t> > args_; // Args for all benchmark runs
TimeUnit time_unit_; TimeUnit time_unit_;
int range_multiplier_; int range_multiplier_;
double min_time_; double min_time_;
size_t iterations_; IterationCount iterations_;
int repetitions_; int repetitions_;
bool measure_process_cpu_time_;
bool use_real_time_; bool use_real_time_;
bool use_manual_time_; bool use_manual_time_;
BigO complexity_; BigO complexity_;
@@ -1054,7 +1178,7 @@ class Fixture : public internal::Benchmark {
class BaseClass##_##Method##_Benchmark : public BaseClass<a> { \ class BaseClass##_##Method##_Benchmark : public BaseClass<a> { \
public: \ public: \
BaseClass##_##Method##_Benchmark() : BaseClass<a>() { \ BaseClass##_##Method##_Benchmark() : BaseClass<a>() { \
this->SetName(#BaseClass"<" #a ">/" #Method); \ this->SetName(#BaseClass "<" #a ">/" #Method); \
} \ } \
\ \
protected: \ protected: \
@@ -1065,7 +1189,7 @@ class Fixture : public internal::Benchmark {
class BaseClass##_##Method##_Benchmark : public BaseClass<a, b> { \ class BaseClass##_##Method##_Benchmark : public BaseClass<a, b> { \
public: \ public: \
BaseClass##_##Method##_Benchmark() : BaseClass<a, b>() { \ BaseClass##_##Method##_Benchmark() : BaseClass<a, b>() { \
this->SetName(#BaseClass"<" #a "," #b ">/" #Method); \ this->SetName(#BaseClass "<" #a "," #b ">/" #Method); \
} \ } \
\ \
protected: \ protected: \
@@ -1077,14 +1201,15 @@ class Fixture : public internal::Benchmark {
class BaseClass##_##Method##_Benchmark : public BaseClass<__VA_ARGS__> { \ class BaseClass##_##Method##_Benchmark : public BaseClass<__VA_ARGS__> { \
public: \ public: \
BaseClass##_##Method##_Benchmark() : BaseClass<__VA_ARGS__>() { \ BaseClass##_##Method##_Benchmark() : BaseClass<__VA_ARGS__>() { \
this->SetName(#BaseClass"<" #__VA_ARGS__ ">/" #Method); \ this->SetName(#BaseClass "<" #__VA_ARGS__ ">/" #Method); \
} \ } \
\ \
protected: \ protected: \
virtual void BenchmarkCase(::benchmark::State&); \ virtual void BenchmarkCase(::benchmark::State&); \
}; };
#else #else
#define BENCHMARK_TEMPLATE_PRIVATE_DECLARE_F(n, a) BENCHMARK_TEMPLATE1_PRIVATE_DECLARE_F(n, a) #define BENCHMARK_TEMPLATE_PRIVATE_DECLARE_F(n, a) \
BENCHMARK_TEMPLATE1_PRIVATE_DECLARE_F(n, a)
#endif #endif
#define BENCHMARK_DEFINE_F(BaseClass, Method) \ #define BENCHMARK_DEFINE_F(BaseClass, Method) \
@@ -1104,7 +1229,8 @@ class Fixture : public internal::Benchmark {
BENCHMARK_TEMPLATE_PRIVATE_DECLARE_F(BaseClass, Method, __VA_ARGS__) \ BENCHMARK_TEMPLATE_PRIVATE_DECLARE_F(BaseClass, Method, __VA_ARGS__) \
void BaseClass##_##Method##_Benchmark::BenchmarkCase void BaseClass##_##Method##_Benchmark::BenchmarkCase
#else #else
#define BENCHMARK_TEMPLATE_DEFINE_F(BaseClass, Method, a) BENCHMARK_TEMPLATE1_DEFINE_F(BaseClass, Method, a) #define BENCHMARK_TEMPLATE_DEFINE_F(BaseClass, Method, a) \
BENCHMARK_TEMPLATE1_DEFINE_F(BaseClass, Method, a)
#endif #endif
#define BENCHMARK_REGISTER_F(BaseClass, Method) \ #define BENCHMARK_REGISTER_F(BaseClass, Method) \
@@ -1136,7 +1262,8 @@ class Fixture : public internal::Benchmark {
BENCHMARK_REGISTER_F(BaseClass, Method); \ BENCHMARK_REGISTER_F(BaseClass, Method); \
void BaseClass##_##Method##_Benchmark::BenchmarkCase void BaseClass##_##Method##_Benchmark::BenchmarkCase
#else #else
#define BENCHMARK_TEMPLATE_F(BaseClass, Method, a) BENCHMARK_TEMPLATE1_F(BaseClass, Method, a) #define BENCHMARK_TEMPLATE_F(BaseClass, Method, a) \
BENCHMARK_TEMPLATE1_F(BaseClass, Method, a)
#endif #endif
// Helper macro to create a main routine in a test that runs the benchmarks // Helper macro to create a main routine in a test that runs the benchmarks
@@ -1145,14 +1272,62 @@ class Fixture : public internal::Benchmark {
::benchmark::Initialize(&argc, argv); \ ::benchmark::Initialize(&argc, argv); \
if (::benchmark::ReportUnrecognizedArguments(argc, argv)) return 1; \ if (::benchmark::ReportUnrecognizedArguments(argc, argv)) return 1; \
::benchmark::RunSpecifiedBenchmarks(); \ ::benchmark::RunSpecifiedBenchmarks(); \
} } \
int main(int, char**)
// ------------------------------------------------------ // ------------------------------------------------------
// Benchmark Reporters // Benchmark Reporters
namespace benchmark { namespace benchmark {
struct CPUInfo {
struct CacheInfo {
std::string type;
int level;
int size;
int num_sharing;
};
int num_cpus;
double cycles_per_second;
std::vector<CacheInfo> caches;
bool scaling_enabled;
std::vector<double> load_avg;
static const CPUInfo& Get();
private:
CPUInfo();
BENCHMARK_DISALLOW_COPY_AND_ASSIGN(CPUInfo);
};
// Adding Struct for System Information
struct SystemInfo {
std::string name;
static const SystemInfo& Get();
private:
SystemInfo();
BENCHMARK_DISALLOW_COPY_AND_ASSIGN(SystemInfo);
};
// BenchmarkName contains the components of the Benchmark's name
// which allows individual fields to be modified or cleared before
// building the final name using 'str()'.
struct BenchmarkName {
std::string function_name;
std::string args;
std::string min_time;
std::string iterations;
std::string repetitions;
std::string time_type;
std::string threads;
// Return the full name of the benchmark with each non-empty
// field separated by a '/'
std::string str() const;
};
// Interface for custom benchmark result printers. // Interface for custom benchmark result printers.
// By default, benchmark reports are printed to stdout. However an application // By default, benchmark reports are printed to stdout. However an application
// can control the destination of the reports by calling // can control the destination of the reports by calling
@@ -1161,37 +1336,49 @@ namespace benchmark {
class BenchmarkReporter { class BenchmarkReporter {
public: public:
struct Context { struct Context {
int num_cpus; CPUInfo const& cpu_info;
double mhz_per_cpu; SystemInfo const& sys_info;
bool cpu_scaling_enabled;
// The number of chars in the longest benchmark name. // The number of chars in the longest benchmark name.
size_t name_field_width; size_t name_field_width;
static const char* executable_name;
Context();
}; };
struct Run { struct Run {
static const int64_t no_repetition_index = -1;
enum RunType { RT_Iteration, RT_Aggregate };
Run() Run()
: error_occurred(false), : run_type(RT_Iteration),
error_occurred(false),
iterations(1), iterations(1),
threads(1),
time_unit(kNanosecond), time_unit(kNanosecond),
real_accumulated_time(0), real_accumulated_time(0),
cpu_accumulated_time(0), cpu_accumulated_time(0),
bytes_per_second(0),
items_per_second(0),
max_heapbytes_used(0), max_heapbytes_used(0),
complexity(oNone), complexity(oNone),
complexity_lambda(), complexity_lambda(),
complexity_n(0), complexity_n(0),
report_big_o(false), report_big_o(false),
report_rms(false), report_rms(false),
counters() {} counters(),
has_memory_result(false),
allocs_per_iter(0.0),
max_bytes_used(0) {}
std::string benchmark_name; std::string benchmark_name() const;
BenchmarkName run_name;
RunType run_type;
std::string aggregate_name;
std::string report_label; // Empty if not set by benchmark. std::string report_label; // Empty if not set by benchmark.
bool error_occurred; bool error_occurred;
std::string error_message; std::string error_message;
int64_t iterations; IterationCount iterations;
int64_t threads;
int64_t repetition_index;
int64_t repetitions;
TimeUnit time_unit; TimeUnit time_unit;
double real_accumulated_time; double real_accumulated_time;
double cpu_accumulated_time; double cpu_accumulated_time;
@@ -1208,26 +1395,27 @@ class BenchmarkReporter {
// accumulated time. // accumulated time.
double GetAdjustedCPUTime() const; double GetAdjustedCPUTime() const;
// Zero if not set by benchmark.
double bytes_per_second;
double items_per_second;
// This is set to 0.0 if memory tracing is not enabled. // This is set to 0.0 if memory tracing is not enabled.
double max_heapbytes_used; double max_heapbytes_used;
// Keep track of arguments to compute asymptotic complexity // Keep track of arguments to compute asymptotic complexity
BigO complexity; BigO complexity;
BigOFunc* complexity_lambda; BigOFunc* complexity_lambda;
int complexity_n; int64_t complexity_n;
// what statistics to compute from the measurements // what statistics to compute from the measurements
const std::vector<Statistics>* statistics; const std::vector<internal::Statistics>* statistics;
// Inform print function whether the current run is a complexity report // Inform print function whether the current run is a complexity report
bool report_big_o; bool report_big_o;
bool report_rms; bool report_rms;
UserCounters counters; UserCounters counters;
// Memory metrics.
bool has_memory_result;
double allocs_per_iter;
int64_t max_bytes_used;
}; };
// Construct a BenchmarkReporter with the output stream set to 'std::cout' // Construct a BenchmarkReporter with the output stream set to 'std::cout'
@@ -1288,17 +1476,19 @@ class BenchmarkReporter {
// Simple reporter that outputs benchmark data to the console. This is the // Simple reporter that outputs benchmark data to the console. This is the
// default reporter used by RunSpecifiedBenchmarks(). // default reporter used by RunSpecifiedBenchmarks().
class ConsoleReporter : public BenchmarkReporter { class ConsoleReporter : public BenchmarkReporter {
public: public:
enum OutputOptions { enum OutputOptions {
OO_None = 0, OO_None = 0,
OO_Color = 1, OO_Color = 1,
OO_Tabular = 2, OO_Tabular = 2,
OO_ColorTabular = OO_Color|OO_Tabular, OO_ColorTabular = OO_Color | OO_Tabular,
OO_Defaults = OO_ColorTabular OO_Defaults = OO_ColorTabular
}; };
explicit ConsoleReporter(OutputOptions opts_ = OO_Defaults) explicit ConsoleReporter(OutputOptions opts_ = OO_Defaults)
: output_options_(opts_), name_field_width_(0), : output_options_(opts_),
prev_counters_(), printed_header_(false) {} name_field_width_(0),
prev_counters_(),
printed_header_(false) {}
virtual bool ReportContext(const Context& context); virtual bool ReportContext(const Context& context);
virtual void ReportRuns(const std::vector<Run>& reports); virtual void ReportRuns(const std::vector<Run>& reports);
@@ -1326,7 +1516,9 @@ class JSONReporter : public BenchmarkReporter {
bool first_report_; bool first_report_;
}; };
class CSVReporter : public BenchmarkReporter { class BENCHMARK_DEPRECATED_MSG(
"The CSV Reporter will be removed in a future release") CSVReporter
: public BenchmarkReporter {
public: public:
CSVReporter() : printed_header_(false) {} CSVReporter() : printed_header_(false) {}
virtual bool ReportContext(const Context& context); virtual bool ReportContext(const Context& context);
@@ -1336,7 +1528,30 @@ class CSVReporter : public BenchmarkReporter {
void PrintRunData(const Run& report); void PrintRunData(const Run& report);
bool printed_header_; bool printed_header_;
std::set< std::string > user_counter_names_; std::set<std::string> user_counter_names_;
};
// If a MemoryManager is registered, it can be used to collect and report
// allocation metrics for a run of the benchmark.
class MemoryManager {
public:
struct Result {
Result() : num_allocs(0), max_bytes_used(0) {}
// The number of allocations made in total between Start and Stop.
int64_t num_allocs;
// The peak memory use between Start and Stop.
int64_t max_bytes_used;
};
virtual ~MemoryManager() {}
// Implement this to start recording allocation information.
virtual void Start() = 0;
// Implement this to stop recording and fill out the given Result structure.
virtual void Stop(Result* result) = 0;
}; };
inline const char* GetTimeUnitString(TimeUnit unit) { inline const char* GetTimeUnitString(TimeUnit unit) {
@@ -1346,9 +1561,9 @@ inline const char* GetTimeUnitString(TimeUnit unit) {
case kMicrosecond: case kMicrosecond:
return "us"; return "us";
case kNanosecond: case kNanosecond:
default:
return "ns"; return "ns";
} }
BENCHMARK_UNREACHABLE();
} }
inline double GetTimeUnitMultiplier(TimeUnit unit) { inline double GetTimeUnitMultiplier(TimeUnit unit) {
@@ -1358,9 +1573,9 @@ inline double GetTimeUnitMultiplier(TimeUnit unit) {
case kMicrosecond: case kMicrosecond:
return 1e6; return 1e6;
case kNanosecond: case kNanosecond:
default:
return 1e9; return 1e9;
} }
BENCHMARK_UNREACHABLE();
} }
} // namespace benchmark } // namespace benchmark

View File

@@ -1,27 +0,0 @@
// Copyright 2015 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef BENCHMARK_BENCHMARK_API_H_
#define BENCHMARK_BENCHMARK_API_H_
#ifdef __DEPRECATED
# ifndef BENCHMARK_WARNING_MSG
# warning the benchmark_api.h header has been deprecated and will be removed, please include benchmark.h instead
# else
BENCHMARK_WARNING_MSG("the benchmark_api.h header has been deprecated and will be removed, please include benchmark.h instead")
# endif
#endif
#include "benchmark.h" // For forward declaration of BenchmarkReporter
#endif // BENCHMARK_BENCHMARK_API_H_

View File

@@ -1,27 +0,0 @@
// Copyright 2015 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef BENCHMARK_REPORTER_H_
#define BENCHMARK_REPORTER_H_
#ifdef __DEPRECATED
# ifndef BENCHMARK_WARNING_MSG
# warning the reporter.h header has been deprecated and will be removed, please include benchmark.h instead
# else
BENCHMARK_WARNING_MSG("the reporter.h header has been deprecated and will be removed, please include benchmark.h instead")
# endif
#endif
#include "benchmark.h" // For forward declaration of BenchmarkReporter
#endif // BENCHMARK_REPORTER_H_

View File

@@ -568,8 +568,10 @@ class LogSink; // defined below
LOG_TO_STRING_##severity(static_cast<std::vector<std::string>*>(outvec)).stream() LOG_TO_STRING_##severity(static_cast<std::vector<std::string>*>(outvec)).stream()
#define LOG_IF(severity, condition) \ #define LOG_IF(severity, condition) \
static_cast<void>(0), \
!(condition) ? (void) 0 : google::LogMessageVoidify() & LOG(severity) !(condition) ? (void) 0 : google::LogMessageVoidify() & LOG(severity)
#define SYSLOG_IF(severity, condition) \ #define SYSLOG_IF(severity, condition) \
static_cast<void>(0), \
!(condition) ? (void) 0 : google::LogMessageVoidify() & SYSLOG(severity) !(condition) ? (void) 0 : google::LogMessageVoidify() & SYSLOG(severity)
#define LOG_ASSERT(condition) \ #define LOG_ASSERT(condition) \
@@ -859,6 +861,7 @@ DECLARE_CHECK_STROP_IMPL(strcasecmp, false)
&google::LogMessage::SendToLog) &google::LogMessage::SendToLog)
#define PLOG_IF(severity, condition) \ #define PLOG_IF(severity, condition) \
static_cast<void>(0), \
!(condition) ? (void) 0 : google::LogMessageVoidify() & PLOG(severity) !(condition) ? (void) 0 : google::LogMessageVoidify() & PLOG(severity)
// A CHECK() macro that postpends errno if the condition is false. E.g. // A CHECK() macro that postpends errno if the condition is false. E.g.
@@ -931,16 +934,11 @@ struct CompileAssert {
struct CrashReason; struct CrashReason;
// Returns true if FailureSignalHandler is installed. // Returns true if FailureSignalHandler is installed.
bool IsFailureSignalHandlerInstalled(); // Needs to be exported since it's used by the signalhandler_unittest.
GOOGLE_GLOG_DLL_DECL bool IsFailureSignalHandlerInstalled();
} // namespace glog_internal_namespace_ } // namespace glog_internal_namespace_
#define GOOGLE_GLOG_COMPILE_ASSERT(expr, msg) \
typedef google::glog_internal_namespace_::CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
#define LOG_EVERY_N(severity, n) \ #define LOG_EVERY_N(severity, n) \
GOOGLE_GLOG_COMPILE_ASSERT(google::GLOG_ ## severity < \
google::NUM_SEVERITIES, \
INVALID_REQUESTED_LOG_SEVERITY); \
SOME_KIND_OF_LOG_EVERY_N(severity, (n), google::LogMessage::SendToLog) SOME_KIND_OF_LOG_EVERY_N(severity, (n), google::LogMessage::SendToLog)
#define SYSLOG_EVERY_N(severity, n) \ #define SYSLOG_EVERY_N(severity, n) \
@@ -1009,22 +1007,28 @@ const LogSeverity GLOG_0 = GLOG_ERROR;
#else // !DCHECK_IS_ON() #else // !DCHECK_IS_ON()
#define DLOG(severity) \ #define DLOG(severity) \
static_cast<void>(0), \
true ? (void) 0 : google::LogMessageVoidify() & LOG(severity) true ? (void) 0 : google::LogMessageVoidify() & LOG(severity)
#define DVLOG(verboselevel) \ #define DVLOG(verboselevel) \
(true || !VLOG_IS_ON(verboselevel)) ?\ static_cast<void>(0), \
(true || !VLOG_IS_ON(verboselevel)) ? \
(void) 0 : google::LogMessageVoidify() & LOG(INFO) (void) 0 : google::LogMessageVoidify() & LOG(INFO)
#define DLOG_IF(severity, condition) \ #define DLOG_IF(severity, condition) \
static_cast<void>(0), \
(true || !(condition)) ? (void) 0 : google::LogMessageVoidify() & LOG(severity) (true || !(condition)) ? (void) 0 : google::LogMessageVoidify() & LOG(severity)
#define DLOG_EVERY_N(severity, n) \ #define DLOG_EVERY_N(severity, n) \
static_cast<void>(0), \
true ? (void) 0 : google::LogMessageVoidify() & LOG(severity) true ? (void) 0 : google::LogMessageVoidify() & LOG(severity)
#define DLOG_IF_EVERY_N(severity, condition, n) \ #define DLOG_IF_EVERY_N(severity, condition, n) \
static_cast<void>(0), \
(true || !(condition))? (void) 0 : google::LogMessageVoidify() & LOG(severity) (true || !(condition))? (void) 0 : google::LogMessageVoidify() & LOG(severity)
#define DLOG_ASSERT(condition) \ #define DLOG_ASSERT(condition) \
static_cast<void>(0), \
true ? (void) 0 : LOG_ASSERT(condition) true ? (void) 0 : LOG_ASSERT(condition)
// MSVC warning C4127: conditional expression is constant // MSVC warning C4127: conditional expression is constant
@@ -1109,10 +1113,11 @@ namespace base_logging {
// buffer to allow for a '\n' and '\0'. // buffer to allow for a '\n' and '\0'.
class GOOGLE_GLOG_DLL_DECL LogStreamBuf : public std::streambuf { class GOOGLE_GLOG_DLL_DECL LogStreamBuf : public std::streambuf {
public: public:
// REQUIREMENTS: "len" must be >= 2 to account for the '\n' and '\n'. // REQUIREMENTS: "len" must be >= 2 to account for the '\n' and '\0'.
LogStreamBuf(char *buf, int len) { LogStreamBuf(char *buf, int len) {
setp(buf, buf + len - 2); setp(buf, buf + len - 2);
} }
// This effectively ignores overflow. // This effectively ignores overflow.
virtual int_type overflow(int_type ch) { virtual int_type overflow(int_type ch) {
return ch; return ch;
@@ -1151,13 +1156,9 @@ public:
// 2005 if you are deriving from a type in the Standard C++ Library" // 2005 if you are deriving from a type in the Standard C++ Library"
// http://msdn.microsoft.com/en-us/library/3tdb471s(VS.80).aspx // http://msdn.microsoft.com/en-us/library/3tdb471s(VS.80).aspx
// Let's just ignore the warning. // Let's just ignore the warning.
#ifdef _MSC_VER GLOG_MSVC_PUSH_DISABLE_WARNING(4275)
# pragma warning(disable: 4275)
#endif
class GOOGLE_GLOG_DLL_DECL LogStream : public std::ostream { class GOOGLE_GLOG_DLL_DECL LogStream : public std::ostream {
#ifdef _MSC_VER GLOG_MSVC_POP_WARNING()
# pragma warning(default: 4275)
#endif
public: public:
LogStream(char *buf, int len, int ctr) LogStream(char *buf, int len, int ctr)
: std::ostream(NULL), : std::ostream(NULL),

View File

@@ -175,11 +175,6 @@ GOOGLE_GLOG_DLL_DECL void RawLog__(LogSeverity severity,
const char* format, ...) const char* format, ...)
; ;
// Hack to propagate time information into this module so that
// this module does not have to directly call localtime_r(),
// which could allocate memory.
GOOGLE_GLOG_DLL_DECL void RawLog__SetLastTime(const struct tm& t, int usecs);
} }
#endif // BASE_RAW_LOGGING_H_ #endif // BASE_RAW_LOGGING_H_

View File

@@ -26,13 +26,14 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Google Mock - a framework for writing C++ mock classes. // Google Mock - a framework for writing C++ mock classes.
// //
// This file implements some commonly used actions. // This file implements some commonly used actions.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_
@@ -46,9 +47,10 @@
#include "gmock/internal/gmock-internal-utils.h" #include "gmock/internal/gmock-internal-utils.h"
#include "gmock/internal/gmock-port.h" #include "gmock/internal/gmock-port.h"
#if GTEST_HAS_STD_TYPE_TRAITS_ // Defined by gtest-port.h via gmock-port.h. #if GTEST_LANG_CXX11 // Defined by gtest-port.h via gmock-port.h.
#include <functional>
#include <type_traits> #include <type_traits>
#endif #endif // GTEST_LANG_CXX11
namespace testing { namespace testing {
@@ -96,7 +98,7 @@ struct BuiltInDefaultValueGetter<T, false> {
template <typename T> template <typename T>
class BuiltInDefaultValue { class BuiltInDefaultValue {
public: public:
#if GTEST_HAS_STD_TYPE_TRAITS_ #if GTEST_LANG_CXX11
// This function returns true iff type T has a built-in default value. // This function returns true iff type T has a built-in default value.
static bool Exists() { static bool Exists() {
return ::std::is_default_constructible<T>::value; return ::std::is_default_constructible<T>::value;
@@ -107,7 +109,7 @@ class BuiltInDefaultValue {
T, ::std::is_default_constructible<T>::value>::Get(); T, ::std::is_default_constructible<T>::value>::Get();
} }
#else // GTEST_HAS_STD_TYPE_TRAITS_ #else // GTEST_LANG_CXX11
// This function returns true iff type T has a built-in default value. // This function returns true iff type T has a built-in default value.
static bool Exists() { static bool Exists() {
return false; return false;
@@ -117,7 +119,7 @@ class BuiltInDefaultValue {
return BuiltInDefaultValueGetter<T, false>::Get(); return BuiltInDefaultValueGetter<T, false>::Get();
} }
#endif // GTEST_HAS_STD_TYPE_TRAITS_ #endif // GTEST_LANG_CXX11
}; };
// This partial specialization says that we use the same built-in // This partial specialization says that we use the same built-in
@@ -359,15 +361,21 @@ class Action {
// Constructs a null Action. Needed for storing Action objects in // Constructs a null Action. Needed for storing Action objects in
// STL containers. // STL containers.
Action() : impl_(NULL) {} Action() {}
// Constructs an Action from its implementation. A NULL impl is #if GTEST_LANG_CXX11
// used to represent the "do-default" action. // Construct an Action from a specified callable.
// This cannot take std::function directly, because then Action would not be
// directly constructible from lambda (it would require two conversions).
template <typename G,
typename = typename ::std::enable_if<
::std::is_constructible<::std::function<F>, G>::value>::type>
Action(G&& fun) : fun_(::std::forward<G>(fun)) {} // NOLINT
#endif
// Constructs an Action from its implementation.
explicit Action(ActionInterface<F>* impl) : impl_(impl) {} explicit Action(ActionInterface<F>* impl) : impl_(impl) {}
// Copy constructor.
Action(const Action& action) : impl_(action.impl_) {}
// This constructor allows us to turn an Action<Func> object into an // This constructor allows us to turn an Action<Func> object into an
// Action<F>, as long as F's arguments can be implicitly converted // Action<F>, as long as F's arguments can be implicitly converted
// to Func's and Func's return type can be implicitly converted to // to Func's and Func's return type can be implicitly converted to
@@ -376,7 +384,13 @@ class Action {
explicit Action(const Action<Func>& action); explicit Action(const Action<Func>& action);
// Returns true iff this is the DoDefault() action. // Returns true iff this is the DoDefault() action.
bool IsDoDefault() const { return impl_.get() == NULL; } bool IsDoDefault() const {
#if GTEST_LANG_CXX11
return impl_ == nullptr && fun_ == nullptr;
#else
return impl_ == NULL;
#endif
}
// Performs the action. Note that this method is const even though // Performs the action. Note that this method is const even though
// the corresponding method in ActionInterface is not. The reason // the corresponding method in ActionInterface is not. The reason
@@ -384,14 +398,15 @@ class Action {
// another concrete action, not that the concrete action it binds to // another concrete action, not that the concrete action it binds to
// cannot change state. (Think of the difference between a const // cannot change state. (Think of the difference between a const
// pointer and a pointer to const.) // pointer and a pointer to const.)
Result Perform(const ArgumentTuple& args) const { Result Perform(ArgumentTuple args) const {
internal::Assert( if (IsDoDefault()) {
!IsDoDefault(), __FILE__, __LINE__, internal::IllegalDoDefault(__FILE__, __LINE__);
"You are using DoDefault() inside a composite action like " }
"DoAll() or WithArgs(). This is not supported for technical " #if GTEST_LANG_CXX11
"reasons. Please instead spell out the default action, or " if (fun_ != nullptr) {
"assign the default action to an Action variable and use " return internal::Apply(fun_, ::std::move(args));
"the variable in various places."); }
#endif
return impl_->Perform(args); return impl_->Perform(args);
} }
@@ -399,6 +414,18 @@ class Action {
template <typename F1, typename F2> template <typename F1, typename F2>
friend class internal::ActionAdaptor; friend class internal::ActionAdaptor;
template <typename G>
friend class Action;
// In C++11, Action can be implemented either as a generic functor (through
// std::function), or legacy ActionInterface. In C++98, only ActionInterface
// is available. The invariants are as follows:
// * in C++98, impl_ is null iff this is the default action
// * in C++11, at most one of fun_ & impl_ may be nonnull; both are null iff
// this is the default action
#if GTEST_LANG_CXX11
::std::function<F> fun_;
#endif
internal::linked_ptr<ActionInterface<F> > impl_; internal::linked_ptr<ActionInterface<F> > impl_;
}; };
@@ -530,6 +557,9 @@ struct ByMoveWrapper {
// statement, and conversion of the result of Return to Action<T(U)> is a // statement, and conversion of the result of Return to Action<T(U)> is a
// good place for that. // good place for that.
// //
// The real life example of the above scenario happens when an invocation
// of gtl::Container() is passed into Return.
//
template <typename R> template <typename R>
class ReturnAction { class ReturnAction {
public: public:
@@ -749,7 +779,7 @@ class DoDefaultAction {
// This template type conversion operator allows DoDefault() to be // This template type conversion operator allows DoDefault() to be
// used in any function. // used in any function.
template <typename F> template <typename F>
operator Action<F>() const { return Action<F>(NULL); } operator Action<F>() const { return Action<F>(); } // NOLINT
}; };
// Implements the Assign action to set a given pointer referent to a // Implements the Assign action to set a given pointer referent to a
@@ -885,6 +915,28 @@ class InvokeMethodWithoutArgsAction {
GTEST_DISALLOW_ASSIGN_(InvokeMethodWithoutArgsAction); GTEST_DISALLOW_ASSIGN_(InvokeMethodWithoutArgsAction);
}; };
// Implements the InvokeWithoutArgs(callback) action.
template <typename CallbackType>
class InvokeCallbackWithoutArgsAction {
public:
// The c'tor takes ownership of the callback.
explicit InvokeCallbackWithoutArgsAction(CallbackType* callback)
: callback_(callback) {
callback->CheckIsRepeatable(); // Makes sure the callback is permanent.
}
// This type conversion operator template allows Invoke(callback) to
// be used wherever the callback's return type can be implicitly
// converted to that of the mock function.
template <typename Result, typename ArgumentTuple>
Result Perform(const ArgumentTuple&) const { return callback_->Run(); }
private:
const internal::linked_ptr<CallbackType> callback_;
GTEST_DISALLOW_ASSIGN_(InvokeCallbackWithoutArgsAction);
};
// Implements the IgnoreResult(action) action. // Implements the IgnoreResult(action) action.
template <typename A> template <typename A>
class IgnoreResultAction { class IgnoreResultAction {
@@ -1029,9 +1081,9 @@ class DoBothAction {
// return sqrt(x*x + y*y); // return sqrt(x*x + y*y);
// } // }
// ... // ...
// EXEPCT_CALL(mock, Foo("abc", _, _)) // EXPECT_CALL(mock, Foo("abc", _, _))
// .WillOnce(Invoke(DistanceToOriginWithLabel)); // .WillOnce(Invoke(DistanceToOriginWithLabel));
// EXEPCT_CALL(mock, Bar(5, _, _)) // EXPECT_CALL(mock, Bar(5, _, _))
// .WillOnce(Invoke(DistanceToOriginWithIndex)); // .WillOnce(Invoke(DistanceToOriginWithIndex));
// //
// you could write // you could write
@@ -1041,8 +1093,8 @@ class DoBothAction {
// return sqrt(x*x + y*y); // return sqrt(x*x + y*y);
// } // }
// ... // ...
// EXEPCT_CALL(mock, Foo("abc", _, _)).WillOnce(Invoke(DistanceToOrigin)); // EXPECT_CALL(mock, Foo("abc", _, _)).WillOnce(Invoke(DistanceToOrigin));
// EXEPCT_CALL(mock, Bar(5, _, _)).WillOnce(Invoke(DistanceToOrigin)); // EXPECT_CALL(mock, Bar(5, _, _)).WillOnce(Invoke(DistanceToOrigin));
typedef internal::IgnoredValue Unused; typedef internal::IgnoredValue Unused;
// This constructor allows us to turn an Action<From> object into an // This constructor allows us to turn an Action<From> object into an
@@ -1052,7 +1104,13 @@ typedef internal::IgnoredValue Unused;
template <typename To> template <typename To>
template <typename From> template <typename From>
Action<To>::Action(const Action<From>& from) Action<To>::Action(const Action<From>& from)
: impl_(new internal::ActionAdaptor<To, From>(from)) {} :
#if GTEST_LANG_CXX11
fun_(from.fun_),
#endif
impl_(from.impl_ == NULL ? NULL
: new internal::ActionAdaptor<To, From>(from)) {
}
// Creates an action that returns 'value'. 'value' is passed by value // Creates an action that returns 'value'. 'value' is passed by value
// instead of const reference - otherwise Return("string literal") // instead of const reference - otherwise Return("string literal")

View File

@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Google Mock - a framework for writing C++ mock classes. // Google Mock - a framework for writing C++ mock classes.
// //
@@ -35,6 +34,8 @@
// cardinalities can be defined by the user implementing the // cardinalities can be defined by the user implementing the
// CardinalityInterface interface if necessary. // CardinalityInterface interface if necessary.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_
@@ -43,6 +44,9 @@
#include "gmock/internal/gmock-port.h" #include "gmock/internal/gmock-port.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
/* class A needs to have dll-interface to be used by clients of class B */)
namespace testing { namespace testing {
// To implement a cardinality Foo, define: // To implement a cardinality Foo, define:
@@ -144,4 +148,6 @@ inline Cardinality MakeCardinality(const CardinalityInterface* c) {
} // namespace testing } // namespace testing
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
#endif // GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ #endif // GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_

View File

@@ -1,4 +1,6 @@
// This file was GENERATED by a script. DO NOT EDIT BY HAND!!! // This file was GENERATED by command:
// pump.py gmock-generated-actions.h.pump
// DO NOT EDIT BY HAND!!!
// Copyright 2007, Google Inc. // Copyright 2007, Google Inc.
// All rights reserved. // All rights reserved.
@@ -28,13 +30,14 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Google Mock - a framework for writing C++ mock classes. // Google Mock - a framework for writing C++ mock classes.
// //
// This file implements some commonly used variadic actions. // This file implements some commonly used variadic actions.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
@@ -45,8 +48,8 @@ namespace testing {
namespace internal { namespace internal {
// InvokeHelper<F> knows how to unpack an N-tuple and invoke an N-ary // InvokeHelper<F> knows how to unpack an N-tuple and invoke an N-ary
// function or method with the unpacked values, where F is a function // function, method, or callback with the unpacked values, where F is
// type that takes N arguments. // a function type that takes N arguments.
template <typename Result, typename ArgumentTuple> template <typename Result, typename ArgumentTuple>
class InvokeHelper; class InvokeHelper;
@@ -64,6 +67,12 @@ class InvokeHelper<R, ::testing::tuple<> > {
const ::testing::tuple<>&) { const ::testing::tuple<>&) {
return (obj_ptr->*method_ptr)(); return (obj_ptr->*method_ptr)();
} }
template <typename CallbackType>
static R InvokeCallback(CallbackType* callback,
const ::testing::tuple<>&) {
return callback->Run();
}
}; };
template <typename R, typename A1> template <typename R, typename A1>
@@ -80,6 +89,12 @@ class InvokeHelper<R, ::testing::tuple<A1> > {
const ::testing::tuple<A1>& args) { const ::testing::tuple<A1>& args) {
return (obj_ptr->*method_ptr)(get<0>(args)); return (obj_ptr->*method_ptr)(get<0>(args));
} }
template <typename CallbackType>
static R InvokeCallback(CallbackType* callback,
const ::testing::tuple<A1>& args) {
return callback->Run(get<0>(args));
}
}; };
template <typename R, typename A1, typename A2> template <typename R, typename A1, typename A2>
@@ -96,6 +111,12 @@ class InvokeHelper<R, ::testing::tuple<A1, A2> > {
const ::testing::tuple<A1, A2>& args) { const ::testing::tuple<A1, A2>& args) {
return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args)); return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args));
} }
template <typename CallbackType>
static R InvokeCallback(CallbackType* callback,
const ::testing::tuple<A1, A2>& args) {
return callback->Run(get<0>(args), get<1>(args));
}
}; };
template <typename R, typename A1, typename A2, typename A3> template <typename R, typename A1, typename A2, typename A3>
@@ -113,6 +134,12 @@ class InvokeHelper<R, ::testing::tuple<A1, A2, A3> > {
return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
get<2>(args)); get<2>(args));
} }
template <typename CallbackType>
static R InvokeCallback(CallbackType* callback,
const ::testing::tuple<A1, A2, A3>& args) {
return callback->Run(get<0>(args), get<1>(args), get<2>(args));
}
}; };
template <typename R, typename A1, typename A2, typename A3, typename A4> template <typename R, typename A1, typename A2, typename A3, typename A4>
@@ -132,6 +159,13 @@ class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4> > {
return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
get<2>(args), get<3>(args)); get<2>(args), get<3>(args));
} }
template <typename CallbackType>
static R InvokeCallback(CallbackType* callback,
const ::testing::tuple<A1, A2, A3, A4>& args) {
return callback->Run(get<0>(args), get<1>(args), get<2>(args),
get<3>(args));
}
}; };
template <typename R, typename A1, typename A2, typename A3, typename A4, template <typename R, typename A1, typename A2, typename A3, typename A4,
@@ -152,6 +186,13 @@ class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5> > {
return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
get<2>(args), get<3>(args), get<4>(args)); get<2>(args), get<3>(args), get<4>(args));
} }
template <typename CallbackType>
static R InvokeCallback(CallbackType* callback,
const ::testing::tuple<A1, A2, A3, A4, A5>& args) {
return callback->Run(get<0>(args), get<1>(args), get<2>(args),
get<3>(args), get<4>(args));
}
}; };
template <typename R, typename A1, typename A2, typename A3, typename A4, template <typename R, typename A1, typename A2, typename A3, typename A4,
@@ -172,6 +213,8 @@ class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6> > {
return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
get<2>(args), get<3>(args), get<4>(args), get<5>(args)); get<2>(args), get<3>(args), get<4>(args), get<5>(args));
} }
// There is no InvokeCallback() for 6-tuples
}; };
template <typename R, typename A1, typename A2, typename A3, typename A4, template <typename R, typename A1, typename A2, typename A3, typename A4,
@@ -194,6 +237,8 @@ class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7> > {
get<2>(args), get<3>(args), get<4>(args), get<5>(args), get<2>(args), get<3>(args), get<4>(args), get<5>(args),
get<6>(args)); get<6>(args));
} }
// There is no InvokeCallback() for 7-tuples
}; };
template <typename R, typename A1, typename A2, typename A3, typename A4, template <typename R, typename A1, typename A2, typename A3, typename A4,
@@ -217,6 +262,8 @@ class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8> > {
get<2>(args), get<3>(args), get<4>(args), get<5>(args), get<2>(args), get<3>(args), get<4>(args), get<5>(args),
get<6>(args), get<7>(args)); get<6>(args), get<7>(args));
} }
// There is no InvokeCallback() for 8-tuples
}; };
template <typename R, typename A1, typename A2, typename A3, typename A4, template <typename R, typename A1, typename A2, typename A3, typename A4,
@@ -240,6 +287,8 @@ class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> > {
get<2>(args), get<3>(args), get<4>(args), get<5>(args), get<2>(args), get<3>(args), get<4>(args), get<5>(args),
get<6>(args), get<7>(args), get<8>(args)); get<6>(args), get<7>(args), get<8>(args));
} }
// There is no InvokeCallback() for 9-tuples
}; };
template <typename R, typename A1, typename A2, typename A3, typename A4, template <typename R, typename A1, typename A2, typename A3, typename A4,
@@ -265,6 +314,33 @@ class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9,
get<2>(args), get<3>(args), get<4>(args), get<5>(args), get<2>(args), get<3>(args), get<4>(args), get<5>(args),
get<6>(args), get<7>(args), get<8>(args), get<9>(args)); get<6>(args), get<7>(args), get<8>(args), get<9>(args));
} }
// There is no InvokeCallback() for 10-tuples
};
// Implements the Invoke(callback) action.
template <typename CallbackType>
class InvokeCallbackAction {
public:
// The c'tor takes ownership of the callback.
explicit InvokeCallbackAction(CallbackType* callback)
: callback_(callback) {
callback->CheckIsRepeatable(); // Makes sure the callback is permanent.
}
// This type conversion operator template allows Invoke(callback) to
// be used wherever the callback's type is compatible with that of
// the mock function, i.e. if the mock function's arguments can be
// implicitly converted to the callback's arguments and the
// callback's result can be implicitly converted to the mock
// function's result.
template <typename Result, typename ArgumentTuple>
Result Perform(const ArgumentTuple& args) const {
return InvokeHelper<Result, ArgumentTuple>::InvokeCallback(
callback_.get(), args);
}
private:
const linked_ptr<CallbackType> callback_;
}; };
// An INTERNAL macro for extracting the type of a tuple field. It's // An INTERNAL macro for extracting the type of a tuple field. It's
@@ -875,7 +951,7 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
// MORE INFORMATION: // MORE INFORMATION:
// //
// To learn more about using these macros, please search for 'ACTION' // To learn more about using these macros, please search for 'ACTION'
// on http://code.google.com/p/googlemock/wiki/CookBook. // on https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md
// An internal macro needed for implementing ACTION*(). // An internal macro needed for implementing ACTION*().
#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_\ #define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_\
@@ -1073,52 +1149,90 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
#define GMOCK_INTERNAL_INIT_AND_0_VALUE_PARAMS()\ #define GMOCK_INTERNAL_INIT_AND_0_VALUE_PARAMS()\
() ()
#define GMOCK_INTERNAL_INIT_AND_1_VALUE_PARAMS(p0)\ #define GMOCK_INTERNAL_INIT_AND_1_VALUE_PARAMS(p0)\
(p0##_type gmock_p0) : p0(gmock_p0) (p0##_type gmock_p0) : p0(::testing::internal::move(gmock_p0))
#define GMOCK_INTERNAL_INIT_AND_2_VALUE_PARAMS(p0, p1)\ #define GMOCK_INTERNAL_INIT_AND_2_VALUE_PARAMS(p0, p1)\
(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), p1(gmock_p1) (p0##_type gmock_p0, \
p1##_type gmock_p1) : p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1))
#define GMOCK_INTERNAL_INIT_AND_3_VALUE_PARAMS(p0, p1, p2)\ #define GMOCK_INTERNAL_INIT_AND_3_VALUE_PARAMS(p0, p1, p2)\
(p0##_type gmock_p0, p1##_type gmock_p1, \ (p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) p2##_type gmock_p2) : p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2))
#define GMOCK_INTERNAL_INIT_AND_4_VALUE_PARAMS(p0, p1, p2, p3)\ #define GMOCK_INTERNAL_INIT_AND_4_VALUE_PARAMS(p0, p1, p2, p3)\
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p3##_type gmock_p3) : p0(::testing::internal::move(gmock_p0)), \
p3(gmock_p3) p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3))
#define GMOCK_INTERNAL_INIT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)\ #define GMOCK_INTERNAL_INIT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)\
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), \ p3##_type gmock_p3, \
p2(gmock_p2), p3(gmock_p3), p4(gmock_p4) p4##_type gmock_p4) : p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4))
#define GMOCK_INTERNAL_INIT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)\ #define GMOCK_INTERNAL_INIT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)\
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4, \ p3##_type gmock_p3, p4##_type gmock_p4, \
p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p5##_type gmock_p5) : p0(::testing::internal::move(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5))
#define GMOCK_INTERNAL_INIT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)\ #define GMOCK_INTERNAL_INIT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)\
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p6##_type gmock_p6) : p0(::testing::internal::move(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6) p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6))
#define GMOCK_INTERNAL_INIT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)\ #define GMOCK_INTERNAL_INIT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)\
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6, p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), \ p6##_type gmock_p6, \
p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ p7##_type gmock_p7) : p0(::testing::internal::move(gmock_p0)), \
p7(gmock_p7) p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)), \
p7(::testing::internal::move(gmock_p7))
#define GMOCK_INTERNAL_INIT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ #define GMOCK_INTERNAL_INIT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
p7, p8)\ p7, p8)\
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6, p7##_type gmock_p7, \ p6##_type gmock_p6, p7##_type gmock_p7, \
p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p8##_type gmock_p8) : p0(::testing::internal::move(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ p1(::testing::internal::move(gmock_p1)), \
p8(gmock_p8) p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)), \
p7(::testing::internal::move(gmock_p7)), \
p8(::testing::internal::move(gmock_p8))
#define GMOCK_INTERNAL_INIT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ #define GMOCK_INTERNAL_INIT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
p7, p8, p9)\ p7, p8, p9)\
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \ p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \
p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p9##_type gmock_p9) : p0(::testing::internal::move(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ p1(::testing::internal::move(gmock_p1)), \
p8(gmock_p8), p9(gmock_p9) p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)), \
p7(::testing::internal::move(gmock_p7)), \
p8(::testing::internal::move(gmock_p8)), \
p9(::testing::internal::move(gmock_p9))
// Declares the fields for storing the value parameters. // Declares the fields for storing the value parameters.
#define GMOCK_INTERNAL_DEFN_AND_0_VALUE_PARAMS() #define GMOCK_INTERNAL_DEFN_AND_0_VALUE_PARAMS()
@@ -1354,7 +1468,8 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
template <typename p0##_type>\ template <typename p0##_type>\
class name##ActionP {\ class name##ActionP {\
public:\ public:\
explicit name##ActionP(p0##_type gmock_p0) : p0(gmock_p0) {}\ explicit name##ActionP(p0##_type gmock_p0) : \
p0(::testing::internal::forward<p0##_type>(gmock_p0)) {}\
template <typename F>\ template <typename F>\
class gmock_Impl : public ::testing::ActionInterface<F> {\ class gmock_Impl : public ::testing::ActionInterface<F> {\
public:\ public:\
@@ -1362,7 +1477,8 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
typedef typename ::testing::internal::Function<F>::Result return_type;\ typedef typename ::testing::internal::Function<F>::Result return_type;\
typedef typename ::testing::internal::Function<F>::ArgumentTuple\ typedef typename ::testing::internal::Function<F>::ArgumentTuple\
args_type;\ args_type;\
explicit gmock_Impl(p0##_type gmock_p0) : p0(gmock_p0) {}\ explicit gmock_Impl(p0##_type gmock_p0) : \
p0(::testing::internal::forward<p0##_type>(gmock_p0)) {}\
virtual return_type Perform(const args_type& args) {\ virtual return_type Perform(const args_type& args) {\
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
Perform(this, args);\ Perform(this, args);\
@@ -1404,8 +1520,9 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
template <typename p0##_type, typename p1##_type>\ template <typename p0##_type, typename p1##_type>\
class name##ActionP2 {\ class name##ActionP2 {\
public:\ public:\
name##ActionP2(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \ name##ActionP2(p0##_type gmock_p0, \
p1(gmock_p1) {}\ p1##_type gmock_p1) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p1(::testing::internal::forward<p1##_type>(gmock_p1)) {}\
template <typename F>\ template <typename F>\
class gmock_Impl : public ::testing::ActionInterface<F> {\ class gmock_Impl : public ::testing::ActionInterface<F> {\
public:\ public:\
@@ -1413,8 +1530,9 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
typedef typename ::testing::internal::Function<F>::Result return_type;\ typedef typename ::testing::internal::Function<F>::Result return_type;\
typedef typename ::testing::internal::Function<F>::ArgumentTuple\ typedef typename ::testing::internal::Function<F>::ArgumentTuple\
args_type;\ args_type;\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \ gmock_Impl(p0##_type gmock_p0, \
p1(gmock_p1) {}\ p1##_type gmock_p1) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p1(::testing::internal::forward<p1##_type>(gmock_p1)) {}\
virtual return_type Perform(const args_type& args) {\ virtual return_type Perform(const args_type& args) {\
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
Perform(this, args);\ Perform(this, args);\
@@ -1460,7 +1578,9 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
class name##ActionP3 {\ class name##ActionP3 {\
public:\ public:\
name##ActionP3(p0##_type gmock_p0, p1##_type gmock_p1, \ name##ActionP3(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\ p2##_type gmock_p2) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)) {}\
template <typename F>\ template <typename F>\
class gmock_Impl : public ::testing::ActionInterface<F> {\ class gmock_Impl : public ::testing::ActionInterface<F> {\
public:\ public:\
@@ -1469,7 +1589,9 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
typedef typename ::testing::internal::Function<F>::ArgumentTuple\ typedef typename ::testing::internal::Function<F>::ArgumentTuple\
args_type;\ args_type;\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, \ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\ p2##_type gmock_p2) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)) {}\
virtual return_type Perform(const args_type& args) {\ virtual return_type Perform(const args_type& args) {\
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
Perform(this, args);\ Perform(this, args);\
@@ -1519,8 +1641,11 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
class name##ActionP4 {\ class name##ActionP4 {\
public:\ public:\
name##ActionP4(p0##_type gmock_p0, p1##_type gmock_p1, \ name##ActionP4(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), \ p2##_type gmock_p2, \
p2(gmock_p2), p3(gmock_p3) {}\ p3##_type gmock_p3) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)) {}\
template <typename F>\ template <typename F>\
class gmock_Impl : public ::testing::ActionInterface<F> {\ class gmock_Impl : public ::testing::ActionInterface<F> {\
public:\ public:\
@@ -1529,8 +1654,10 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
typedef typename ::testing::internal::Function<F>::ArgumentTuple\ typedef typename ::testing::internal::Function<F>::ArgumentTuple\
args_type;\ args_type;\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p3##_type gmock_p3) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p3(gmock_p3) {}\ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)) {}\
virtual return_type Perform(const args_type& args) {\ virtual return_type Perform(const args_type& args) {\
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
Perform(this, args);\ Perform(this, args);\
@@ -1587,8 +1714,11 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
public:\ public:\
name##ActionP5(p0##_type gmock_p0, p1##_type gmock_p1, \ name##ActionP5(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, \ p2##_type gmock_p2, p3##_type gmock_p3, \
p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p4##_type gmock_p4) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4) {}\ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)) {}\
template <typename F>\ template <typename F>\
class gmock_Impl : public ::testing::ActionInterface<F> {\ class gmock_Impl : public ::testing::ActionInterface<F> {\
public:\ public:\
@@ -1597,8 +1727,12 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
typedef typename ::testing::internal::Function<F>::ArgumentTuple\ typedef typename ::testing::internal::Function<F>::ArgumentTuple\
args_type;\ args_type;\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4) : p0(gmock_p0), \ p3##_type gmock_p3, \
p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), p4(gmock_p4) {}\ p4##_type gmock_p4) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)) {}\
virtual return_type Perform(const args_type& args) {\ virtual return_type Perform(const args_type& args) {\
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
Perform(this, args);\ Perform(this, args);\
@@ -1657,8 +1791,12 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
public:\ public:\
name##ActionP6(p0##_type gmock_p0, p1##_type gmock_p1, \ name##ActionP6(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p5##_type gmock_p5) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {}\ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
p5(::testing::internal::forward<p5##_type>(gmock_p5)) {}\
template <typename F>\ template <typename F>\
class gmock_Impl : public ::testing::ActionInterface<F> {\ class gmock_Impl : public ::testing::ActionInterface<F> {\
public:\ public:\
@@ -1668,8 +1806,12 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
args_type;\ args_type;\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4, \ p3##_type gmock_p3, p4##_type gmock_p4, \
p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p5##_type gmock_p5) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {}\ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
p5(::testing::internal::forward<p5##_type>(gmock_p5)) {}\
virtual return_type Perform(const args_type& args) {\ virtual return_type Perform(const args_type& args) {\
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
Perform(this, args);\ Perform(this, args);\
@@ -1731,9 +1873,14 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
public:\ public:\
name##ActionP7(p0##_type gmock_p0, p1##_type gmock_p1, \ name##ActionP7(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
p5##_type gmock_p5, p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), \ p5##_type gmock_p5, \
p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), \ p6##_type gmock_p6) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p6(gmock_p6) {}\ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
p6(::testing::internal::forward<p6##_type>(gmock_p6)) {}\
template <typename F>\ template <typename F>\
class gmock_Impl : public ::testing::ActionInterface<F> {\ class gmock_Impl : public ::testing::ActionInterface<F> {\
public:\ public:\
@@ -1743,8 +1890,13 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
args_type;\ args_type;\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p6##_type gmock_p6) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6) {}\ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
p6(::testing::internal::forward<p6##_type>(gmock_p6)) {}\
virtual return_type Perform(const args_type& args) {\ virtual return_type Perform(const args_type& args) {\
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
Perform(this, args);\ Perform(this, args);\
@@ -1813,9 +1965,14 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
name##ActionP8(p0##_type gmock_p0, p1##_type gmock_p1, \ name##ActionP8(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
p5##_type gmock_p5, p6##_type gmock_p6, \ p5##_type gmock_p5, p6##_type gmock_p6, \
p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p7##_type gmock_p7) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p7(gmock_p7) {}\ p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
p6(::testing::internal::forward<p6##_type>(gmock_p6)), \
p7(::testing::internal::forward<p7##_type>(gmock_p7)) {}\
template <typename F>\ template <typename F>\
class gmock_Impl : public ::testing::ActionInterface<F> {\ class gmock_Impl : public ::testing::ActionInterface<F> {\
public:\ public:\
@@ -1825,9 +1982,15 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
args_type;\ args_type;\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6, p7##_type gmock_p7) : p0(gmock_p0), \ p6##_type gmock_p6, \
p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), \ p7##_type gmock_p7) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p5(gmock_p5), p6(gmock_p6), p7(gmock_p7) {}\ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
p6(::testing::internal::forward<p6##_type>(gmock_p6)), \
p7(::testing::internal::forward<p7##_type>(gmock_p7)) {}\
virtual return_type Perform(const args_type& args) {\ virtual return_type Perform(const args_type& args) {\
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
Perform(this, args);\ Perform(this, args);\
@@ -1900,9 +2063,15 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
name##ActionP9(p0##_type gmock_p0, p1##_type gmock_p1, \ name##ActionP9(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \ p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p8##_type gmock_p8) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p8(gmock_p8) {}\ p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
p6(::testing::internal::forward<p6##_type>(gmock_p6)), \
p7(::testing::internal::forward<p7##_type>(gmock_p7)), \
p8(::testing::internal::forward<p8##_type>(gmock_p8)) {}\
template <typename F>\ template <typename F>\
class gmock_Impl : public ::testing::ActionInterface<F> {\ class gmock_Impl : public ::testing::ActionInterface<F> {\
public:\ public:\
@@ -1913,9 +2082,15 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6, p7##_type gmock_p7, \ p6##_type gmock_p6, p7##_type gmock_p7, \
p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p8##_type gmock_p8) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p7(gmock_p7), p8(gmock_p8) {}\ p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
p6(::testing::internal::forward<p6##_type>(gmock_p6)), \
p7(::testing::internal::forward<p7##_type>(gmock_p7)), \
p8(::testing::internal::forward<p8##_type>(gmock_p8)) {}\
virtual return_type Perform(const args_type& args) {\ virtual return_type Perform(const args_type& args) {\
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
Perform(this, args);\ Perform(this, args);\
@@ -1992,9 +2167,17 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
name##ActionP10(p0##_type gmock_p0, p1##_type gmock_p1, \ name##ActionP10(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \ p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
p8##_type gmock_p8, p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), \ p8##_type gmock_p8, \
p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ p9##_type gmock_p9) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {}\ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
p6(::testing::internal::forward<p6##_type>(gmock_p6)), \
p7(::testing::internal::forward<p7##_type>(gmock_p7)), \
p8(::testing::internal::forward<p8##_type>(gmock_p8)), \
p9(::testing::internal::forward<p9##_type>(gmock_p9)) {}\
template <typename F>\ template <typename F>\
class gmock_Impl : public ::testing::ActionInterface<F> {\ class gmock_Impl : public ::testing::ActionInterface<F> {\
public:\ public:\
@@ -2005,9 +2188,16 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \ p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \
p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p9##_type gmock_p9) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {}\ p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
p6(::testing::internal::forward<p6##_type>(gmock_p6)), \
p7(::testing::internal::forward<p7##_type>(gmock_p7)), \
p8(::testing::internal::forward<p8##_type>(gmock_p8)), \
p9(::testing::internal::forward<p9##_type>(gmock_p9)) {}\
virtual return_type Perform(const args_type& args) {\ virtual return_type Perform(const args_type& args) {\
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
Perform(this, args);\ Perform(this, args);\
@@ -2369,7 +2559,7 @@ ACTION_TEMPLATE(ReturnNew,
} // namespace testing } // namespace testing
// Include any custom actions added by the local installation. // Include any custom callback actions added by the local installation.
// We must include this header at the end to make sure it can use the // We must include this header at the end to make sure it can use the
// declarations from this file. // declarations from this file.
#include "gmock/internal/custom/gmock-generated-actions.h" #include "gmock/internal/custom/gmock-generated-actions.h"

View File

@@ -32,13 +32,14 @@ $$}} This meta comment fixes auto-indentation in editors.
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Google Mock - a framework for writing C++ mock classes. // Google Mock - a framework for writing C++ mock classes.
// //
// This file implements some commonly used variadic actions. // This file implements some commonly used variadic actions.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_
@@ -49,12 +50,13 @@ namespace testing {
namespace internal { namespace internal {
// InvokeHelper<F> knows how to unpack an N-tuple and invoke an N-ary // InvokeHelper<F> knows how to unpack an N-tuple and invoke an N-ary
// function or method with the unpacked values, where F is a function // function, method, or callback with the unpacked values, where F is
// type that takes N arguments. // a function type that takes N arguments.
template <typename Result, typename ArgumentTuple> template <typename Result, typename ArgumentTuple>
class InvokeHelper; class InvokeHelper;
$var max_callback_arity = 5
$range i 0..n $range i 0..n
$for i [[ $for i [[
$range j 1..i $range j 1..i
@@ -76,10 +78,47 @@ class InvokeHelper<R, ::testing::tuple<$as> > {
const ::testing::tuple<$as>&$args) { const ::testing::tuple<$as>&$args) {
return (obj_ptr->*method_ptr)($gets); return (obj_ptr->*method_ptr)($gets);
} }
$if i <= max_callback_arity [[
template <typename CallbackType>
static R InvokeCallback(CallbackType* callback,
const ::testing::tuple<$as>&$args) {
return callback->Run($gets);
}
]] $else [[
// There is no InvokeCallback() for $i-tuples
]]
}; };
]] ]]
// Implements the Invoke(callback) action.
template <typename CallbackType>
class InvokeCallbackAction {
public:
// The c'tor takes ownership of the callback.
explicit InvokeCallbackAction(CallbackType* callback)
: callback_(callback) {
callback->CheckIsRepeatable(); // Makes sure the callback is permanent.
}
// This type conversion operator template allows Invoke(callback) to
// be used wherever the callback's type is compatible with that of
// the mock function, i.e. if the mock function's arguments can be
// implicitly converted to the callback's arguments and the
// callback's result can be implicitly converted to the mock
// function's result.
template <typename Result, typename ArgumentTuple>
Result Perform(const ArgumentTuple& args) const {
return InvokeHelper<Result, ArgumentTuple>::InvokeCallback(
callback_.get(), args);
}
private:
const linked_ptr<CallbackType> callback_;
};
// An INTERNAL macro for extracting the type of a tuple field. It's // An INTERNAL macro for extracting the type of a tuple field. It's
// subject to change without notice - DO NOT USE IN USER CODE! // subject to change without notice - DO NOT USE IN USER CODE!
#define GMOCK_FIELD_(Tuple, N) \ #define GMOCK_FIELD_(Tuple, N) \
@@ -357,7 +396,7 @@ $range j2 2..i
// MORE INFORMATION: // MORE INFORMATION:
// //
// To learn more about using these macros, please search for 'ACTION' // To learn more about using these macros, please search for 'ACTION'
// on http://code.google.com/p/googlemock/wiki/CookBook. // on https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md
$range i 0..n $range i 0..n
$range k 0..n-1 $range k 0..n-1
@@ -486,7 +525,7 @@ _VALUE_PARAMS($for j, [[p$j]]) $for j [[, typename p$j##_type]]
$for i [[ $for i [[
$range j 0..i-1 $range j 0..i-1
#define GMOCK_INTERNAL_INIT_AND_$i[[]]_VALUE_PARAMS($for j, [[p$j]])\ #define GMOCK_INTERNAL_INIT_AND_$i[[]]_VALUE_PARAMS($for j, [[p$j]])\
($for j, [[p$j##_type gmock_p$j]])$if i>0 [[ : ]]$for j, [[p$j(gmock_p$j)]] ($for j, [[p$j##_type gmock_p$j]])$if i>0 [[ : ]]$for j, [[p$j(::testing::internal::move(gmock_p$j))]]
]] ]]
@@ -619,7 +658,7 @@ $var class_name = [[name##Action[[$if i==0 [[]] $elif i==1 [[P]]
$range j 0..i-1 $range j 0..i-1
$var ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]] $var ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]]
$var param_types_and_names = [[$for j, [[p$j##_type p$j]]]] $var param_types_and_names = [[$for j, [[p$j##_type p$j]]]]
$var inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(gmock_p$j)]]]]]] $var inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(::testing::internal::forward<p$j##_type>(gmock_p$j))]]]]]]
$var param_field_decls = [[$for j $var param_field_decls = [[$for j
[[ [[

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
$$ -*- mode: c++; -*- $$ -*- mode: c++; -*-
$$ This is a Pump source file. Please use Pump to convert it to $$ This is a Pump source file. Please use Pump to convert
$$ gmock-generated-function-mockers.h. $$ it to gmock-generated-function-mockers.h.
$$ $$
$var n = 10 $$ The maximum arity we support. $var n = 10 $$ The maximum arity we support.
// Copyright 2007, Google Inc. // Copyright 2007, Google Inc.
@@ -31,13 +31,14 @@ $var n = 10 $$ The maximum arity we support.
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Google Mock - a framework for writing C++ mock classes. // Google Mock - a framework for writing C++ mock classes.
// //
// This file implements function mockers of various arities. // This file implements function mockers of various arities.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_ #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
@@ -68,7 +69,7 @@ $for i [[
$range j 1..i $range j 1..i
$var typename_As = [[$for j [[, typename A$j]]]] $var typename_As = [[$for j [[, typename A$j]]]]
$var As = [[$for j, [[A$j]]]] $var As = [[$for j, [[A$j]]]]
$var as = [[$for j, [[a$j]]]] $var as = [[$for j, [[internal::forward<A$j>(a$j)]]]]
$var Aas = [[$for j, [[A$j a$j]]]] $var Aas = [[$for j, [[A$j a$j]]]]
$var ms = [[$for j, [[m$j]]]] $var ms = [[$for j, [[m$j]]]]
$var matchers = [[$for j, [[const Matcher<A$j>& m$j]]]] $var matchers = [[$for j, [[const Matcher<A$j>& m$j]]]]
@@ -79,13 +80,8 @@ class FunctionMocker<R($As)> : public
typedef R F($As); typedef R F($As);
typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
MockSpec<F>& With($matchers) { MockSpec<F> With($matchers) {
return MockSpec<F>(this, ::testing::make_tuple($ms));
$if i >= 1 [[
this->current_spec().SetMatchers(::testing::make_tuple($ms));
]]
return this->current_spec();
} }
R Invoke($Aas) { R Invoke($Aas) {
@@ -99,6 +95,58 @@ $if i >= 1 [[
]] ]]
// Removes the given pointer; this is a helper for the expectation setter method
// for parameterless matchers.
//
// We want to make sure that the user cannot set a parameterless expectation on
// overloaded methods, including methods which are overloaded on const. Example:
//
// class MockClass {
// MOCK_METHOD0(GetName, string&());
// MOCK_CONST_METHOD0(GetName, const string&());
// };
//
// TEST() {
// // This should be an error, as it's not clear which overload is expected.
// EXPECT_CALL(mock, GetName).WillOnce(ReturnRef(value));
// }
//
// Here are the generated expectation-setter methods:
//
// class MockClass {
// // Overload 1
// MockSpec<string&()> gmock_GetName() { ... }
// // Overload 2. Declared const so that the compiler will generate an
// // error when trying to resolve between this and overload 4 in
// // 'gmock_GetName(WithoutMatchers(), nullptr)'.
// MockSpec<string&()> gmock_GetName(
// const WithoutMatchers&, const Function<string&()>*) const {
// // Removes const from this, calls overload 1
// return AdjustConstness_(this)->gmock_GetName();
// }
//
// // Overload 3
// const string& gmock_GetName() const { ... }
// // Overload 4
// MockSpec<const string&()> gmock_GetName(
// const WithoutMatchers&, const Function<const string&()>*) const {
// // Does not remove const, calls overload 3
// return AdjustConstness_const(this)->gmock_GetName();
// }
// }
//
template <typename MockType>
const MockType* AdjustConstness_const(const MockType* mock) {
return mock;
}
// Removes const from and returns the given pointer; this is a helper for the
// expectation setter method for parameterless matchers.
template <typename MockType>
MockType* AdjustConstness_(const MockType* mock) {
return const_cast<MockType*>(mock);
}
} // namespace internal } // namespace internal
// The style guide prohibits "using" statements in a namespace scope // The style guide prohibits "using" statements in a namespace scope
@@ -134,11 +182,14 @@ using internal::FunctionMocker;
$for i [[ $for i [[
$range j 1..i $range j 1..i
$var arg_as = [[$for j, \ $var arg_as = [[$for j, [[GMOCK_ARG_(tn, $j, __VA_ARGS__) gmock_a$j]]]]
[[GMOCK_ARG_(tn, $j, __VA_ARGS__) gmock_a$j]]]] $var as = [[$for j, \
$var as = [[$for j, [[gmock_a$j]]]] [[::testing::internal::forward<GMOCK_ARG_(tn, $j, __VA_ARGS__)>(gmock_a$j)]]]]
$var matcher_as = [[$for j, \ $var matcher_arg_as = [[$for j, \
[[GMOCK_MATCHER_(tn, $j, __VA_ARGS__) gmock_a$j]]]] [[GMOCK_MATCHER_(tn, $j, __VA_ARGS__) gmock_a$j]]]]
$var matcher_as = [[$for j, [[gmock_a$j]]]]
$var anything_matchers = [[$for j, \
[[::testing::A<GMOCK_ARG_(tn, $j, __VA_ARGS__)>()]]]]
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD$i[[]]_(tn, constness, ct, Method, ...) \ #define GMOCK_METHOD$i[[]]_(tn, constness, ct, Method, ...) \
GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
@@ -149,10 +200,16 @@ $var matcher_as = [[$for j, \
GMOCK_MOCKER_($i, constness, Method).SetOwnerAndName(this, #Method); \ GMOCK_MOCKER_($i, constness, Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_($i, constness, Method).Invoke($as); \ return GMOCK_MOCKER_($i, constness, Method).Invoke($as); \
} \ } \
::testing::MockSpec<__VA_ARGS__>& \ ::testing::MockSpec<__VA_ARGS__> \
gmock_##Method($matcher_as) constness { \ gmock_##Method($matcher_arg_as) constness { \
GMOCK_MOCKER_($i, constness, Method).RegisterOwner(this); \ GMOCK_MOCKER_($i, constness, Method).RegisterOwner(this); \
return GMOCK_MOCKER_($i, constness, Method).With($as); \ return GMOCK_MOCKER_($i, constness, Method).With($matcher_as); \
} \
::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
const ::testing::internal::WithoutMatchers&, \
constness ::testing::internal::Function<__VA_ARGS__>* ) const { \
return ::testing::internal::AdjustConstness_##constness(this)-> \
gmock_##Method($anything_matchers); \
} \ } \
mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_($i, constness, Method) mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_($i, constness, Method)
@@ -263,7 +320,7 @@ class MockFunction;
$for i [[ $for i [[
$range j 0..i-1 $range j 0..i-1
$var ArgTypes = [[$for j, [[A$j]]]] $var ArgTypes = [[$for j, [[A$j]]]]
$var ArgNames = [[$for j, [[a$j]]]] $var ArgValues = [[$for j, [[::std::move(a$j)]]]]
$var ArgDecls = [[$for j, [[A$j a$j]]]] $var ArgDecls = [[$for j, [[A$j a$j]]]]
template <typename R$for j [[, typename A$j]]> template <typename R$for j [[, typename A$j]]>
class MockFunction<R($ArgTypes)> { class MockFunction<R($ArgTypes)> {
@@ -273,9 +330,9 @@ class MockFunction<R($ArgTypes)> {
MOCK_METHOD$i[[]]_T(Call, R($ArgTypes)); MOCK_METHOD$i[[]]_T(Call, R($ArgTypes));
#if GTEST_HAS_STD_FUNCTION_ #if GTEST_HAS_STD_FUNCTION_
std::function<R($ArgTypes)> AsStdFunction() { ::std::function<R($ArgTypes)> AsStdFunction() {
return [this]($ArgDecls) -> R { return [this]($ArgDecls) -> R {
return this->Call($ArgNames); return this->Call($ArgValues);
}; };
} }
#endif // GTEST_HAS_STD_FUNCTION_ #endif // GTEST_HAS_STD_FUNCTION_

View File

@@ -35,6 +35,8 @@
// //
// This file implements some commonly used variadic matchers. // This file implements some commonly used variadic matchers.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_
@@ -779,6 +781,9 @@ ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4,
// UnorderedElementsAre(e_1, e_2, ..., e_n) is an ElementsAre extension // UnorderedElementsAre(e_1, e_2, ..., e_n) is an ElementsAre extension
// that matches n elements in any order. We support up to n=10 arguments. // that matches n elements in any order. We support up to n=10 arguments.
//
// If you have >10 elements, consider UnorderedElementsAreArray() or
// UnorderedPointwise() instead.
inline internal::UnorderedElementsAreMatcher< inline internal::UnorderedElementsAreMatcher<
::testing::tuple<> > ::testing::tuple<> >
@@ -1268,7 +1273,7 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
// using testing::PrintToString; // using testing::PrintToString;
// //
// MATCHER_P2(InClosedRange, low, hi, // MATCHER_P2(InClosedRange, low, hi,
// string(negation ? "is not" : "is") + " in range [" + // std::string(negation ? "is not" : "is") + " in range [" +
// PrintToString(low) + ", " + PrintToString(hi) + "]") { // PrintToString(low) + ", " + PrintToString(hi) + "]") {
// return low <= arg && arg <= hi; // return low <= arg && arg <= hi;
// } // }
@@ -1376,18 +1381,21 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
// ================ // ================
// //
// To learn more about using these macros, please search for 'MATCHER' // To learn more about using these macros, please search for 'MATCHER'
// on http://code.google.com/p/googlemock/wiki/CookBook. // on
// https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md
#define MATCHER(name, description)\ #define MATCHER(name, description)\
class name##Matcher {\ class name##Matcher {\
public:\ public:\
template <typename arg_type>\ template <typename arg_type>\
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ class gmock_Impl : public ::testing::MatcherInterface<\
GTEST_REFERENCE_TO_CONST_(arg_type)> {\
public:\ public:\
gmock_Impl()\ gmock_Impl()\
{}\ {}\
virtual bool MatchAndExplain(\ virtual bool MatchAndExplain(\
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
virtual void DescribeTo(::std::ostream* gmock_os) const {\ virtual void DescribeTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(false);\ *gmock_os << FormatDescription(false);\
}\ }\
@@ -1395,8 +1403,8 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
*gmock_os << FormatDescription(true);\ *gmock_os << FormatDescription(true);\
}\ }\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::std::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\ ::std::string gmock_description = (description);\
if (!gmock_description.empty())\ if (!gmock_description.empty())\
return gmock_description;\ return gmock_description;\
return ::testing::internal::FormatMatcherDescription(\ return ::testing::internal::FormatMatcherDescription(\
@@ -1404,7 +1412,6 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
::testing::tuple<>()));\ ::testing::tuple<>()));\
}\ }\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
};\ };\
template <typename arg_type>\ template <typename arg_type>\
operator ::testing::Matcher<arg_type>() const {\ operator ::testing::Matcher<arg_type>() const {\
@@ -1414,14 +1421,13 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
name##Matcher() {\ name##Matcher() {\
}\ }\
private:\ private:\
GTEST_DISALLOW_ASSIGN_(name##Matcher);\
};\ };\
inline name##Matcher name() {\ inline name##Matcher name() {\
return name##Matcher();\ return name##Matcher();\
}\ }\
template <typename arg_type>\ template <typename arg_type>\
bool name##Matcher::gmock_Impl<arg_type>::MatchAndExplain(\ bool name##Matcher::gmock_Impl<arg_type>::MatchAndExplain(\
arg_type arg, \ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
const const
@@ -1430,22 +1436,24 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
class name##MatcherP {\ class name##MatcherP {\
public:\ public:\
template <typename arg_type>\ template <typename arg_type>\
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ class gmock_Impl : public ::testing::MatcherInterface<\
GTEST_REFERENCE_TO_CONST_(arg_type)> {\
public:\ public:\
explicit gmock_Impl(p0##_type gmock_p0)\ explicit gmock_Impl(p0##_type gmock_p0)\
: p0(gmock_p0) {}\ : p0(::testing::internal::move(gmock_p0)) {}\
virtual bool MatchAndExplain(\ virtual bool MatchAndExplain(\
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
virtual void DescribeTo(::std::ostream* gmock_os) const {\ virtual void DescribeTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(false);\ *gmock_os << FormatDescription(false);\
}\ }\
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(true);\ *gmock_os << FormatDescription(true);\
}\ }\
p0##_type p0;\ p0##_type const p0;\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::std::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\ ::std::string gmock_description = (description);\
if (!gmock_description.empty())\ if (!gmock_description.empty())\
return gmock_description;\ return gmock_description;\
return ::testing::internal::FormatMatcherDescription(\ return ::testing::internal::FormatMatcherDescription(\
@@ -1453,18 +1461,17 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
::testing::tuple<p0##_type>(p0)));\ ::testing::tuple<p0##_type>(p0)));\
}\ }\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
};\ };\
template <typename arg_type>\ template <typename arg_type>\
operator ::testing::Matcher<arg_type>() const {\ operator ::testing::Matcher<arg_type>() const {\
return ::testing::Matcher<arg_type>(\ return ::testing::Matcher<arg_type>(\
new gmock_Impl<arg_type>(p0));\ new gmock_Impl<arg_type>(p0));\
}\ }\
explicit name##MatcherP(p0##_type gmock_p0) : p0(gmock_p0) {\ explicit name##MatcherP(p0##_type gmock_p0) : \
p0(::testing::internal::move(gmock_p0)) {\
}\ }\
p0##_type p0;\ p0##_type const p0;\
private:\ private:\
GTEST_DISALLOW_ASSIGN_(name##MatcherP);\
};\ };\
template <typename p0##_type>\ template <typename p0##_type>\
inline name##MatcherP<p0##_type> name(p0##_type p0) {\ inline name##MatcherP<p0##_type> name(p0##_type p0) {\
@@ -1473,7 +1480,7 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
template <typename p0##_type>\ template <typename p0##_type>\
template <typename arg_type>\ template <typename arg_type>\
bool name##MatcherP<p0##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ bool name##MatcherP<p0##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
arg_type arg, \ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
const const
@@ -1482,23 +1489,26 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
class name##MatcherP2 {\ class name##MatcherP2 {\
public:\ public:\
template <typename arg_type>\ template <typename arg_type>\
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ class gmock_Impl : public ::testing::MatcherInterface<\
GTEST_REFERENCE_TO_CONST_(arg_type)> {\
public:\ public:\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1)\ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1)\
: p0(gmock_p0), p1(gmock_p1) {}\ : p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)) {}\
virtual bool MatchAndExplain(\ virtual bool MatchAndExplain(\
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
virtual void DescribeTo(::std::ostream* gmock_os) const {\ virtual void DescribeTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(false);\ *gmock_os << FormatDescription(false);\
}\ }\
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(true);\ *gmock_os << FormatDescription(true);\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::std::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\ ::std::string gmock_description = (description);\
if (!gmock_description.empty())\ if (!gmock_description.empty())\
return gmock_description;\ return gmock_description;\
return ::testing::internal::FormatMatcherDescription(\ return ::testing::internal::FormatMatcherDescription(\
@@ -1506,20 +1516,19 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
::testing::tuple<p0##_type, p1##_type>(p0, p1)));\ ::testing::tuple<p0##_type, p1##_type>(p0, p1)));\
}\ }\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
};\ };\
template <typename arg_type>\ template <typename arg_type>\
operator ::testing::Matcher<arg_type>() const {\ operator ::testing::Matcher<arg_type>() const {\
return ::testing::Matcher<arg_type>(\ return ::testing::Matcher<arg_type>(\
new gmock_Impl<arg_type>(p0, p1));\ new gmock_Impl<arg_type>(p0, p1));\
}\ }\
name##MatcherP2(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \ name##MatcherP2(p0##_type gmock_p0, \
p1(gmock_p1) {\ p1##_type gmock_p1) : p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)) {\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
private:\ private:\
GTEST_DISALLOW_ASSIGN_(name##MatcherP2);\
};\ };\
template <typename p0##_type, typename p1##_type>\ template <typename p0##_type, typename p1##_type>\
inline name##MatcherP2<p0##_type, p1##_type> name(p0##_type p0, \ inline name##MatcherP2<p0##_type, p1##_type> name(p0##_type p0, \
@@ -1530,7 +1539,7 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
template <typename arg_type>\ template <typename arg_type>\
bool name##MatcherP2<p0##_type, \ bool name##MatcherP2<p0##_type, \
p1##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ p1##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
arg_type arg, \ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
const const
@@ -1539,24 +1548,28 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
class name##MatcherP3 {\ class name##MatcherP3 {\
public:\ public:\
template <typename arg_type>\ template <typename arg_type>\
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ class gmock_Impl : public ::testing::MatcherInterface<\
GTEST_REFERENCE_TO_CONST_(arg_type)> {\
public:\ public:\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2)\ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2)\
: p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\ : p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)) {}\
virtual bool MatchAndExplain(\ virtual bool MatchAndExplain(\
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
virtual void DescribeTo(::std::ostream* gmock_os) const {\ virtual void DescribeTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(false);\ *gmock_os << FormatDescription(false);\
}\ }\
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(true);\ *gmock_os << FormatDescription(true);\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
p2##_type p2;\ p2##_type const p2;\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::std::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\ ::std::string gmock_description = (description);\
if (!gmock_description.empty())\ if (!gmock_description.empty())\
return gmock_description;\ return gmock_description;\
return ::testing::internal::FormatMatcherDescription(\ return ::testing::internal::FormatMatcherDescription(\
@@ -1565,7 +1578,6 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
::testing::tuple<p0##_type, p1##_type, p2##_type>(p0, p1, \ ::testing::tuple<p0##_type, p1##_type, p2##_type>(p0, p1, \
p2)));\ p2)));\
}\ }\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
};\ };\
template <typename arg_type>\ template <typename arg_type>\
operator ::testing::Matcher<arg_type>() const {\ operator ::testing::Matcher<arg_type>() const {\
@@ -1573,13 +1585,14 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
new gmock_Impl<arg_type>(p0, p1, p2));\ new gmock_Impl<arg_type>(p0, p1, p2));\
}\ }\
name##MatcherP3(p0##_type gmock_p0, p1##_type gmock_p1, \ name##MatcherP3(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {\ p2##_type gmock_p2) : p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)) {\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
p2##_type p2;\ p2##_type const p2;\
private:\ private:\
GTEST_DISALLOW_ASSIGN_(name##MatcherP3);\
};\ };\
template <typename p0##_type, typename p1##_type, typename p2##_type>\ template <typename p0##_type, typename p1##_type, typename p2##_type>\
inline name##MatcherP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \ inline name##MatcherP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \
@@ -1590,7 +1603,7 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
template <typename arg_type>\ template <typename arg_type>\
bool name##MatcherP3<p0##_type, p1##_type, \ bool name##MatcherP3<p0##_type, p1##_type, \
p2##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ p2##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
arg_type arg, \ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
const const
@@ -1600,26 +1613,31 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
class name##MatcherP4 {\ class name##MatcherP4 {\
public:\ public:\
template <typename arg_type>\ template <typename arg_type>\
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ class gmock_Impl : public ::testing::MatcherInterface<\
GTEST_REFERENCE_TO_CONST_(arg_type)> {\
public:\ public:\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3)\ p3##_type gmock_p3)\
: p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3) {}\ : p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)) {}\
virtual bool MatchAndExplain(\ virtual bool MatchAndExplain(\
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
virtual void DescribeTo(::std::ostream* gmock_os) const {\ virtual void DescribeTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(false);\ *gmock_os << FormatDescription(false);\
}\ }\
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(true);\ *gmock_os << FormatDescription(true);\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
p2##_type p2;\ p2##_type const p2;\
p3##_type p3;\ p3##_type const p3;\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::std::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\ ::std::string gmock_description = (description);\
if (!gmock_description.empty())\ if (!gmock_description.empty())\
return gmock_description;\ return gmock_description;\
return ::testing::internal::FormatMatcherDescription(\ return ::testing::internal::FormatMatcherDescription(\
@@ -1628,7 +1646,6 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
::testing::tuple<p0##_type, p1##_type, p2##_type, \ ::testing::tuple<p0##_type, p1##_type, p2##_type, \
p3##_type>(p0, p1, p2, p3)));\ p3##_type>(p0, p1, p2, p3)));\
}\ }\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
};\ };\
template <typename arg_type>\ template <typename arg_type>\
operator ::testing::Matcher<arg_type>() const {\ operator ::testing::Matcher<arg_type>() const {\
@@ -1636,15 +1653,17 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
new gmock_Impl<arg_type>(p0, p1, p2, p3));\ new gmock_Impl<arg_type>(p0, p1, p2, p3));\
}\ }\
name##MatcherP4(p0##_type gmock_p0, p1##_type gmock_p1, \ name##MatcherP4(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), \ p2##_type gmock_p2, \
p2(gmock_p2), p3(gmock_p3) {\ p3##_type gmock_p3) : p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)) {\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
p2##_type p2;\ p2##_type const p2;\
p3##_type p3;\ p3##_type const p3;\
private:\ private:\
GTEST_DISALLOW_ASSIGN_(name##MatcherP4);\
};\ };\
template <typename p0##_type, typename p1##_type, typename p2##_type, \ template <typename p0##_type, typename p1##_type, typename p2##_type, \
typename p3##_type>\ typename p3##_type>\
@@ -1659,7 +1678,7 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
template <typename arg_type>\ template <typename arg_type>\
bool name##MatcherP4<p0##_type, p1##_type, p2##_type, \ bool name##MatcherP4<p0##_type, p1##_type, p2##_type, \
p3##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ p3##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
arg_type arg, \ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
const const
@@ -1669,28 +1688,33 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
class name##MatcherP5 {\ class name##MatcherP5 {\
public:\ public:\
template <typename arg_type>\ template <typename arg_type>\
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ class gmock_Impl : public ::testing::MatcherInterface<\
GTEST_REFERENCE_TO_CONST_(arg_type)> {\
public:\ public:\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4)\ p3##_type gmock_p3, p4##_type gmock_p4)\
: p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ : p0(::testing::internal::move(gmock_p0)), \
p4(gmock_p4) {}\ p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)) {}\
virtual bool MatchAndExplain(\ virtual bool MatchAndExplain(\
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
virtual void DescribeTo(::std::ostream* gmock_os) const {\ virtual void DescribeTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(false);\ *gmock_os << FormatDescription(false);\
}\ }\
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(true);\ *gmock_os << FormatDescription(true);\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
p2##_type p2;\ p2##_type const p2;\
p3##_type p3;\ p3##_type const p3;\
p4##_type p4;\ p4##_type const p4;\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::std::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\ ::std::string gmock_description = (description);\
if (!gmock_description.empty())\ if (!gmock_description.empty())\
return gmock_description;\ return gmock_description;\
return ::testing::internal::FormatMatcherDescription(\ return ::testing::internal::FormatMatcherDescription(\
@@ -1699,7 +1723,6 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
::testing::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ ::testing::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
p4##_type>(p0, p1, p2, p3, p4)));\ p4##_type>(p0, p1, p2, p3, p4)));\
}\ }\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
};\ };\
template <typename arg_type>\ template <typename arg_type>\
operator ::testing::Matcher<arg_type>() const {\ operator ::testing::Matcher<arg_type>() const {\
@@ -1708,16 +1731,18 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
}\ }\
name##MatcherP5(p0##_type gmock_p0, p1##_type gmock_p1, \ name##MatcherP5(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, \ p2##_type gmock_p2, p3##_type gmock_p3, \
p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p4##_type gmock_p4) : p0(::testing::internal::move(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4) {\ p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)) {\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
p2##_type p2;\ p2##_type const p2;\
p3##_type p3;\ p3##_type const p3;\
p4##_type p4;\ p4##_type const p4;\
private:\ private:\
GTEST_DISALLOW_ASSIGN_(name##MatcherP5);\
};\ };\
template <typename p0##_type, typename p1##_type, typename p2##_type, \ template <typename p0##_type, typename p1##_type, typename p2##_type, \
typename p3##_type, typename p4##_type>\ typename p3##_type, typename p4##_type>\
@@ -1732,7 +1757,7 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
template <typename arg_type>\ template <typename arg_type>\
bool name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, \ bool name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, \
p4##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ p4##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
arg_type arg, \ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
const const
@@ -1742,29 +1767,35 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
class name##MatcherP6 {\ class name##MatcherP6 {\
public:\ public:\
template <typename arg_type>\ template <typename arg_type>\
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ class gmock_Impl : public ::testing::MatcherInterface<\
GTEST_REFERENCE_TO_CONST_(arg_type)> {\
public:\ public:\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5)\ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5)\
: p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ : p0(::testing::internal::move(gmock_p0)), \
p4(gmock_p4), p5(gmock_p5) {}\ p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)) {}\
virtual bool MatchAndExplain(\ virtual bool MatchAndExplain(\
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
virtual void DescribeTo(::std::ostream* gmock_os) const {\ virtual void DescribeTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(false);\ *gmock_os << FormatDescription(false);\
}\ }\
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(true);\ *gmock_os << FormatDescription(true);\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
p2##_type p2;\ p2##_type const p2;\
p3##_type p3;\ p3##_type const p3;\
p4##_type p4;\ p4##_type const p4;\
p5##_type p5;\ p5##_type const p5;\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::std::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\ ::std::string gmock_description = (description);\
if (!gmock_description.empty())\ if (!gmock_description.empty())\
return gmock_description;\ return gmock_description;\
return ::testing::internal::FormatMatcherDescription(\ return ::testing::internal::FormatMatcherDescription(\
@@ -1773,7 +1804,6 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
::testing::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ ::testing::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5)));\ p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5)));\
}\ }\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
};\ };\
template <typename arg_type>\ template <typename arg_type>\
operator ::testing::Matcher<arg_type>() const {\ operator ::testing::Matcher<arg_type>() const {\
@@ -1782,17 +1812,20 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
}\ }\
name##MatcherP6(p0##_type gmock_p0, p1##_type gmock_p1, \ name##MatcherP6(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p5##_type gmock_p5) : p0(::testing::internal::move(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {\ p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)) {\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
p2##_type p2;\ p2##_type const p2;\
p3##_type p3;\ p3##_type const p3;\
p4##_type p4;\ p4##_type const p4;\
p5##_type p5;\ p5##_type const p5;\
private:\ private:\
GTEST_DISALLOW_ASSIGN_(name##MatcherP6);\
};\ };\
template <typename p0##_type, typename p1##_type, typename p2##_type, \ template <typename p0##_type, typename p1##_type, typename p2##_type, \
typename p3##_type, typename p4##_type, typename p5##_type>\ typename p3##_type, typename p4##_type, typename p5##_type>\
@@ -1807,7 +1840,7 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
template <typename arg_type>\ template <typename arg_type>\
bool name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ bool name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
p5##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ p5##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
arg_type arg, \ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
const const
@@ -1818,31 +1851,38 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
class name##MatcherP7 {\ class name##MatcherP7 {\
public:\ public:\
template <typename arg_type>\ template <typename arg_type>\
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ class gmock_Impl : public ::testing::MatcherInterface<\
GTEST_REFERENCE_TO_CONST_(arg_type)> {\
public:\ public:\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6)\ p6##_type gmock_p6)\
: p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ : p0(::testing::internal::move(gmock_p0)), \
p4(gmock_p4), p5(gmock_p5), p6(gmock_p6) {}\ p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)) {}\
virtual bool MatchAndExplain(\ virtual bool MatchAndExplain(\
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
virtual void DescribeTo(::std::ostream* gmock_os) const {\ virtual void DescribeTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(false);\ *gmock_os << FormatDescription(false);\
}\ }\
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(true);\ *gmock_os << FormatDescription(true);\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
p2##_type p2;\ p2##_type const p2;\
p3##_type p3;\ p3##_type const p3;\
p4##_type p4;\ p4##_type const p4;\
p5##_type p5;\ p5##_type const p5;\
p6##_type p6;\ p6##_type const p6;\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::std::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\ ::std::string gmock_description = (description);\
if (!gmock_description.empty())\ if (!gmock_description.empty())\
return gmock_description;\ return gmock_description;\
return ::testing::internal::FormatMatcherDescription(\ return ::testing::internal::FormatMatcherDescription(\
@@ -1852,7 +1892,6 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, \ p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, \
p6)));\ p6)));\
}\ }\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
};\ };\
template <typename arg_type>\ template <typename arg_type>\
operator ::testing::Matcher<arg_type>() const {\ operator ::testing::Matcher<arg_type>() const {\
@@ -1861,19 +1900,23 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
}\ }\
name##MatcherP7(p0##_type gmock_p0, p1##_type gmock_p1, \ name##MatcherP7(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
p5##_type gmock_p5, p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), \ p5##_type gmock_p5, \
p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), \ p6##_type gmock_p6) : p0(::testing::internal::move(gmock_p0)), \
p6(gmock_p6) {\ p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)) {\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
p2##_type p2;\ p2##_type const p2;\
p3##_type p3;\ p3##_type const p3;\
p4##_type p4;\ p4##_type const p4;\
p5##_type p5;\ p5##_type const p5;\
p6##_type p6;\ p6##_type const p6;\
private:\ private:\
GTEST_DISALLOW_ASSIGN_(name##MatcherP7);\
};\ };\
template <typename p0##_type, typename p1##_type, typename p2##_type, \ template <typename p0##_type, typename p1##_type, typename p2##_type, \
typename p3##_type, typename p4##_type, typename p5##_type, \ typename p3##_type, typename p4##_type, typename p5##_type, \
@@ -1891,7 +1934,7 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
template <typename arg_type>\ template <typename arg_type>\
bool name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ bool name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
p5##_type, p6##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ p5##_type, p6##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
arg_type arg, \ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
const const
@@ -1902,32 +1945,40 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
class name##MatcherP8 {\ class name##MatcherP8 {\
public:\ public:\
template <typename arg_type>\ template <typename arg_type>\
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ class gmock_Impl : public ::testing::MatcherInterface<\
GTEST_REFERENCE_TO_CONST_(arg_type)> {\
public:\ public:\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6, p7##_type gmock_p7)\ p6##_type gmock_p6, p7##_type gmock_p7)\
: p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ : p0(::testing::internal::move(gmock_p0)), \
p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7) {}\ p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)), \
p7(::testing::internal::move(gmock_p7)) {}\
virtual bool MatchAndExplain(\ virtual bool MatchAndExplain(\
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
virtual void DescribeTo(::std::ostream* gmock_os) const {\ virtual void DescribeTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(false);\ *gmock_os << FormatDescription(false);\
}\ }\
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(true);\ *gmock_os << FormatDescription(true);\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
p2##_type p2;\ p2##_type const p2;\
p3##_type p3;\ p3##_type const p3;\
p4##_type p4;\ p4##_type const p4;\
p5##_type p5;\ p5##_type const p5;\
p6##_type p6;\ p6##_type const p6;\
p7##_type p7;\ p7##_type const p7;\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::std::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\ ::std::string gmock_description = (description);\
if (!gmock_description.empty())\ if (!gmock_description.empty())\
return gmock_description;\ return gmock_description;\
return ::testing::internal::FormatMatcherDescription(\ return ::testing::internal::FormatMatcherDescription(\
@@ -1937,7 +1988,6 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, \ p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, \
p3, p4, p5, p6, p7)));\ p3, p4, p5, p6, p7)));\
}\ }\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
};\ };\
template <typename arg_type>\ template <typename arg_type>\
operator ::testing::Matcher<arg_type>() const {\ operator ::testing::Matcher<arg_type>() const {\
@@ -1947,20 +1997,24 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
name##MatcherP8(p0##_type gmock_p0, p1##_type gmock_p1, \ name##MatcherP8(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
p5##_type gmock_p5, p6##_type gmock_p6, \ p5##_type gmock_p5, p6##_type gmock_p6, \
p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p7##_type gmock_p7) : p0(::testing::internal::move(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ p1(::testing::internal::move(gmock_p1)), \
p7(gmock_p7) {\ p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)), \
p7(::testing::internal::move(gmock_p7)) {\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
p2##_type p2;\ p2##_type const p2;\
p3##_type p3;\ p3##_type const p3;\
p4##_type p4;\ p4##_type const p4;\
p5##_type p5;\ p5##_type const p5;\
p6##_type p6;\ p6##_type const p6;\
p7##_type p7;\ p7##_type const p7;\
private:\ private:\
GTEST_DISALLOW_ASSIGN_(name##MatcherP8);\
};\ };\
template <typename p0##_type, typename p1##_type, typename p2##_type, \ template <typename p0##_type, typename p1##_type, typename p2##_type, \
typename p3##_type, typename p4##_type, typename p5##_type, \ typename p3##_type, typename p4##_type, typename p5##_type, \
@@ -1980,7 +2034,7 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
bool name##MatcherP8<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ bool name##MatcherP8<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
p5##_type, p6##_type, \ p5##_type, p6##_type, \
p7##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ p7##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
arg_type arg, \ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
const const
@@ -1991,34 +2045,42 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
class name##MatcherP9 {\ class name##MatcherP9 {\
public:\ public:\
template <typename arg_type>\ template <typename arg_type>\
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ class gmock_Impl : public ::testing::MatcherInterface<\
GTEST_REFERENCE_TO_CONST_(arg_type)> {\
public:\ public:\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8)\ p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8)\
: p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ : p0(::testing::internal::move(gmock_p0)), \
p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ p1(::testing::internal::move(gmock_p1)), \
p8(gmock_p8) {}\ p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)), \
p7(::testing::internal::move(gmock_p7)), \
p8(::testing::internal::move(gmock_p8)) {}\
virtual bool MatchAndExplain(\ virtual bool MatchAndExplain(\
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
virtual void DescribeTo(::std::ostream* gmock_os) const {\ virtual void DescribeTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(false);\ *gmock_os << FormatDescription(false);\
}\ }\
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(true);\ *gmock_os << FormatDescription(true);\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
p2##_type p2;\ p2##_type const p2;\
p3##_type p3;\ p3##_type const p3;\
p4##_type p4;\ p4##_type const p4;\
p5##_type p5;\ p5##_type const p5;\
p6##_type p6;\ p6##_type const p6;\
p7##_type p7;\ p7##_type const p7;\
p8##_type p8;\ p8##_type const p8;\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::std::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\ ::std::string gmock_description = (description);\
if (!gmock_description.empty())\ if (!gmock_description.empty())\
return gmock_description;\ return gmock_description;\
return ::testing::internal::FormatMatcherDescription(\ return ::testing::internal::FormatMatcherDescription(\
@@ -2028,7 +2090,6 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
p4##_type, p5##_type, p6##_type, p7##_type, \ p4##_type, p5##_type, p6##_type, p7##_type, \
p8##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8)));\ p8##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8)));\
}\ }\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
};\ };\
template <typename arg_type>\ template <typename arg_type>\
operator ::testing::Matcher<arg_type>() const {\ operator ::testing::Matcher<arg_type>() const {\
@@ -2038,21 +2099,26 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
name##MatcherP9(p0##_type gmock_p0, p1##_type gmock_p1, \ name##MatcherP9(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \ p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p8##_type gmock_p8) : p0(::testing::internal::move(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ p1(::testing::internal::move(gmock_p1)), \
p8(gmock_p8) {\ p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)), \
p7(::testing::internal::move(gmock_p7)), \
p8(::testing::internal::move(gmock_p8)) {\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
p2##_type p2;\ p2##_type const p2;\
p3##_type p3;\ p3##_type const p3;\
p4##_type p4;\ p4##_type const p4;\
p5##_type p5;\ p5##_type const p5;\
p6##_type p6;\ p6##_type const p6;\
p7##_type p7;\ p7##_type const p7;\
p8##_type p8;\ p8##_type const p8;\
private:\ private:\
GTEST_DISALLOW_ASSIGN_(name##MatcherP9);\
};\ };\
template <typename p0##_type, typename p1##_type, typename p2##_type, \ template <typename p0##_type, typename p1##_type, typename p2##_type, \
typename p3##_type, typename p4##_type, typename p5##_type, \ typename p3##_type, typename p4##_type, typename p5##_type, \
@@ -2073,7 +2139,7 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
bool name##MatcherP9<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ bool name##MatcherP9<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
p5##_type, p6##_type, p7##_type, \ p5##_type, p6##_type, p7##_type, \
p8##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ p8##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
arg_type arg, \ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
const const
@@ -2085,36 +2151,45 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
class name##MatcherP10 {\ class name##MatcherP10 {\
public:\ public:\
template <typename arg_type>\ template <typename arg_type>\
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ class gmock_Impl : public ::testing::MatcherInterface<\
GTEST_REFERENCE_TO_CONST_(arg_type)> {\
public:\ public:\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \ p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \
p9##_type gmock_p9)\ p9##_type gmock_p9)\
: p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ : p0(::testing::internal::move(gmock_p0)), \
p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ p1(::testing::internal::move(gmock_p1)), \
p8(gmock_p8), p9(gmock_p9) {}\ p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)), \
p7(::testing::internal::move(gmock_p7)), \
p8(::testing::internal::move(gmock_p8)), \
p9(::testing::internal::move(gmock_p9)) {}\
virtual bool MatchAndExplain(\ virtual bool MatchAndExplain(\
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
virtual void DescribeTo(::std::ostream* gmock_os) const {\ virtual void DescribeTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(false);\ *gmock_os << FormatDescription(false);\
}\ }\
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(true);\ *gmock_os << FormatDescription(true);\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
p2##_type p2;\ p2##_type const p2;\
p3##_type p3;\ p3##_type const p3;\
p4##_type p4;\ p4##_type const p4;\
p5##_type p5;\ p5##_type const p5;\
p6##_type p6;\ p6##_type const p6;\
p7##_type p7;\ p7##_type const p7;\
p8##_type p8;\ p8##_type const p8;\
p9##_type p9;\ p9##_type const p9;\
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::std::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\ ::std::string gmock_description = (description);\
if (!gmock_description.empty())\ if (!gmock_description.empty())\
return gmock_description;\ return gmock_description;\
return ::testing::internal::FormatMatcherDescription(\ return ::testing::internal::FormatMatcherDescription(\
@@ -2124,7 +2199,6 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \ p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \
p9##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)));\ p9##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)));\
}\ }\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
};\ };\
template <typename arg_type>\ template <typename arg_type>\
operator ::testing::Matcher<arg_type>() const {\ operator ::testing::Matcher<arg_type>() const {\
@@ -2134,22 +2208,29 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
name##MatcherP10(p0##_type gmock_p0, p1##_type gmock_p1, \ name##MatcherP10(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \ p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
p8##_type gmock_p8, p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), \ p8##_type gmock_p8, \
p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ p9##_type gmock_p9) : p0(::testing::internal::move(gmock_p0)), \
p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {\ p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)), \
p7(::testing::internal::move(gmock_p7)), \
p8(::testing::internal::move(gmock_p8)), \
p9(::testing::internal::move(gmock_p9)) {\
}\ }\
p0##_type p0;\ p0##_type const p0;\
p1##_type p1;\ p1##_type const p1;\
p2##_type p2;\ p2##_type const p2;\
p3##_type p3;\ p3##_type const p3;\
p4##_type p4;\ p4##_type const p4;\
p5##_type p5;\ p5##_type const p5;\
p6##_type p6;\ p6##_type const p6;\
p7##_type p7;\ p7##_type const p7;\
p8##_type p8;\ p8##_type const p8;\
p9##_type p9;\ p9##_type const p9;\
private:\ private:\
GTEST_DISALLOW_ASSIGN_(name##MatcherP10);\
};\ };\
template <typename p0##_type, typename p1##_type, typename p2##_type, \ template <typename p0##_type, typename p1##_type, typename p2##_type, \
typename p3##_type, typename p4##_type, typename p5##_type, \ typename p3##_type, typename p4##_type, typename p5##_type, \
@@ -2172,7 +2253,7 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
bool name##MatcherP10<p0##_type, p1##_type, p2##_type, p3##_type, \ bool name##MatcherP10<p0##_type, p1##_type, p2##_type, p3##_type, \
p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \ p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \
p9##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ p9##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
arg_type arg, \ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
const const

View File

@@ -1,6 +1,6 @@
$$ -*- mode: c++; -*- $$ -*- mode: c++; -*-
$$ This is a Pump source file. Please use Pump to convert it to $$ This is a Pump source file. Please use Pump to convert
$$ gmock-generated-actions.h. $$ it to gmock-generated-matchers.h.
$$ $$
$var n = 10 $$ The maximum arity we support. $var n = 10 $$ The maximum arity we support.
$$ }} This line fixes auto-indentation of the following code in Emacs. $$ }} This line fixes auto-indentation of the following code in Emacs.
@@ -37,6 +37,8 @@ $$ }} This line fixes auto-indentation of the following code in Emacs.
// //
// This file implements some commonly used variadic matchers. // This file implements some commonly used variadic matchers.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_
@@ -303,6 +305,9 @@ $for j, [[
// UnorderedElementsAre(e_1, e_2, ..., e_n) is an ElementsAre extension // UnorderedElementsAre(e_1, e_2, ..., e_n) is an ElementsAre extension
// that matches n elements in any order. We support up to n=$n arguments. // that matches n elements in any order. We support up to n=$n arguments.
//
// If you have >$n elements, consider UnorderedElementsAreArray() or
// UnorderedPointwise() instead.
$range i 0..n $range i 0..n
$for i [[ $for i [[
@@ -479,7 +484,7 @@ $$ // show up in the generated code.
// using testing::PrintToString; // using testing::PrintToString;
// //
// MATCHER_P2(InClosedRange, low, hi, // MATCHER_P2(InClosedRange, low, hi,
// string(negation ? "is not" : "is") + " in range [" + // std::string(negation ? "is not" : "is") + " in range [" +
// PrintToString(low) + ", " + PrintToString(hi) + "]") { // PrintToString(low) + ", " + PrintToString(hi) + "]") {
// return low <= arg && arg <= hi; // return low <= arg && arg <= hi;
// } // }
@@ -587,7 +592,8 @@ $$ // show up in the generated code.
// ================ // ================
// //
// To learn more about using these macros, please search for 'MATCHER' // To learn more about using these macros, please search for 'MATCHER'
// on http://code.google.com/p/googlemock/wiki/CookBook. // on
// https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md
$range i 0..n $range i 0..n
$for i $for i
@@ -604,32 +610,34 @@ $var template = [[$if i==0 [[]] $else [[
]]]] ]]]]
$var ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]] $var ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]]
$var impl_ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]] $var impl_ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]]
$var impl_inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(gmock_p$j)]]]]]] $var impl_inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(::testing::internal::move(gmock_p$j))]]]]]]
$var inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(gmock_p$j)]]]]]] $var inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(::testing::internal::move(gmock_p$j))]]]]]]
$var params = [[$for j, [[p$j]]]] $var params = [[$for j, [[p$j]]]]
$var param_types = [[$if i==0 [[]] $else [[<$for j, [[p$j##_type]]>]]]] $var param_types = [[$if i==0 [[]] $else [[<$for j, [[p$j##_type]]>]]]]
$var param_types_and_names = [[$for j, [[p$j##_type p$j]]]] $var param_types_and_names = [[$for j, [[p$j##_type p$j]]]]
$var param_field_decls = [[$for j $var param_field_decls = [[$for j
[[ [[
p$j##_type p$j;\ p$j##_type const p$j;\
]]]] ]]]]
$var param_field_decls2 = [[$for j $var param_field_decls2 = [[$for j
[[ [[
p$j##_type p$j;\ p$j##_type const p$j;\
]]]] ]]]]
#define $macro_name(name$for j [[, p$j]], description)\$template #define $macro_name(name$for j [[, p$j]], description)\$template
class $class_name {\ class $class_name {\
public:\ public:\
template <typename arg_type>\ template <typename arg_type>\
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ class gmock_Impl : public ::testing::MatcherInterface<\
GTEST_REFERENCE_TO_CONST_(arg_type)> {\
public:\ public:\
[[$if i==1 [[explicit ]]]]gmock_Impl($impl_ctor_param_list)\ [[$if i==1 [[explicit ]]]]gmock_Impl($impl_ctor_param_list)\
$impl_inits {}\ $impl_inits {}\
virtual bool MatchAndExplain(\ virtual bool MatchAndExplain(\
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener) const;\
virtual void DescribeTo(::std::ostream* gmock_os) const {\ virtual void DescribeTo(::std::ostream* gmock_os) const {\
*gmock_os << FormatDescription(false);\ *gmock_os << FormatDescription(false);\
}\ }\
@@ -637,8 +645,8 @@ $var param_field_decls2 = [[$for j
*gmock_os << FormatDescription(true);\ *gmock_os << FormatDescription(true);\
}\$param_field_decls }\$param_field_decls
private:\ private:\
::testing::internal::string FormatDescription(bool negation) const {\ ::std::string FormatDescription(bool negation) const {\
const ::testing::internal::string gmock_description = (description);\ ::std::string gmock_description = (description);\
if (!gmock_description.empty())\ if (!gmock_description.empty())\
return gmock_description;\ return gmock_description;\
return ::testing::internal::FormatMatcherDescription(\ return ::testing::internal::FormatMatcherDescription(\
@@ -646,7 +654,6 @@ $var param_field_decls2 = [[$for j
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
::testing::tuple<$for j, [[p$j##_type]]>($for j, [[p$j]])));\ ::testing::tuple<$for j, [[p$j##_type]]>($for j, [[p$j]])));\
}\ }\
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\
};\ };\
template <typename arg_type>\ template <typename arg_type>\
operator ::testing::Matcher<arg_type>() const {\ operator ::testing::Matcher<arg_type>() const {\
@@ -656,14 +663,13 @@ $var param_field_decls2 = [[$for j
[[$if i==1 [[explicit ]]]]$class_name($ctor_param_list)$inits {\ [[$if i==1 [[explicit ]]]]$class_name($ctor_param_list)$inits {\
}\$param_field_decls2 }\$param_field_decls2
private:\ private:\
GTEST_DISALLOW_ASSIGN_($class_name);\
};\$template };\$template
inline $class_name$param_types name($param_types_and_names) {\ inline $class_name$param_types name($param_types_and_names) {\
return $class_name$param_types($params);\ return $class_name$param_types($params);\
}\$template }\$template
template <typename arg_type>\ template <typename arg_type>\
bool $class_name$param_types::gmock_Impl<arg_type>::MatchAndExplain(\ bool $class_name$param_types::gmock_Impl<arg_type>::MatchAndExplain(\
arg_type arg, \ GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
const const
]] ]]

View File

@@ -30,8 +30,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Implements class templates NiceMock, NaggyMock, and StrictMock. // Implements class templates NiceMock, NaggyMock, and StrictMock.
// //
@@ -51,10 +50,9 @@
// NiceMock<MockFoo>. // NiceMock<MockFoo>.
// //
// NiceMock, NaggyMock, and StrictMock "inherit" the constructors of // NiceMock, NaggyMock, and StrictMock "inherit" the constructors of
// their respective base class, with up-to 10 arguments. Therefore // their respective base class. Therefore you can write
// you can write NiceMock<MockFoo>(5, "a") to construct a nice mock // NiceMock<MockFoo>(5, "a") to construct a nice mock where MockFoo
// where MockFoo has a constructor that accepts (int, const char*), // has a constructor that accepts (int, const char*), for example.
// for example.
// //
// A known limitation is that NiceMock<MockFoo>, NaggyMock<MockFoo>, // A known limitation is that NiceMock<MockFoo>, NaggyMock<MockFoo>,
// and StrictMock<MockFoo> only works for mock methods defined using // and StrictMock<MockFoo> only works for mock methods defined using
@@ -63,10 +61,8 @@
// or "strict" modifier may not affect it, depending on the compiler. // or "strict" modifier may not affect it, depending on the compiler.
// In particular, nesting NiceMock, NaggyMock, and StrictMock is NOT // In particular, nesting NiceMock, NaggyMock, and StrictMock is NOT
// supported. // supported.
//
// Another known limitation is that the constructors of the base mock // GOOGLETEST_CM0002 DO NOT DELETE
// cannot have arguments passed by non-const reference, which are
// banned by the Google C++ style guide anyway.
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_ #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_
@@ -79,15 +75,35 @@ namespace testing {
template <class MockClass> template <class MockClass>
class NiceMock : public MockClass { class NiceMock : public MockClass {
public: public:
// We don't factor out the constructor body to a common method, as NiceMock() : MockClass() {
// we have to avoid a possible clash with members of MockClass.
NiceMock() {
::testing::Mock::AllowUninterestingCalls( ::testing::Mock::AllowUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this)); internal::ImplicitCast_<MockClass*>(this));
} }
// C++ doesn't (yet) allow inheritance of constructors, so we have #if GTEST_LANG_CXX11
// to define it for each arity. // Ideally, we would inherit base class's constructors through a using
// declaration, which would preserve their visibility. However, many existing
// tests rely on the fact that current implementation reexports protected
// constructors as public. These tests would need to be cleaned up first.
// Single argument constructor is special-cased so that it can be
// made explicit.
template <typename A>
explicit NiceMock(A&& arg) : MockClass(std::forward<A>(arg)) {
::testing::Mock::AllowUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this));
}
template <typename A1, typename A2, typename... An>
NiceMock(A1&& arg1, A2&& arg2, An&&... args)
: MockClass(std::forward<A1>(arg1), std::forward<A2>(arg2),
std::forward<An>(args)...) {
::testing::Mock::AllowUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this));
}
#else
// C++98 doesn't have variadic templates, so we have to define one
// for each arity.
template <typename A1> template <typename A1>
explicit NiceMock(const A1& a1) : MockClass(a1) { explicit NiceMock(const A1& a1) : MockClass(a1) {
::testing::Mock::AllowUninterestingCalls( ::testing::Mock::AllowUninterestingCalls(
@@ -163,7 +179,9 @@ class NiceMock : public MockClass {
internal::ImplicitCast_<MockClass*>(this)); internal::ImplicitCast_<MockClass*>(this));
} }
virtual ~NiceMock() { #endif // GTEST_LANG_CXX11
~NiceMock() {
::testing::Mock::UnregisterCallReaction( ::testing::Mock::UnregisterCallReaction(
internal::ImplicitCast_<MockClass*>(this)); internal::ImplicitCast_<MockClass*>(this));
} }
@@ -175,15 +193,35 @@ class NiceMock : public MockClass {
template <class MockClass> template <class MockClass>
class NaggyMock : public MockClass { class NaggyMock : public MockClass {
public: public:
// We don't factor out the constructor body to a common method, as NaggyMock() : MockClass() {
// we have to avoid a possible clash with members of MockClass.
NaggyMock() {
::testing::Mock::WarnUninterestingCalls( ::testing::Mock::WarnUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this)); internal::ImplicitCast_<MockClass*>(this));
} }
// C++ doesn't (yet) allow inheritance of constructors, so we have #if GTEST_LANG_CXX11
// to define it for each arity. // Ideally, we would inherit base class's constructors through a using
// declaration, which would preserve their visibility. However, many existing
// tests rely on the fact that current implementation reexports protected
// constructors as public. These tests would need to be cleaned up first.
// Single argument constructor is special-cased so that it can be
// made explicit.
template <typename A>
explicit NaggyMock(A&& arg) : MockClass(std::forward<A>(arg)) {
::testing::Mock::WarnUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this));
}
template <typename A1, typename A2, typename... An>
NaggyMock(A1&& arg1, A2&& arg2, An&&... args)
: MockClass(std::forward<A1>(arg1), std::forward<A2>(arg2),
std::forward<An>(args)...) {
::testing::Mock::WarnUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this));
}
#else
// C++98 doesn't have variadic templates, so we have to define one
// for each arity.
template <typename A1> template <typename A1>
explicit NaggyMock(const A1& a1) : MockClass(a1) { explicit NaggyMock(const A1& a1) : MockClass(a1) {
::testing::Mock::WarnUninterestingCalls( ::testing::Mock::WarnUninterestingCalls(
@@ -259,7 +297,9 @@ class NaggyMock : public MockClass {
internal::ImplicitCast_<MockClass*>(this)); internal::ImplicitCast_<MockClass*>(this));
} }
virtual ~NaggyMock() { #endif // GTEST_LANG_CXX11
~NaggyMock() {
::testing::Mock::UnregisterCallReaction( ::testing::Mock::UnregisterCallReaction(
internal::ImplicitCast_<MockClass*>(this)); internal::ImplicitCast_<MockClass*>(this));
} }
@@ -271,15 +311,35 @@ class NaggyMock : public MockClass {
template <class MockClass> template <class MockClass>
class StrictMock : public MockClass { class StrictMock : public MockClass {
public: public:
// We don't factor out the constructor body to a common method, as StrictMock() : MockClass() {
// we have to avoid a possible clash with members of MockClass.
StrictMock() {
::testing::Mock::FailUninterestingCalls( ::testing::Mock::FailUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this)); internal::ImplicitCast_<MockClass*>(this));
} }
// C++ doesn't (yet) allow inheritance of constructors, so we have #if GTEST_LANG_CXX11
// to define it for each arity. // Ideally, we would inherit base class's constructors through a using
// declaration, which would preserve their visibility. However, many existing
// tests rely on the fact that current implementation reexports protected
// constructors as public. These tests would need to be cleaned up first.
// Single argument constructor is special-cased so that it can be
// made explicit.
template <typename A>
explicit StrictMock(A&& arg) : MockClass(std::forward<A>(arg)) {
::testing::Mock::FailUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this));
}
template <typename A1, typename A2, typename... An>
StrictMock(A1&& arg1, A2&& arg2, An&&... args)
: MockClass(std::forward<A1>(arg1), std::forward<A2>(arg2),
std::forward<An>(args)...) {
::testing::Mock::FailUninterestingCalls(
internal::ImplicitCast_<MockClass*>(this));
}
#else
// C++98 doesn't have variadic templates, so we have to define one
// for each arity.
template <typename A1> template <typename A1>
explicit StrictMock(const A1& a1) : MockClass(a1) { explicit StrictMock(const A1& a1) : MockClass(a1) {
::testing::Mock::FailUninterestingCalls( ::testing::Mock::FailUninterestingCalls(
@@ -355,7 +415,9 @@ class StrictMock : public MockClass {
internal::ImplicitCast_<MockClass*>(this)); internal::ImplicitCast_<MockClass*>(this));
} }
virtual ~StrictMock() { #endif // GTEST_LANG_CXX11
~StrictMock() {
::testing::Mock::UnregisterCallReaction( ::testing::Mock::UnregisterCallReaction(
internal::ImplicitCast_<MockClass*>(this)); internal::ImplicitCast_<MockClass*>(this));
} }

View File

@@ -1,6 +1,6 @@
$$ -*- mode: c++; -*- $$ -*- mode: c++; -*-
$$ This is a Pump source file. Please use Pump to convert it to $$ This is a Pump source file. Please use Pump to convert
$$ gmock-generated-nice-strict.h. $$ it to gmock-generated-nice-strict.h.
$$ $$
$var n = 10 $$ The maximum arity we support. $var n = 10 $$ The maximum arity we support.
// Copyright 2008, Google Inc. // Copyright 2008, Google Inc.
@@ -31,8 +31,7 @@ $var n = 10 $$ The maximum arity we support.
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Implements class templates NiceMock, NaggyMock, and StrictMock. // Implements class templates NiceMock, NaggyMock, and StrictMock.
// //
@@ -52,10 +51,9 @@ $var n = 10 $$ The maximum arity we support.
// NiceMock<MockFoo>. // NiceMock<MockFoo>.
// //
// NiceMock, NaggyMock, and StrictMock "inherit" the constructors of // NiceMock, NaggyMock, and StrictMock "inherit" the constructors of
// their respective base class, with up-to $n arguments. Therefore // their respective base class. Therefore you can write
// you can write NiceMock<MockFoo>(5, "a") to construct a nice mock // NiceMock<MockFoo>(5, "a") to construct a nice mock where MockFoo
// where MockFoo has a constructor that accepts (int, const char*), // has a constructor that accepts (int, const char*), for example.
// for example.
// //
// A known limitation is that NiceMock<MockFoo>, NaggyMock<MockFoo>, // A known limitation is that NiceMock<MockFoo>, NaggyMock<MockFoo>,
// and StrictMock<MockFoo> only works for mock methods defined using // and StrictMock<MockFoo> only works for mock methods defined using
@@ -64,10 +62,8 @@ $var n = 10 $$ The maximum arity we support.
// or "strict" modifier may not affect it, depending on the compiler. // or "strict" modifier may not affect it, depending on the compiler.
// In particular, nesting NiceMock, NaggyMock, and StrictMock is NOT // In particular, nesting NiceMock, NaggyMock, and StrictMock is NOT
// supported. // supported.
//
// Another known limitation is that the constructors of the base mock // GOOGLETEST_CM0002 DO NOT DELETE
// cannot have arguments passed by non-const reference, which are
// banned by the Google C++ style guide anyway.
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_ #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_
@@ -91,15 +87,35 @@ $var method=[[$if kind==0 [[AllowUninterestingCalls]]
template <class MockClass> template <class MockClass>
class $clazz : public MockClass { class $clazz : public MockClass {
public: public:
// We don't factor out the constructor body to a common method, as $clazz() : MockClass() {
// we have to avoid a possible clash with members of MockClass.
$clazz() {
::testing::Mock::$method( ::testing::Mock::$method(
internal::ImplicitCast_<MockClass*>(this)); internal::ImplicitCast_<MockClass*>(this));
} }
// C++ doesn't (yet) allow inheritance of constructors, so we have #if GTEST_LANG_CXX11
// to define it for each arity. // Ideally, we would inherit base class's constructors through a using
// declaration, which would preserve their visibility. However, many existing
// tests rely on the fact that current implementation reexports protected
// constructors as public. These tests would need to be cleaned up first.
// Single argument constructor is special-cased so that it can be
// made explicit.
template <typename A>
explicit $clazz(A&& arg) : MockClass(std::forward<A>(arg)) {
::testing::Mock::$method(
internal::ImplicitCast_<MockClass*>(this));
}
template <typename A1, typename A2, typename... An>
$clazz(A1&& arg1, A2&& arg2, An&&... args)
: MockClass(std::forward<A1>(arg1), std::forward<A2>(arg2),
std::forward<An>(args)...) {
::testing::Mock::$method(
internal::ImplicitCast_<MockClass*>(this));
}
#else
// C++98 doesn't have variadic templates, so we have to define one
// for each arity.
template <typename A1> template <typename A1>
explicit $clazz(const A1& a1) : MockClass(a1) { explicit $clazz(const A1& a1) : MockClass(a1) {
::testing::Mock::$method( ::testing::Mock::$method(
@@ -117,7 +133,9 @@ $range j 1..i
]] ]]
virtual ~$clazz() { #endif // GTEST_LANG_CXX11
~$clazz() {
::testing::Mock::UnregisterCallReaction( ::testing::Mock::UnregisterCallReaction(
internal::ImplicitCast_<MockClass*>(this)); internal::ImplicitCast_<MockClass*>(this));
} }

File diff suppressed because it is too large Load Diff

View File

@@ -26,13 +26,14 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Google Mock - a framework for writing C++ mock classes. // Google Mock - a framework for writing C++ mock classes.
// //
// This file implements some actions that depend on gmock-generated-actions.h. // This file implements some actions that depend on gmock-generated-actions.h.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_ #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_

View File

@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: marcus.boerger@google.com (Marcus Boerger)
// Google Mock - a framework for writing C++ mock classes. // Google Mock - a framework for writing C++ mock classes.
// //
@@ -36,13 +35,27 @@
// Note that tests are implemented in gmock-matchers_test.cc rather than // Note that tests are implemented in gmock-matchers_test.cc rather than
// gmock-more-matchers-test.cc. // gmock-more-matchers-test.cc.
#ifndef GMOCK_GMOCK_MORE_MATCHERS_H_ // GOOGLETEST_CM0002 DO NOT DELETE
#define GMOCK_GMOCK_MORE_MATCHERS_H_
#ifndef GMOCK_INCLUDE_GMOCK_MORE_MATCHERS_H_
#define GMOCK_INCLUDE_GMOCK_MORE_MATCHERS_H_
#include "gmock/gmock-generated-matchers.h" #include "gmock/gmock-generated-matchers.h"
namespace testing { namespace testing {
// Silence C4100 (unreferenced formal
// parameter) for MSVC
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable:4100)
#if (_MSC_VER == 1900)
// and silence C4800 (C4800: 'int *const ': forcing value
// to bool 'true' or 'false') for MSVC 14
# pragma warning(disable:4800)
#endif
#endif
// Defines a matcher that matches an empty container. The container must // Defines a matcher that matches an empty container. The container must
// support both size() and empty(), which all STL-like containers provide. // support both size() and empty(), which all STL-like containers provide.
MATCHER(IsEmpty, negation ? "isn't empty" : "is empty") { MATCHER(IsEmpty, negation ? "isn't empty" : "is empty") {
@@ -53,6 +66,27 @@ MATCHER(IsEmpty, negation ? "isn't empty" : "is empty") {
return false; return false;
} }
// Define a matcher that matches a value that evaluates in boolean
// context to true. Useful for types that define "explicit operator
// bool" operators and so can't be compared for equality with true
// and false.
MATCHER(IsTrue, negation ? "is false" : "is true") {
return static_cast<bool>(arg);
}
// Define a matcher that matches a value that evaluates in boolean
// context to false. Useful for types that define "explicit operator
// bool" operators and so can't be compared for equality with true
// and false.
MATCHER(IsFalse, negation ? "is true" : "is false") {
return !static_cast<bool>(arg);
}
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // namespace testing } // namespace testing
#endif // GMOCK_GMOCK_MORE_MATCHERS_H_ #endif // GMOCK_INCLUDE_GMOCK_MORE_MATCHERS_H_

View File

@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Google Mock - a framework for writing C++ mock classes. // Google Mock - a framework for writing C++ mock classes.
// //
@@ -57,6 +56,8 @@
// where all clauses are optional, and .InSequence()/.After()/ // where all clauses are optional, and .InSequence()/.After()/
// .WillOnce() can appear any number of times. // .WillOnce() can appear any number of times.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_ #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_
@@ -65,11 +66,6 @@
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <vector> #include <vector>
#if GTEST_HAS_EXCEPTIONS
# include <stdexcept> // NOLINT
#endif
#include "gmock/gmock-actions.h" #include "gmock/gmock-actions.h"
#include "gmock/gmock-cardinalities.h" #include "gmock/gmock-cardinalities.h"
#include "gmock/gmock-matchers.h" #include "gmock/gmock-matchers.h"
@@ -77,6 +73,13 @@
#include "gmock/internal/gmock-port.h" #include "gmock/internal/gmock-port.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#if GTEST_HAS_EXCEPTIONS
# include <stdexcept> // NOLINT
#endif
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
/* class A needs to have dll-interface to be used by clients of class B */)
namespace testing { namespace testing {
// An abstract handle of an expectation. // An abstract handle of an expectation.
@@ -148,15 +151,13 @@ class GTEST_API_ UntypedFunctionMockerBase {
// action fails. // action fails.
// L = * // L = *
virtual UntypedActionResultHolderBase* UntypedPerformDefaultAction( virtual UntypedActionResultHolderBase* UntypedPerformDefaultAction(
const void* untyped_args, void* untyped_args, const std::string& call_description) const = 0;
const string& call_description) const = 0;
// Performs the given action with the given arguments and returns // Performs the given action with the given arguments and returns
// the action's result. // the action's result.
// L = * // L = *
virtual UntypedActionResultHolderBase* UntypedPerformAction( virtual UntypedActionResultHolderBase* UntypedPerformAction(
const void* untyped_action, const void* untyped_action, void* untyped_args) const = 0;
const void* untyped_args) const = 0;
// Writes a message that the call is uninteresting (i.e. neither // Writes a message that the call is uninteresting (i.e. neither
// explicitly expected nor explicitly unexpected) to the given // explicitly expected nor explicitly unexpected) to the given
@@ -186,7 +187,7 @@ class GTEST_API_ UntypedFunctionMockerBase {
// this information in the global mock registry. Will be called // this information in the global mock registry. Will be called
// whenever an EXPECT_CALL() or ON_CALL() is executed on this mock // whenever an EXPECT_CALL() or ON_CALL() is executed on this mock
// method. // method.
// TODO(wan@google.com): rename to SetAndRegisterOwner(). // FIXME: rename to SetAndRegisterOwner().
void RegisterOwner(const void* mock_obj) void RegisterOwner(const void* mock_obj)
GTEST_LOCK_EXCLUDED_(g_gmock_mutex); GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
@@ -211,8 +212,7 @@ class GTEST_API_ UntypedFunctionMockerBase {
// arguments. This function can be safely called from multiple // arguments. This function can be safely called from multiple
// threads concurrently. The caller is responsible for deleting the // threads concurrently. The caller is responsible for deleting the
// result. // result.
UntypedActionResultHolderBase* UntypedInvokeWith( UntypedActionResultHolderBase* UntypedInvokeWith(void* untyped_args)
const void* untyped_args)
GTEST_LOCK_EXCLUDED_(g_gmock_mutex); GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
protected: protected:
@@ -238,6 +238,14 @@ class GTEST_API_ UntypedFunctionMockerBase {
UntypedOnCallSpecs untyped_on_call_specs_; UntypedOnCallSpecs untyped_on_call_specs_;
// All expectations for this function mocker. // All expectations for this function mocker.
//
// It's undefined behavior to interleave expectations (EXPECT_CALLs
// or ON_CALLs) and mock function calls. Also, the order of
// expectations is important. Therefore it's a logic race condition
// to read/write untyped_expectations_ concurrently. In order for
// tools like tsan to catch concurrent read/write accesses to
// untyped_expectations, we deliberately leave accesses to it
// unprotected.
UntypedExpectations untyped_expectations_; UntypedExpectations untyped_expectations_;
}; // class UntypedFunctionMockerBase }; // class UntypedFunctionMockerBase
@@ -263,12 +271,14 @@ class UntypedOnCallSpecBase {
}; };
// Asserts that the ON_CALL() statement has a certain property. // Asserts that the ON_CALL() statement has a certain property.
void AssertSpecProperty(bool property, const string& failure_message) const { void AssertSpecProperty(bool property,
const std::string& failure_message) const {
Assert(property, file_, line_, failure_message); Assert(property, file_, line_, failure_message);
} }
// Expects that the ON_CALL() statement has a certain property. // Expects that the ON_CALL() statement has a certain property.
void ExpectSpecProperty(bool property, const string& failure_message) const { void ExpectSpecProperty(bool property,
const std::string& failure_message) const {
Expect(property, file_, line_, failure_message); Expect(property, file_, line_, failure_message);
} }
@@ -362,7 +372,6 @@ enum CallReaction {
kAllow, kAllow,
kWarn, kWarn,
kFail, kFail,
kDefault = kWarn // By default, warn about uninteresting calls.
}; };
} // namespace internal } // namespace internal
@@ -690,7 +699,7 @@ GTEST_API_ extern ThreadLocal<Sequence*> g_gmock_implicit_sequence;
class GTEST_API_ ExpectationBase { class GTEST_API_ ExpectationBase {
public: public:
// source_text is the EXPECT_CALL(...) source that created this Expectation. // source_text is the EXPECT_CALL(...) source that created this Expectation.
ExpectationBase(const char* file, int line, const string& source_text); ExpectationBase(const char* file, int line, const std::string& source_text);
virtual ~ExpectationBase(); virtual ~ExpectationBase();
@@ -738,12 +747,14 @@ class GTEST_API_ ExpectationBase {
virtual Expectation GetHandle() = 0; virtual Expectation GetHandle() = 0;
// Asserts that the EXPECT_CALL() statement has the given property. // Asserts that the EXPECT_CALL() statement has the given property.
void AssertSpecProperty(bool property, const string& failure_message) const { void AssertSpecProperty(bool property,
const std::string& failure_message) const {
Assert(property, file_, line_, failure_message); Assert(property, file_, line_, failure_message);
} }
// Expects that the EXPECT_CALL() statement has the given property. // Expects that the EXPECT_CALL() statement has the given property.
void ExpectSpecProperty(bool property, const string& failure_message) const { void ExpectSpecProperty(bool property,
const std::string& failure_message) const {
Expect(property, file_, line_, failure_message); Expect(property, file_, line_, failure_message);
} }
@@ -845,7 +856,7 @@ class GTEST_API_ ExpectationBase {
// an EXPECT_CALL() statement finishes. // an EXPECT_CALL() statement finishes.
const char* file_; // The file that contains the expectation. const char* file_; // The file that contains the expectation.
int line_; // The line number of the expectation. int line_; // The line number of the expectation.
const string source_text_; // The EXPECT_CALL(...) source text. const std::string source_text_; // The EXPECT_CALL(...) source text.
// True iff the cardinality is specified explicitly. // True iff the cardinality is specified explicitly.
bool cardinality_specified_; bool cardinality_specified_;
Cardinality cardinality_; // The cardinality of the expectation. Cardinality cardinality_; // The cardinality of the expectation.
@@ -880,8 +891,8 @@ class TypedExpectation : public ExpectationBase {
typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple; typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple;
typedef typename Function<F>::Result Result; typedef typename Function<F>::Result Result;
TypedExpectation(FunctionMockerBase<F>* owner, TypedExpectation(FunctionMockerBase<F>* owner, const char* a_file, int a_line,
const char* a_file, int a_line, const string& a_source_text, const std::string& a_source_text,
const ArgumentMatcherTuple& m) const ArgumentMatcherTuple& m)
: ExpectationBase(a_file, a_line, a_source_text), : ExpectationBase(a_file, a_line, a_source_text),
owner_(owner), owner_(owner),
@@ -1199,7 +1210,7 @@ class TypedExpectation : public ExpectationBase {
mocker->DescribeDefaultActionTo(args, what); mocker->DescribeDefaultActionTo(args, what);
DescribeCallCountTo(why); DescribeCallCountTo(why);
// TODO(wan@google.com): allow the user to control whether // FIXME: allow the user to control whether
// unexpected calls should fail immediately or continue using a // unexpected calls should fail immediately or continue using a
// flag --gmock_unexpected_calls_are_fatal. // flag --gmock_unexpected_calls_are_fatal.
return NULL; return NULL;
@@ -1240,7 +1251,7 @@ class TypedExpectation : public ExpectationBase {
// Logs a message including file and line number information. // Logs a message including file and line number information.
GTEST_API_ void LogWithLocation(testing::internal::LogSeverity severity, GTEST_API_ void LogWithLocation(testing::internal::LogSeverity severity,
const char* file, int line, const char* file, int line,
const string& message); const std::string& message);
template <typename F> template <typename F>
class MockSpec { class MockSpec {
@@ -1251,15 +1262,16 @@ class MockSpec {
// Constructs a MockSpec object, given the function mocker object // Constructs a MockSpec object, given the function mocker object
// that the spec is associated with. // that the spec is associated with.
explicit MockSpec(internal::FunctionMockerBase<F>* function_mocker) MockSpec(internal::FunctionMockerBase<F>* function_mocker,
: function_mocker_(function_mocker) {} const ArgumentMatcherTuple& matchers)
: function_mocker_(function_mocker), matchers_(matchers) {}
// Adds a new default action spec to the function mocker and returns // Adds a new default action spec to the function mocker and returns
// the newly created spec. // the newly created spec.
internal::OnCallSpec<F>& InternalDefaultActionSetAt( internal::OnCallSpec<F>& InternalDefaultActionSetAt(
const char* file, int line, const char* obj, const char* call) { const char* file, int line, const char* obj, const char* call) {
LogWithLocation(internal::kInfo, file, line, LogWithLocation(internal::kInfo, file, line,
string("ON_CALL(") + obj + ", " + call + ") invoked"); std::string("ON_CALL(") + obj + ", " + call + ") invoked");
return function_mocker_->AddNewOnCallSpec(file, line, matchers_); return function_mocker_->AddNewOnCallSpec(file, line, matchers_);
} }
@@ -1267,20 +1279,24 @@ class MockSpec {
// the newly created spec. // the newly created spec.
internal::TypedExpectation<F>& InternalExpectedAt( internal::TypedExpectation<F>& InternalExpectedAt(
const char* file, int line, const char* obj, const char* call) { const char* file, int line, const char* obj, const char* call) {
const string source_text(string("EXPECT_CALL(") + obj + ", " + call + ")"); const std::string source_text(std::string("EXPECT_CALL(") + obj + ", " +
call + ")");
LogWithLocation(internal::kInfo, file, line, source_text + " invoked"); LogWithLocation(internal::kInfo, file, line, source_text + " invoked");
return function_mocker_->AddNewExpectation( return function_mocker_->AddNewExpectation(
file, line, source_text, matchers_); file, line, source_text, matchers_);
} }
// This operator overload is used to swallow the superfluous parameter list
// introduced by the ON/EXPECT_CALL macros. See the macro comments for more
// explanation.
MockSpec<F>& operator()(const internal::WithoutMatchers&, void* const) {
return *this;
}
private: private:
template <typename Function> template <typename Function>
friend class internal::FunctionMocker; friend class internal::FunctionMocker;
void SetMatchers(const ArgumentMatcherTuple& matchers) {
matchers_ = matchers;
}
// The function mocker that owns this spec. // The function mocker that owns this spec.
internal::FunctionMockerBase<F>* const function_mocker_; internal::FunctionMockerBase<F>* const function_mocker_;
// The argument matchers specified in the spec. // The argument matchers specified in the spec.
@@ -1344,11 +1360,7 @@ class ReferenceOrValueWrapper<T&> {
// we need to temporarily disable the warning. We have to do it for // we need to temporarily disable the warning. We have to do it for
// the entire class to suppress the warning, even though it's about // the entire class to suppress the warning, even though it's about
// the constructor only. // the constructor only.
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4355)
#ifdef _MSC_VER
# pragma warning(push) // Saves the current warning state.
# pragma warning(disable:4355) // Temporarily disables warning 4355.
#endif // _MSV_VER
// C++ treats the void type specially. For example, you cannot define // C++ treats the void type specially. For example, you cannot define
// a void-typed variable or pass a void value to a function. // a void-typed variable or pass a void value to a function.
@@ -1388,19 +1400,20 @@ class ActionResultHolder : public UntypedActionResultHolderBase {
template <typename F> template <typename F>
static ActionResultHolder* PerformDefaultAction( static ActionResultHolder* PerformDefaultAction(
const FunctionMockerBase<F>* func_mocker, const FunctionMockerBase<F>* func_mocker,
const typename Function<F>::ArgumentTuple& args, typename RvalueRef<typename Function<F>::ArgumentTuple>::type args,
const string& call_description) { const std::string& call_description) {
return new ActionResultHolder(Wrapper( return new ActionResultHolder(Wrapper(func_mocker->PerformDefaultAction(
func_mocker->PerformDefaultAction(args, call_description))); internal::move(args), call_description)));
} }
// Performs the given action and returns the result in a new-ed // Performs the given action and returns the result in a new-ed
// ActionResultHolder. // ActionResultHolder.
template <typename F> template <typename F>
static ActionResultHolder* static ActionResultHolder* PerformAction(
PerformAction(const Action<F>& action, const Action<F>& action,
const typename Function<F>::ArgumentTuple& args) { typename RvalueRef<typename Function<F>::ArgumentTuple>::type args) {
return new ActionResultHolder(Wrapper(action.Perform(args))); return new ActionResultHolder(
Wrapper(action.Perform(internal::move(args))));
} }
private: private:
@@ -1428,9 +1441,9 @@ class ActionResultHolder<void> : public UntypedActionResultHolderBase {
template <typename F> template <typename F>
static ActionResultHolder* PerformDefaultAction( static ActionResultHolder* PerformDefaultAction(
const FunctionMockerBase<F>* func_mocker, const FunctionMockerBase<F>* func_mocker,
const typename Function<F>::ArgumentTuple& args, typename RvalueRef<typename Function<F>::ArgumentTuple>::type args,
const string& call_description) { const std::string& call_description) {
func_mocker->PerformDefaultAction(args, call_description); func_mocker->PerformDefaultAction(internal::move(args), call_description);
return new ActionResultHolder; return new ActionResultHolder;
} }
@@ -1439,8 +1452,8 @@ class ActionResultHolder<void> : public UntypedActionResultHolderBase {
template <typename F> template <typename F>
static ActionResultHolder* PerformAction( static ActionResultHolder* PerformAction(
const Action<F>& action, const Action<F>& action,
const typename Function<F>::ArgumentTuple& args) { typename RvalueRef<typename Function<F>::ArgumentTuple>::type args) {
action.Perform(args); action.Perform(internal::move(args));
return new ActionResultHolder; return new ActionResultHolder;
} }
@@ -1459,7 +1472,7 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
typedef typename Function<F>::ArgumentTuple ArgumentTuple; typedef typename Function<F>::ArgumentTuple ArgumentTuple;
typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple; typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple;
FunctionMockerBase() : current_spec_(this) {} FunctionMockerBase() {}
// The destructor verifies that all expectations on this mock // The destructor verifies that all expectations on this mock
// function have been satisfied. If not, it will report Google Test // function have been satisfied. If not, it will report Google Test
@@ -1495,14 +1508,16 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
// mutable state of this object, and thus can be called concurrently // mutable state of this object, and thus can be called concurrently
// without locking. // without locking.
// L = * // L = *
Result PerformDefaultAction(const ArgumentTuple& args, Result PerformDefaultAction(
const string& call_description) const { typename RvalueRef<typename Function<F>::ArgumentTuple>::type args,
const std::string& call_description) const {
const OnCallSpec<F>* const spec = const OnCallSpec<F>* const spec =
this->FindOnCallSpec(args); this->FindOnCallSpec(args);
if (spec != NULL) { if (spec != NULL) {
return spec->GetAction().Perform(args); return spec->GetAction().Perform(internal::move(args));
} }
const string message = call_description + const std::string message =
call_description +
"\n The mock function has no default action " "\n The mock function has no default action "
"set, and its return type has no default value set."; "set, and its return type has no default value set.";
#if GTEST_HAS_EXCEPTIONS #if GTEST_HAS_EXCEPTIONS
@@ -1521,11 +1536,11 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
// action fails. The caller is responsible for deleting the result. // action fails. The caller is responsible for deleting the result.
// L = * // L = *
virtual UntypedActionResultHolderBase* UntypedPerformDefaultAction( virtual UntypedActionResultHolderBase* UntypedPerformDefaultAction(
const void* untyped_args, // must point to an ArgumentTuple void* untyped_args, // must point to an ArgumentTuple
const string& call_description) const { const std::string& call_description) const {
const ArgumentTuple& args = ArgumentTuple* args = static_cast<ArgumentTuple*>(untyped_args);
*static_cast<const ArgumentTuple*>(untyped_args); return ResultHolder::PerformDefaultAction(this, internal::move(*args),
return ResultHolder::PerformDefaultAction(this, args, call_description); call_description);
} }
// Performs the given action with the given arguments and returns // Performs the given action with the given arguments and returns
@@ -1533,13 +1548,12 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
// result. // result.
// L = * // L = *
virtual UntypedActionResultHolderBase* UntypedPerformAction( virtual UntypedActionResultHolderBase* UntypedPerformAction(
const void* untyped_action, const void* untyped_args) const { const void* untyped_action, void* untyped_args) const {
// Make a copy of the action before performing it, in case the // Make a copy of the action before performing it, in case the
// action deletes the mock object (and thus deletes itself). // action deletes the mock object (and thus deletes itself).
const Action<F> action = *static_cast<const Action<F>*>(untyped_action); const Action<F> action = *static_cast<const Action<F>*>(untyped_action);
const ArgumentTuple& args = ArgumentTuple* args = static_cast<ArgumentTuple*>(untyped_args);
*static_cast<const ArgumentTuple*>(untyped_args); return ResultHolder::PerformAction(action, internal::move(*args));
return ResultHolder::PerformAction(action, args);
} }
// Implements UntypedFunctionMockerBase::ClearDefaultActionsLocked(): // Implements UntypedFunctionMockerBase::ClearDefaultActionsLocked():
@@ -1579,10 +1593,14 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
// Returns the result of invoking this mock function with the given // Returns the result of invoking this mock function with the given
// arguments. This function can be safely called from multiple // arguments. This function can be safely called from multiple
// threads concurrently. // threads concurrently.
Result InvokeWith(const ArgumentTuple& args) Result InvokeWith(
typename RvalueRef<typename Function<F>::ArgumentTuple>::type args)
GTEST_LOCK_EXCLUDED_(g_gmock_mutex) { GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
// const_cast is required since in C++98 we still pass ArgumentTuple around
// by const& instead of rvalue reference.
void* untyped_args = const_cast<void*>(static_cast<const void*>(&args));
scoped_ptr<ResultHolder> holder( scoped_ptr<ResultHolder> holder(
DownCast_<ResultHolder*>(this->UntypedInvokeWith(&args))); DownCast_<ResultHolder*>(this->UntypedInvokeWith(untyped_args)));
return holder->Unwrap(); return holder->Unwrap();
} }
@@ -1598,16 +1616,16 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
} }
// Adds and returns an expectation spec for this mock function. // Adds and returns an expectation spec for this mock function.
TypedExpectation<F>& AddNewExpectation( TypedExpectation<F>& AddNewExpectation(const char* file, int line,
const char* file, const std::string& source_text,
int line,
const string& source_text,
const ArgumentMatcherTuple& m) const ArgumentMatcherTuple& m)
GTEST_LOCK_EXCLUDED_(g_gmock_mutex) { GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
Mock::RegisterUseByOnCallOrExpectCall(MockObject(), file, line); Mock::RegisterUseByOnCallOrExpectCall(MockObject(), file, line);
TypedExpectation<F>* const expectation = TypedExpectation<F>* const expectation =
new TypedExpectation<F>(this, file, line, source_text, m); new TypedExpectation<F>(this, file, line, source_text, m);
const linked_ptr<ExpectationBase> untyped_expectation(expectation); const linked_ptr<ExpectationBase> untyped_expectation(expectation);
// See the definition of untyped_expectations_ for why access to
// it is unprotected here.
untyped_expectations_.push_back(untyped_expectation); untyped_expectations_.push_back(untyped_expectation);
// Adds this expectation into the implicit sequence if there is one. // Adds this expectation into the implicit sequence if there is one.
@@ -1619,10 +1637,6 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
return *expectation; return *expectation;
} }
// The current spec (either default action spec or expectation spec)
// being described on this function mocker.
MockSpec<F>& current_spec() { return current_spec_; }
private: private:
template <typename Func> friend class TypedExpectation; template <typename Func> friend class TypedExpectation;
@@ -1715,6 +1729,8 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
const ArgumentTuple& args) const const ArgumentTuple& args) const
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
g_gmock_mutex.AssertHeld(); g_gmock_mutex.AssertHeld();
// See the definition of untyped_expectations_ for why access to
// it is unprotected here.
for (typename UntypedExpectations::const_reverse_iterator it = for (typename UntypedExpectations::const_reverse_iterator it =
untyped_expectations_.rbegin(); untyped_expectations_.rbegin();
it != untyped_expectations_.rend(); ++it) { it != untyped_expectations_.rend(); ++it) {
@@ -1765,14 +1781,10 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
} }
} }
// The current spec (either default action spec or expectation spec)
// being described on this function mocker.
MockSpec<F> current_spec_;
// There is no generally useful and implementable semantics of // There is no generally useful and implementable semantics of
// copying a mock object, so copying a mock is usually a user error. // copying a mock object, so copying a mock is usually a user error.
// Thus we disallow copying function mockers. If the user really // Thus we disallow copying function mockers. If the user really
// wants to copy a mock object, he should implement his own copy // wants to copy a mock object, they should implement their own copy
// operation, for example: // operation, for example:
// //
// class MockFoo : public Foo { // class MockFoo : public Foo {
@@ -1784,9 +1796,7 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
GTEST_DISALLOW_COPY_AND_ASSIGN_(FunctionMockerBase); GTEST_DISALLOW_COPY_AND_ASSIGN_(FunctionMockerBase);
}; // class FunctionMockerBase }; // class FunctionMockerBase
#ifdef _MSC_VER GTEST_DISABLE_MSC_WARNINGS_POP_() // 4355
# pragma warning(pop) // Restores the warning state.
#endif // _MSV_VER
// Implements methods of FunctionMockerBase. // Implements methods of FunctionMockerBase.
@@ -1796,7 +1806,7 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
// Reports an uninteresting call (whose description is in msg) in the // Reports an uninteresting call (whose description is in msg) in the
// manner specified by 'reaction'. // manner specified by 'reaction'.
void ReportUninterestingCall(CallReaction reaction, const string& msg); void ReportUninterestingCall(CallReaction reaction, const std::string& msg);
} // namespace internal } // namespace internal
@@ -1831,17 +1841,78 @@ inline Expectation::Expectation(internal::ExpectationBase& exp) // NOLINT
} // namespace testing } // namespace testing
// A separate macro is required to avoid compile errors when the name GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
// of the method used in call is a result of macro expansion.
// See CompilesWithMethodNameExpandedFromMacro tests in
// internal/gmock-spec-builders_test.cc for more details.
#define GMOCK_ON_CALL_IMPL_(obj, call) \
((obj).gmock_##call).InternalDefaultActionSetAt(__FILE__, __LINE__, \
#obj, #call)
#define ON_CALL(obj, call) GMOCK_ON_CALL_IMPL_(obj, call)
#define GMOCK_EXPECT_CALL_IMPL_(obj, call) \ // Implementation for ON_CALL and EXPECT_CALL macros. A separate macro is
((obj).gmock_##call).InternalExpectedAt(__FILE__, __LINE__, #obj, #call) // required to avoid compile errors when the name of the method used in call is
#define EXPECT_CALL(obj, call) GMOCK_EXPECT_CALL_IMPL_(obj, call) // a result of macro expansion. See CompilesWithMethodNameExpandedFromMacro
// tests in internal/gmock-spec-builders_test.cc for more details.
//
// This macro supports statements both with and without parameter matchers. If
// the parameter list is omitted, gMock will accept any parameters, which allows
// tests to be written that don't need to encode the number of method
// parameter. This technique may only be used for non-overloaded methods.
//
// // These are the same:
// ON_CALL(mock, NoArgsMethod()).WillByDefault(...);
// ON_CALL(mock, NoArgsMethod).WillByDefault(...);
//
// // As are these:
// ON_CALL(mock, TwoArgsMethod(_, _)).WillByDefault(...);
// ON_CALL(mock, TwoArgsMethod).WillByDefault(...);
//
// // Can also specify args if you want, of course:
// ON_CALL(mock, TwoArgsMethod(_, 45)).WillByDefault(...);
//
// // Overloads work as long as you specify parameters:
// ON_CALL(mock, OverloadedMethod(_)).WillByDefault(...);
// ON_CALL(mock, OverloadedMethod(_, _)).WillByDefault(...);
//
// // Oops! Which overload did you want?
// ON_CALL(mock, OverloadedMethod).WillByDefault(...);
// => ERROR: call to member function 'gmock_OverloadedMethod' is ambiguous
//
// How this works: The mock class uses two overloads of the gmock_Method
// expectation setter method plus an operator() overload on the MockSpec object.
// In the matcher list form, the macro expands to:
//
// // This statement:
// ON_CALL(mock, TwoArgsMethod(_, 45))...
//
// // ...expands to:
// mock.gmock_TwoArgsMethod(_, 45)(WithoutMatchers(), nullptr)...
// |-------------v---------------||------------v-------------|
// invokes first overload swallowed by operator()
//
// // ...which is essentially:
// mock.gmock_TwoArgsMethod(_, 45)...
//
// Whereas the form without a matcher list:
//
// // This statement:
// ON_CALL(mock, TwoArgsMethod)...
//
// // ...expands to:
// mock.gmock_TwoArgsMethod(WithoutMatchers(), nullptr)...
// |-----------------------v--------------------------|
// invokes second overload
//
// // ...which is essentially:
// mock.gmock_TwoArgsMethod(_, _)...
//
// The WithoutMatchers() argument is used to disambiguate overloads and to
// block the caller from accidentally invoking the second overload directly. The
// second argument is an internal type derived from the method signature. The
// failure to disambiguate two overloads of this method in the ON_CALL statement
// is how we block callers from setting expectations on overloaded methods.
#define GMOCK_ON_CALL_IMPL_(mock_expr, Setter, call) \
((mock_expr).gmock_##call)(::testing::internal::GetWithoutMatchers(), NULL) \
.Setter(__FILE__, __LINE__, #mock_expr, #call)
#define ON_CALL(obj, call) \
GMOCK_ON_CALL_IMPL_(obj, InternalDefaultActionSetAt, call)
#define EXPECT_CALL(obj, call) \
GMOCK_ON_CALL_IMPL_(obj, InternalExpectedAt, call)
#endif // GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_ #endif // GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_

View File

@@ -26,13 +26,14 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Google Mock - a framework for writing C++ mock classes. // Google Mock - a framework for writing C++ mock classes.
// //
// This is the main header file a user should include. // This is the main header file a user should include.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_H_ #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_H_ #define GMOCK_INCLUDE_GMOCK_GMOCK_H_
@@ -59,8 +60,8 @@
#include "gmock/gmock-cardinalities.h" #include "gmock/gmock-cardinalities.h"
#include "gmock/gmock-generated-actions.h" #include "gmock/gmock-generated-actions.h"
#include "gmock/gmock-generated-function-mockers.h" #include "gmock/gmock-generated-function-mockers.h"
#include "gmock/gmock-generated-nice-strict.h"
#include "gmock/gmock-generated-matchers.h" #include "gmock/gmock-generated-matchers.h"
#include "gmock/gmock-generated-nice-strict.h"
#include "gmock/gmock-matchers.h" #include "gmock/gmock-matchers.h"
#include "gmock/gmock-more-actions.h" #include "gmock/gmock-more-actions.h"
#include "gmock/gmock-more-matchers.h" #include "gmock/gmock-more-matchers.h"
@@ -71,6 +72,7 @@ namespace testing {
// Declares Google Mock flags that we want a user to use programmatically. // Declares Google Mock flags that we want a user to use programmatically.
GMOCK_DECLARE_bool_(catch_leaked_mocks); GMOCK_DECLARE_bool_(catch_leaked_mocks);
GMOCK_DECLARE_string_(verbose); GMOCK_DECLARE_string_(verbose);
GMOCK_DECLARE_int32_(default_mock_behavior);
// Initializes Google Mock. This must be called before running the // Initializes Google Mock. This must be called before running the
// tests. In particular, it parses the command line for the flags // tests. In particular, it parses the command line for the flags

View File

@@ -0,0 +1,16 @@
# Customization Points
The custom directory is an injection point for custom user configurations.
## Header `gmock-port.h`
The following macros can be defined:
### Flag related macros:
* `GMOCK_DECLARE_bool_(name)`
* `GMOCK_DECLARE_int32_(name)`
* `GMOCK_DECLARE_string_(name)`
* `GMOCK_DEFINE_bool_(name, default_val, doc)`
* `GMOCK_DEFINE_int32_(name, default_val, doc)`
* `GMOCK_DEFINE_string_(name, default_val, doc)`

View File

@@ -2,6 +2,8 @@
// pump.py gmock-generated-actions.h.pump // pump.py gmock-generated-actions.h.pump
// DO NOT EDIT BY HAND!!! // DO NOT EDIT BY HAND!!!
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_

View File

@@ -1,9 +1,11 @@
$$ -*- mode: c++; -*- $$ -*- mode: c++; -*-
$$ This is a Pump source file (http://go/pump). Please use Pump to convert $$ This is a Pump source file. Please use Pump to convert
$$ it to callback-actions.h. $$ it to callback-actions.h.
$$ $$
$var max_callback_arity = 5 $var max_callback_arity = 5
$$}} This meta comment fixes auto-indentation in editors. $$}} This meta comment fixes auto-indentation in editors.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_

View File

@@ -27,13 +27,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// ============================================================ // Injection point for custom user configurations. See README for details
// An installation-specific extension point for gmock-matchers.h.
// ============================================================
// //
// Adds google3 callback support to CallableTraits. // GOOGLETEST_CM0002 DO NOT DELETE
//
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_CALLBACK_MATCHERS_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_CALLBACK_MATCHERS_H_
#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_CALLBACK_MATCHERS_H_ #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_
#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_

View File

@@ -27,19 +27,12 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// Injection point for custom user configurations. // Injection point for custom user configurations. See README for details
// The following macros can be defined:
//
// Flag related macros:
// GMOCK_DECLARE_bool_(name)
// GMOCK_DECLARE_int32_(name)
// GMOCK_DECLARE_string_(name)
// GMOCK_DEFINE_bool_(name, default_val, doc)
// GMOCK_DEFINE_int32_(name, default_val, doc)
// GMOCK_DEFINE_string_(name, default_val, doc)
// //
// ** Custom implementation starts here ** // ** Custom implementation starts here **
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_ #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_ #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_

Some files were not shown because too many files have changed in this diff Show More