| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_H_ |
| 37 |
#define GMOCK_INCLUDE_GMOCK_GMOCK_H_ |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ |
| 94 |
#define GMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ |
| 95 |
|
| 96 |
#ifndef _WIN32_WCE |
| 97 |
# include <errno.h> |
| 98 |
#endif |
| 99 |
|
| 100 |
#include <algorithm> |
| 101 |
#include <string> |
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_ |
| 141 |
#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_ |
| 142 |
|
| 143 |
#include <stdio.h> |
| 144 |
#include <ostream> |
| 145 |
#include <string> |
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_ |
| 188 |
#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_ |
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_ |
| 226 |
#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_ |
| 227 |
|
| 228 |
#include <assert.h> |
| 229 |
#include <stdlib.h> |
| 230 |
#include <iostream> |
| 231 |
|
| 232 |
|
| 233 |
|
| 234 |
#include "gtest/gtest.h" |
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
#if defined(_MSC_VER) && _MSC_VER < 1310 |
| 244 |
# error "At least Visual C++ 2003 (7.1) is required to compile Google Mock." |
| 245 |
#endif |
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
#define GMOCK_FLAG(name) FLAGS_gmock_##name |
| 250 |
|
| 251 |
|
| 252 |
#define GMOCK_DECLARE_bool_(name) extern GTEST_API_ bool GMOCK_FLAG(name) |
| 253 |
#define GMOCK_DECLARE_int32_(name) \ |
| 254 |
extern GTEST_API_ ::testing::internal::Int32 GMOCK_FLAG(name) |
| 255 |
#define GMOCK_DECLARE_string_(name) \ |
| 256 |
extern GTEST_API_ ::std::string GMOCK_FLAG(name) |
| 257 |
|
| 258 |
|
| 259 |
#define GMOCK_DEFINE_bool_(name, default_val, doc) \ |
| 260 |
GTEST_API_ bool GMOCK_FLAG(name) = (default_val) |
| 261 |
#define GMOCK_DEFINE_int32_(name, default_val, doc) \ |
| 262 |
GTEST_API_ ::testing::internal::Int32 GMOCK_FLAG(name) = (default_val) |
| 263 |
#define GMOCK_DEFINE_string_(name, default_val, doc) \ |
| 264 |
GTEST_API_ ::std::string GMOCK_FLAG(name) = (default_val) |
| 265 |
|
| 266 |
#endif |
| 267 |
|
| 268 |
namespace testing { |
| 269 |
|
| 270 |
template <typename T> |
| 271 |
class Matcher; |
| 272 |
|
| 273 |
namespace internal { |
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
class IgnoredValue { |
| 278 |
public: |
| 279 |
|
| 280 |
|
| 281 |
|
| 282 |
|
| 283 |
|
| 284 |
template <typename T> |
| 285 |
IgnoredValue(const T& ) {} |
| 286 |
}; |
| 287 |
|
| 288 |
|
| 289 |
|
| 290 |
template <typename Tuple> |
| 291 |
struct MatcherTuple; |
| 292 |
|
| 293 |
template <> |
| 294 |
struct MatcherTuple< ::std::tr1::tuple<> > { |
| 295 |
typedef ::std::tr1::tuple< > type; |
| 296 |
}; |
| 297 |
|
| 298 |
template <typename A1> |
| 299 |
struct MatcherTuple< ::std::tr1::tuple<A1> > { |
| 300 |
typedef ::std::tr1::tuple<Matcher<A1> > type; |
| 301 |
}; |
| 302 |
|
| 303 |
template <typename A1, typename A2> |
| 304 |
struct MatcherTuple< ::std::tr1::tuple<A1, A2> > { |
| 305 |
typedef ::std::tr1::tuple<Matcher<A1>, Matcher<A2> > type; |
| 306 |
}; |
| 307 |
|
| 308 |
template <typename A1, typename A2, typename A3> |
| 309 |
struct MatcherTuple< ::std::tr1::tuple<A1, A2, A3> > { |
| 310 |
typedef ::std::tr1::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3> > type; |
| 311 |
}; |
| 312 |
|
| 313 |
template <typename A1, typename A2, typename A3, typename A4> |
| 314 |
struct MatcherTuple< ::std::tr1::tuple<A1, A2, A3, A4> > { |
| 315 |
typedef ::std::tr1::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, |
| 316 |
Matcher<A4> > type; |
| 317 |
}; |
| 318 |
|
| 319 |
template <typename A1, typename A2, typename A3, typename A4, typename A5> |
| 320 |
struct MatcherTuple< ::std::tr1::tuple<A1, A2, A3, A4, A5> > { |
| 321 |
typedef ::std::tr1::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>, |
| 322 |
Matcher<A5> > type; |
| 323 |
}; |
| 324 |
|
| 325 |
template <typename A1, typename A2, typename A3, typename A4, typename A5, |
| 326 |
typename A6> |
| 327 |
struct MatcherTuple< ::std::tr1::tuple<A1, A2, A3, A4, A5, A6> > { |
| 328 |
typedef ::std::tr1::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>, |
| 329 |
Matcher<A5>, Matcher<A6> > type; |
| 330 |
}; |
| 331 |
|
| 332 |
template <typename A1, typename A2, typename A3, typename A4, typename A5, |
| 333 |
typename A6, typename A7> |
| 334 |
struct MatcherTuple< ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7> > { |
| 335 |
typedef ::std::tr1::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>, |
| 336 |
Matcher<A5>, Matcher<A6>, Matcher<A7> > type; |
| 337 |
}; |
| 338 |
|
| 339 |
template <typename A1, typename A2, typename A3, typename A4, typename A5, |
| 340 |
typename A6, typename A7, typename A8> |
| 341 |
struct MatcherTuple< ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8> > { |
| 342 |
typedef ::std::tr1::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>, |
| 343 |
Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8> > type; |
| 344 |
}; |
| 345 |
|
| 346 |
template <typename A1, typename A2, typename A3, typename A4, typename A5, |
| 347 |
typename A6, typename A7, typename A8, typename A9> |
| 348 |
struct MatcherTuple< ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> > { |
| 349 |
typedef ::std::tr1::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>, |
| 350 |
Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8>, Matcher<A9> > type; |
| 351 |
}; |
| 352 |
|
| 353 |
template <typename A1, typename A2, typename A3, typename A4, typename A5, |
| 354 |
typename A6, typename A7, typename A8, typename A9, typename A10> |
| 355 |
struct MatcherTuple< ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9, |
| 356 |
A10> > { |
| 357 |
typedef ::std::tr1::tuple<Matcher<A1>, Matcher<A2>, Matcher<A3>, Matcher<A4>, |
| 358 |
Matcher<A5>, Matcher<A6>, Matcher<A7>, Matcher<A8>, Matcher<A9>, |
| 359 |
Matcher<A10> > type; |
| 360 |
}; |
| 361 |
|
| 362 |
|
| 363 |
|
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
template <typename F> |
| 376 |
struct Function; |
| 377 |
|
| 378 |
template <typename R> |
| 379 |
struct Function<R()> { |
| 380 |
typedef R Result; |
| 381 |
typedef ::std::tr1::tuple<> ArgumentTuple; |
| 382 |
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple; |
| 383 |
typedef void MakeResultVoid(); |
| 384 |
typedef IgnoredValue MakeResultIgnoredValue(); |
| 385 |
}; |
| 386 |
|
| 387 |
template <typename R, typename A1> |
| 388 |
struct Function<R(A1)> |
| 389 |
: Function<R()> { |
| 390 |
typedef A1 Argument1; |
| 391 |
typedef ::std::tr1::tuple<A1> ArgumentTuple; |
| 392 |
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple; |
| 393 |
typedef void MakeResultVoid(A1); |
| 394 |
typedef IgnoredValue MakeResultIgnoredValue(A1); |
| 395 |
}; |
| 396 |
|
| 397 |
template <typename R, typename A1, typename A2> |
| 398 |
struct Function<R(A1, A2)> |
| 399 |
: Function<R(A1)> { |
| 400 |
typedef A2 Argument2; |
| 401 |
typedef ::std::tr1::tuple<A1, A2> ArgumentTuple; |
| 402 |
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple; |
| 403 |
typedef void MakeResultVoid(A1, A2); |
| 404 |
typedef IgnoredValue MakeResultIgnoredValue(A1, A2); |
| 405 |
}; |
| 406 |
|
| 407 |
template <typename R, typename A1, typename A2, typename A3> |
| 408 |
struct Function<R(A1, A2, A3)> |
| 409 |
: Function<R(A1, A2)> { |
| 410 |
typedef A3 Argument3; |
| 411 |
typedef ::std::tr1::tuple<A1, A2, A3> ArgumentTuple; |
| 412 |
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple; |
| 413 |
typedef void MakeResultVoid(A1, A2, A3); |
| 414 |
typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3); |
| 415 |
}; |
| 416 |
|
| 417 |
template <typename R, typename A1, typename A2, typename A3, typename A4> |
| 418 |
struct Function<R(A1, A2, A3, A4)> |
| 419 |
: Function<R(A1, A2, A3)> { |
| 420 |
typedef A4 Argument4; |
| 421 |
typedef ::std::tr1::tuple<A1, A2, A3, A4> ArgumentTuple; |
| 422 |
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple; |
| 423 |
typedef void MakeResultVoid(A1, A2, A3, A4); |
| 424 |
typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4); |
| 425 |
}; |
| 426 |
|
| 427 |
template <typename R, typename A1, typename A2, typename A3, typename A4, |
| 428 |
typename A5> |
| 429 |
struct Function<R(A1, A2, A3, A4, A5)> |
| 430 |
: Function<R(A1, A2, A3, A4)> { |
| 431 |
typedef A5 Argument5; |
| 432 |
typedef ::std::tr1::tuple<A1, A2, A3, A4, A5> ArgumentTuple; |
| 433 |
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple; |
| 434 |
typedef void MakeResultVoid(A1, A2, A3, A4, A5); |
| 435 |
typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5); |
| 436 |
}; |
| 437 |
|
| 438 |
template <typename R, typename A1, typename A2, typename A3, typename A4, |
| 439 |
typename A5, typename A6> |
| 440 |
struct Function<R(A1, A2, A3, A4, A5, A6)> |
| 441 |
: Function<R(A1, A2, A3, A4, A5)> { |
| 442 |
typedef A6 Argument6; |
| 443 |
typedef ::std::tr1::tuple<A1, A2, A3, A4, A5, A6> ArgumentTuple; |
| 444 |
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple; |
| 445 |
typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6); |
| 446 |
typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6); |
| 447 |
}; |
| 448 |
|
| 449 |
template <typename R, typename A1, typename A2, typename A3, typename A4, |
| 450 |
typename A5, typename A6, typename A7> |
| 451 |
struct Function<R(A1, A2, A3, A4, A5, A6, A7)> |
| 452 |
: Function<R(A1, A2, A3, A4, A5, A6)> { |
| 453 |
typedef A7 Argument7; |
| 454 |
typedef ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7> ArgumentTuple; |
| 455 |
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple; |
| 456 |
typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7); |
| 457 |
typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7); |
| 458 |
}; |
| 459 |
|
| 460 |
template <typename R, typename A1, typename A2, typename A3, typename A4, |
| 461 |
typename A5, typename A6, typename A7, typename A8> |
| 462 |
struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8)> |
| 463 |
: Function<R(A1, A2, A3, A4, A5, A6, A7)> { |
| 464 |
typedef A8 Argument8; |
| 465 |
typedef ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8> ArgumentTuple; |
| 466 |
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple; |
| 467 |
typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8); |
| 468 |
typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8); |
| 469 |
}; |
| 470 |
|
| 471 |
template <typename R, typename A1, typename A2, typename A3, typename A4, |
| 472 |
typename A5, typename A6, typename A7, typename A8, typename A9> |
| 473 |
struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> |
| 474 |
: Function<R(A1, A2, A3, A4, A5, A6, A7, A8)> { |
| 475 |
typedef A9 Argument9; |
| 476 |
typedef ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> ArgumentTuple; |
| 477 |
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple; |
| 478 |
typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8, A9); |
| 479 |
typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8, |
| 480 |
A9); |
| 481 |
}; |
| 482 |
|
| 483 |
template <typename R, typename A1, typename A2, typename A3, typename A4, |
| 484 |
typename A5, typename A6, typename A7, typename A8, typename A9, |
| 485 |
typename A10> |
| 486 |
struct Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> |
| 487 |
: Function<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> { |
| 488 |
typedef A10 Argument10; |
| 489 |
typedef ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9, |
| 490 |
A10> ArgumentTuple; |
| 491 |
typedef typename MatcherTuple<ArgumentTuple>::type ArgumentMatcherTuple; |
| 492 |
typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10); |
| 493 |
typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8, |
| 494 |
A9, A10); |
| 495 |
}; |
| 496 |
|
| 497 |
} |
| 498 |
|
| 499 |
} |
| 500 |
|
| 501 |
#endif |
| 502 |
|
| 503 |
namespace testing { |
| 504 |
namespace internal { |
| 505 |
|
| 506 |
|
| 507 |
|
| 508 |
|
| 509 |
|
| 510 |
GTEST_API_ string ConvertIdentifierNameToWords(const char* id_name); |
| 511 |
|
| 512 |
|
| 513 |
|
| 514 |
|
| 515 |
|
| 516 |
template <typename Pointer> |
| 517 |
struct PointeeOf { |
| 518 |
|
| 519 |
|
| 520 |
typedef typename Pointer::element_type type; |
| 521 |
}; |
| 522 |
|
| 523 |
template <typename T> |
| 524 |
struct PointeeOf<T*> { typedef T type; }; |
| 525 |
|
| 526 |
|
| 527 |
|
| 528 |
|
| 529 |
template <typename Pointer> |
| 530 |
inline const typename Pointer::element_type* GetRawPointer(const Pointer& p) { |
| 531 |
return p.get(); |
| 532 |
} |
| 533 |
|
| 534 |
template <typename Element> |
| 535 |
inline Element* GetRawPointer(Element* p) { return p; } |
| 536 |
|
| 537 |
|
| 538 |
template <typename T> |
| 539 |
struct LinkedPtrLessThan { |
| 540 |
bool operator()(const ::testing::internal::linked_ptr<T>& lhs, |
| 541 |
const ::testing::internal::linked_ptr<T>& rhs) const { |
| 542 |
return lhs.get() < rhs.get(); |
| 543 |
} |
| 544 |
}; |
| 545 |
|
| 546 |
|
| 547 |
|
| 548 |
|
| 549 |
|
| 550 |
|
| 551 |
|
| 552 |
|
| 553 |
|
| 554 |
#if (GTEST_OS_SYMBIAN && defined(_STLP_NO_WCHAR_T)) || \ |
| 555 |
(defined(_MSC_VER) && !defined(_NATIVE_WCHAR_T_DEFINED)) |
| 556 |
|
| 557 |
#else |
| 558 |
# define GMOCK_WCHAR_T_IS_NATIVE_ 1 |
| 559 |
#endif |
| 560 |
|
| 561 |
|
| 562 |
|
| 563 |
|
| 564 |
|
| 565 |
|
| 566 |
|
| 567 |
|
| 568 |
|
| 569 |
|
| 570 |
#ifdef __GNUC__ |
| 571 |
|
| 572 |
# define GMOCK_HAS_SIGNED_WCHAR_T_ 1 |
| 573 |
#endif |
| 574 |
|
| 575 |
|
| 576 |
|
| 577 |
|
| 578 |
|
| 579 |
|
| 580 |
enum TypeKind { |
| 581 |
kBool, kInteger, kFloatingPoint, kOther |
| 582 |
}; |
| 583 |
|
| 584 |
|
| 585 |
template <typename T> struct KindOf { |
| 586 |
enum { value = kOther }; |
| 587 |
}; |
| 588 |
|
| 589 |
|
| 590 |
#define GMOCK_DECLARE_KIND_(type, kind) \ |
| 591 |
template <> struct KindOf<type> { enum { value = kind }; } |
| 592 |
|
| 593 |
GMOCK_DECLARE_KIND_(bool, kBool); |
| 594 |
|
| 595 |
|
| 596 |
GMOCK_DECLARE_KIND_(char, kInteger); |
| 597 |
GMOCK_DECLARE_KIND_(signed char, kInteger); |
| 598 |
GMOCK_DECLARE_KIND_(unsigned char, kInteger); |
| 599 |
GMOCK_DECLARE_KIND_(short, kInteger); |
| 600 |
GMOCK_DECLARE_KIND_(unsigned short, kInteger); |
| 601 |
GMOCK_DECLARE_KIND_(int, kInteger); |
| 602 |
GMOCK_DECLARE_KIND_(unsigned int, kInteger); |
| 603 |
GMOCK_DECLARE_KIND_(long, kInteger); |
| 604 |
GMOCK_DECLARE_KIND_(unsigned long, kInteger); |
| 605 |
|
| 606 |
#if GMOCK_WCHAR_T_IS_NATIVE_ |
| 607 |
GMOCK_DECLARE_KIND_(wchar_t, kInteger); |
| 608 |
#endif |
| 609 |
|
| 610 |
|
| 611 |
GMOCK_DECLARE_KIND_(Int64, kInteger); |
| 612 |
GMOCK_DECLARE_KIND_(UInt64, kInteger); |
| 613 |
|
| 614 |
|
| 615 |
GMOCK_DECLARE_KIND_(float, kFloatingPoint); |
| 616 |
GMOCK_DECLARE_KIND_(double, kFloatingPoint); |
| 617 |
GMOCK_DECLARE_KIND_(long double, kFloatingPoint); |
| 618 |
|
| 619 |
#undef GMOCK_DECLARE_KIND_ |
| 620 |
|
| 621 |
|
| 622 |
#define GMOCK_KIND_OF_(type) \ |
| 623 |
static_cast< ::testing::internal::TypeKind>( \ |
| 624 |
::testing::internal::KindOf<type>::value) |
| 625 |
|
| 626 |
|
| 627 |
#define GMOCK_IS_SIGNED_(T) (static_cast<T>(-1) < 0) |
| 628 |
|
| 629 |
|
| 630 |
|
| 631 |
|
| 632 |
|
| 633 |
|
| 634 |
|
| 635 |
|
| 636 |
|
| 637 |
|
| 638 |
template <TypeKind kFromKind, typename From, TypeKind kToKind, typename To> |
| 639 |
struct LosslessArithmeticConvertibleImpl : public false_type {}; |
| 640 |
|
| 641 |
|
| 642 |
template <> |
| 643 |
struct LosslessArithmeticConvertibleImpl<kBool, bool, kBool, bool> |
| 644 |
: public true_type {}; |
| 645 |
|
| 646 |
|
| 647 |
template <typename To> |
| 648 |
struct LosslessArithmeticConvertibleImpl<kBool, bool, kInteger, To> |
| 649 |
: public true_type {}; |
| 650 |
|
| 651 |
|
| 652 |
template <typename To> |
| 653 |
struct LosslessArithmeticConvertibleImpl<kBool, bool, kFloatingPoint, To> |
| 654 |
: public true_type {}; |
| 655 |
|
| 656 |
|
| 657 |
template <typename From> |
| 658 |
struct LosslessArithmeticConvertibleImpl<kInteger, From, kBool, bool> |
| 659 |
: public false_type {}; |
| 660 |
|
| 661 |
|
| 662 |
|
| 663 |
template <typename From, typename To> |
| 664 |
struct LosslessArithmeticConvertibleImpl<kInteger, From, kInteger, To> |
| 665 |
: public bool_constant< |
| 666 |
|
| 667 |
|
| 668 |
((sizeof(From) < sizeof(To)) && |
| 669 |
(!GMOCK_IS_SIGNED_(From) || GMOCK_IS_SIGNED_(To))) || |
| 670 |
|
| 671 |
((sizeof(From) == sizeof(To)) && |
| 672 |
(GMOCK_IS_SIGNED_(From) == GMOCK_IS_SIGNED_(To)))> {}; |
| 673 |
|
| 674 |
#undef GMOCK_IS_SIGNED_ |
| 675 |
|
| 676 |
|
| 677 |
|
| 678 |
template <typename From, typename To> |
| 679 |
struct LosslessArithmeticConvertibleImpl<kInteger, From, kFloatingPoint, To> |
| 680 |
: public false_type {}; |
| 681 |
|
| 682 |
|
| 683 |
template <typename From> |
| 684 |
struct LosslessArithmeticConvertibleImpl<kFloatingPoint, From, kBool, bool> |
| 685 |
: public false_type {}; |
| 686 |
|
| 687 |
|
| 688 |
template <typename From, typename To> |
| 689 |
struct LosslessArithmeticConvertibleImpl<kFloatingPoint, From, kInteger, To> |
| 690 |
: public false_type {}; |
| 691 |
|
| 692 |
|
| 693 |
|
| 694 |
template <typename From, typename To> |
| 695 |
struct LosslessArithmeticConvertibleImpl< |
| 696 |
kFloatingPoint, From, kFloatingPoint, To> |
| 697 |
: public bool_constant<sizeof(From) <= sizeof(To)> {}; |
| 698 |
|
| 699 |
|
| 700 |
|
| 701 |
|
| 702 |
|
| 703 |
|
| 704 |
|
| 705 |
|
| 706 |
template <typename From, typename To> |
| 707 |
struct LosslessArithmeticConvertible |
| 708 |
: public LosslessArithmeticConvertibleImpl< |
| 709 |
GMOCK_KIND_OF_(From), From, GMOCK_KIND_OF_(To), To> {}; |
| 710 |
|
| 711 |
|
| 712 |
|
| 713 |
class FailureReporterInterface { |
| 714 |
public: |
| 715 |
|
| 716 |
enum FailureType { |
| 717 |
kNonfatal, kFatal |
| 718 |
}; |
| 719 |
|
| 720 |
virtual ~FailureReporterInterface() {} |
| 721 |
|
| 722 |
|
| 723 |
virtual void ReportFailure(FailureType type, const char* file, int line, |
| 724 |
const string& message) = 0; |
| 725 |
}; |
| 726 |
|
| 727 |
|
| 728 |
GTEST_API_ FailureReporterInterface* GetFailureReporter(); |
| 729 |
|
| 730 |
|
| 731 |
|
| 732 |
|
| 733 |
|
| 734 |
|
| 735 |
inline void Assert(bool condition, const char* file, int line, |
| 736 |
const string& msg) { |
| 737 |
if (!condition) { |
| 738 |
GetFailureReporter()->ReportFailure(FailureReporterInterface::kFatal, |
| 739 |
file, line, msg); |
| 740 |
} |
| 741 |
} |
| 742 |
inline void Assert(bool condition, const char* file, int line) { |
| 743 |
Assert(condition, file, line, "Assertion failed."); |
| 744 |
} |
| 745 |
|
| 746 |
|
| 747 |
|
| 748 |
inline void Expect(bool condition, const char* file, int line, |
| 749 |
const string& msg) { |
| 750 |
if (!condition) { |
| 751 |
GetFailureReporter()->ReportFailure(FailureReporterInterface::kNonfatal, |
| 752 |
file, line, msg); |
| 753 |
} |
| 754 |
} |
| 755 |
inline void Expect(bool condition, const char* file, int line) { |
| 756 |
Expect(condition, file, line, "Expectation failed."); |
| 757 |
} |
| 758 |
|
| 759 |
|
| 760 |
enum LogSeverity { |
| 761 |
kInfo = 0, |
| 762 |
kWarning = 1 |
| 763 |
}; |
| 764 |
|
| 765 |
|
| 766 |
|
| 767 |
|
| 768 |
const char kInfoVerbosity[] = "info"; |
| 769 |
|
| 770 |
const char kWarningVerbosity[] = "warning"; |
| 771 |
|
| 772 |
const char kErrorVerbosity[] = "error"; |
| 773 |
|
| 774 |
|
| 775 |
|
| 776 |
GTEST_API_ bool LogIsVisible(LogSeverity severity); |
| 777 |
|
| 778 |
|
| 779 |
|
| 780 |
|
| 781 |
|
| 782 |
|
| 783 |
|
| 784 |
|
| 785 |
GTEST_API_ void Log(LogSeverity severity, |
| 786 |
const string& message, |
| 787 |
int stack_frames_to_skip); |
| 788 |
|
| 789 |
|
| 790 |
|
| 791 |
|
| 792 |
|
| 793 |
|
| 794 |
template <typename T> struct is_reference : public false_type {}; |
| 795 |
template <typename T> struct is_reference<T&> : public true_type {}; |
| 796 |
|
| 797 |
|
| 798 |
template <typename T1, typename T2> struct type_equals : public false_type {}; |
| 799 |
template <typename T> struct type_equals<T, T> : public true_type {}; |
| 800 |
|
| 801 |
|
| 802 |
template <typename T> struct remove_reference { typedef T type; }; |
| 803 |
template <typename T> struct remove_reference<T&> { typedef T type; }; |
| 804 |
|
| 805 |
|
| 806 |
|
| 807 |
template <typename T> struct DecayArray { typedef T type; }; |
| 808 |
template <typename T, size_t N> struct DecayArray<T[N]> { |
| 809 |
typedef const T* type; |
| 810 |
}; |
| 811 |
|
| 812 |
|
| 813 |
|
| 814 |
template <typename T> struct DecayArray<T[]> { |
| 815 |
typedef const T* type; |
| 816 |
}; |
| 817 |
|
| 818 |
|
| 819 |
|
| 820 |
|
| 821 |
|
| 822 |
template <typename T> |
| 823 |
inline T Invalid() { |
| 824 |
return const_cast<typename remove_reference<T>::type&>( |
| 825 |
*static_cast<volatile typename remove_reference<T>::type*>(NULL)); |
| 826 |
} |
| 827 |
template <> |
| 828 |
inline void Invalid<void>() {} |
| 829 |
|
| 830 |
|
| 831 |
|
| 832 |
|
| 833 |
|
| 834 |
|
| 835 |
|
| 836 |
|
| 837 |
|
| 838 |
|
| 839 |
|
| 840 |
|
| 841 |
|
| 842 |
|
| 843 |
|
| 844 |
|
| 845 |
|
| 846 |
template <class RawContainer> |
| 847 |
class StlContainerView { |
| 848 |
public: |
| 849 |
typedef RawContainer type; |
| 850 |
typedef const type& const_reference; |
| 851 |
|
| 852 |
static const_reference ConstReference(const RawContainer& container) { |
| 853 |
|
| 854 |
testing::StaticAssertTypeEq<RawContainer, |
| 855 |
GTEST_REMOVE_CONST_(RawContainer)>(); |
| 856 |
return container; |
| 857 |
} |
| 858 |
static type Copy(const RawContainer& container) { return container; } |
| 859 |
}; |
| 860 |
|
| 861 |
|
| 862 |
template <typename Element, size_t N> |
| 863 |
class StlContainerView<Element[N]> { |
| 864 |
public: |
| 865 |
typedef GTEST_REMOVE_CONST_(Element) RawElement; |
| 866 |
typedef internal::NativeArray<RawElement> type; |
| 867 |
|
| 868 |
|
| 869 |
|
| 870 |
|
| 871 |
|
| 872 |
typedef const type const_reference; |
| 873 |
|
| 874 |
static const_reference ConstReference(const Element (&array)[N]) { |
| 875 |
|
| 876 |
testing::StaticAssertTypeEq<Element, RawElement>(); |
| 877 |
#if GTEST_OS_SYMBIAN |
| 878 |
|
| 879 |
|
| 880 |
|
| 881 |
|
| 882 |
|
| 883 |
|
| 884 |
|
| 885 |
|
| 886 |
|
| 887 |
|
| 888 |
|
| 889 |
|
| 890 |
|
| 891 |
return type(const_cast<Element*>(&array[0]), N, kReference); |
| 892 |
#else |
| 893 |
return type(array, N, kReference); |
| 894 |
#endif |
| 895 |
} |
| 896 |
static type Copy(const Element (&array)[N]) { |
| 897 |
#if GTEST_OS_SYMBIAN |
| 898 |
return type(const_cast<Element*>(&array[0]), N, kCopy); |
| 899 |
#else |
| 900 |
return type(array, N, kCopy); |
| 901 |
#endif |
| 902 |
} |
| 903 |
}; |
| 904 |
|
| 905 |
|
| 906 |
|
| 907 |
template <typename ElementPointer, typename Size> |
| 908 |
class StlContainerView< ::std::tr1::tuple<ElementPointer, Size> > { |
| 909 |
public: |
| 910 |
typedef GTEST_REMOVE_CONST_( |
| 911 |
typename internal::PointeeOf<ElementPointer>::type) RawElement; |
| 912 |
typedef internal::NativeArray<RawElement> type; |
| 913 |
typedef const type const_reference; |
| 914 |
|
| 915 |
static const_reference ConstReference( |
| 916 |
const ::std::tr1::tuple<ElementPointer, Size>& array) { |
| 917 |
using ::std::tr1::get; |
| 918 |
return type(get<0>(array), get<1>(array), kReference); |
| 919 |
} |
| 920 |
static type Copy(const ::std::tr1::tuple<ElementPointer, Size>& array) { |
| 921 |
using ::std::tr1::get; |
| 922 |
return type(get<0>(array), get<1>(array), kCopy); |
| 923 |
} |
| 924 |
}; |
| 925 |
|
| 926 |
|
| 927 |
|
| 928 |
template <typename T> class StlContainerView<T&>; |
| 929 |
|
| 930 |
|
| 931 |
|
| 932 |
|
| 933 |
template <typename T> |
| 934 |
struct RemoveConstFromKey { |
| 935 |
typedef T type; |
| 936 |
}; |
| 937 |
|
| 938 |
|
| 939 |
template <typename K, typename V> |
| 940 |
struct RemoveConstFromKey<std::pair<const K, V> > { |
| 941 |
typedef std::pair<K, V> type; |
| 942 |
}; |
| 943 |
|
| 944 |
|
| 945 |
|
| 946 |
template <bool kValue> |
| 947 |
struct BooleanConstant {}; |
| 948 |
|
| 949 |
} |
| 950 |
} |
| 951 |
|
| 952 |
#endif |
| 953 |
|
| 954 |
namespace testing { |
| 955 |
|
| 956 |
|
| 957 |
|
| 958 |
|
| 959 |
|
| 960 |
|
| 961 |
|
| 962 |
|
| 963 |
|
| 964 |
|
| 965 |
namespace internal { |
| 966 |
|
| 967 |
template <typename F1, typename F2> |
| 968 |
class ActionAdaptor; |
| 969 |
|
| 970 |
|
| 971 |
|
| 972 |
|
| 973 |
|
| 974 |
|
| 975 |
template <typename T> |
| 976 |
class BuiltInDefaultValue { |
| 977 |
public: |
| 978 |
|
| 979 |
static bool Exists() { return false; } |
| 980 |
static T Get() { |
| 981 |
Assert(false, __FILE__, __LINE__, |
| 982 |
"Default action undefined for the function return type."); |
| 983 |
return internal::Invalid<T>(); |
| 984 |
|
| 985 |
|
| 986 |
} |
| 987 |
}; |
| 988 |
|
| 989 |
|
| 990 |
|
| 991 |
template <typename T> |
| 992 |
class BuiltInDefaultValue<const T> { |
| 993 |
public: |
| 994 |
static bool Exists() { return BuiltInDefaultValue<T>::Exists(); } |
| 995 |
static T Get() { return BuiltInDefaultValue<T>::Get(); } |
| 996 |
}; |
| 997 |
|
| 998 |
|
| 999 |
|
| 1000 |
template <typename T> |
| 1001 |
class BuiltInDefaultValue<T*> { |
| 1002 |
public: |
| 1003 |
static bool Exists() { return true; } |
| 1004 |
static T* Get() { return NULL; } |
| 1005 |
}; |
| 1006 |
|
| 1007 |
|
| 1008 |
|
| 1009 |
#define GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(type, value) \ |
| 1010 |
template <> \ |
| 1011 |
class BuiltInDefaultValue<type> { \ |
| 1012 |
public: \ |
| 1013 |
static bool Exists() { return true; } \ |
| 1014 |
static type Get() { return value; } \ |
| 1015 |
} |
| 1016 |
|
| 1017 |
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(void, ); |
| 1018 |
#if GTEST_HAS_GLOBAL_STRING |
| 1019 |
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(::string, ""); |
| 1020 |
#endif |
| 1021 |
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(::std::string, ""); |
| 1022 |
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(bool, false); |
| 1023 |
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned char, '\0'); |
| 1024 |
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed char, '\0'); |
| 1025 |
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(char, '\0'); |
| 1026 |
|
| 1027 |
|
| 1028 |
|
| 1029 |
|
| 1030 |
|
| 1031 |
|
| 1032 |
|
| 1033 |
#if GMOCK_WCHAR_T_IS_NATIVE_ |
| 1034 |
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(wchar_t, 0U); |
| 1035 |
#endif |
| 1036 |
|
| 1037 |
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned short, 0U); |
| 1038 |
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed short, 0); |
| 1039 |
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned int, 0U); |
| 1040 |
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed int, 0); |
| 1041 |
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned long, 0UL); |
| 1042 |
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed long, 0L); |
| 1043 |
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(UInt64, 0); |
| 1044 |
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(Int64, 0); |
| 1045 |
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(float, 0); |
| 1046 |
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(double, 0); |
| 1047 |
|
| 1048 |
#undef GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ |
| 1049 |
|
| 1050 |
} |
| 1051 |
|
| 1052 |
|
| 1053 |
|
| 1054 |
|
| 1055 |
|
| 1056 |
|
| 1057 |
|
| 1058 |
|
| 1059 |
|
| 1060 |
|
| 1061 |
|
| 1062 |
|
| 1063 |
|
| 1064 |
|
| 1065 |
template <typename T> |
| 1066 |
class DefaultValue { |
| 1067 |
public: |
| 1068 |
|
| 1069 |
|
| 1070 |
static void Set(T x) { |
| 1071 |
delete value_; |
| 1072 |
value_ = new T(x); |
| 1073 |
} |
| 1074 |
|
| 1075 |
|
| 1076 |
static void Clear() { |
| 1077 |
delete value_; |
| 1078 |
value_ = NULL; |
| 1079 |
} |
| 1080 |
|
| 1081 |
|
| 1082 |
static bool IsSet() { return value_ != NULL; } |
| 1083 |
|
| 1084 |
|
| 1085 |
|
| 1086 |
static bool Exists() { |
| 1087 |
return IsSet() || internal::BuiltInDefaultValue<T>::Exists(); |
| 1088 |
} |
| 1089 |
|
| 1090 |
|
| 1091 |
|
| 1092 |
|
| 1093 |
static T Get() { |
| 1094 |
return value_ == NULL ? |
| 1095 |
internal::BuiltInDefaultValue<T>::Get() : *value_; |
| 1096 |
} |
| 1097 |
|
| 1098 |
private: |
| 1099 |
static const T* value_; |
| 1100 |
}; |
| 1101 |
|
| 1102 |
|
| 1103 |
|
| 1104 |
template <typename T> |
| 1105 |
class DefaultValue<T&> { |
| 1106 |
public: |
| 1107 |
|
| 1108 |
static void Set(T& x) { |
| 1109 |
address_ = &x; |
| 1110 |
} |
| 1111 |
|
| 1112 |
|
| 1113 |
static void Clear() { |
| 1114 |
address_ = NULL; |
| 1115 |
} |
| 1116 |
|
| 1117 |
|
| 1118 |
static bool IsSet() { return address_ != NULL; } |
| 1119 |
|
| 1120 |
|
| 1121 |
|
| 1122 |
static bool Exists() { |
| 1123 |
return IsSet() || internal::BuiltInDefaultValue<T&>::Exists(); |
| 1124 |
} |
| 1125 |
|
| 1126 |
|
| 1127 |
|
| 1128 |
|
| 1129 |
static T& Get() { |
| 1130 |
return address_ == NULL ? |
| 1131 |
internal::BuiltInDefaultValue<T&>::Get() : *address_; |
| 1132 |
} |
| 1133 |
|
| 1134 |
private: |
| 1135 |
static T* address_; |
| 1136 |
}; |
| 1137 |
|
| 1138 |
|
| 1139 |
|
| 1140 |
template <> |
| 1141 |
class DefaultValue<void> { |
| 1142 |
public: |
| 1143 |
static bool Exists() { return true; } |
| 1144 |
static void Get() {} |
| 1145 |
}; |
| 1146 |
|
| 1147 |
|
| 1148 |
template <typename T> |
| 1149 |
const T* DefaultValue<T>::value_ = NULL; |
| 1150 |
|
| 1151 |
|
| 1152 |
template <typename T> |
| 1153 |
T* DefaultValue<T&>::address_ = NULL; |
| 1154 |
|
| 1155 |
|
| 1156 |
template <typename F> |
| 1157 |
class ActionInterface { |
| 1158 |
public: |
| 1159 |
typedef typename internal::Function<F>::Result Result; |
| 1160 |
typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; |
| 1161 |
|
| 1162 |
ActionInterface() {} |
| 1163 |
virtual ~ActionInterface() {} |
| 1164 |
|
| 1165 |
|
| 1166 |
|
| 1167 |
|
| 1168 |
|
| 1169 |
virtual Result Perform(const ArgumentTuple& args) = 0; |
| 1170 |
|
| 1171 |
private: |
| 1172 |
GTEST_DISALLOW_COPY_AND_ASSIGN_(ActionInterface); |
| 1173 |
}; |
| 1174 |
|
| 1175 |
|
| 1176 |
|
| 1177 |
|
| 1178 |
|
| 1179 |
|
| 1180 |
|
| 1181 |
|
| 1182 |
|
| 1183 |
|
| 1184 |
template <typename F> |
| 1185 |
class Action { |
| 1186 |
public: |
| 1187 |
typedef typename internal::Function<F>::Result Result; |
| 1188 |
typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; |
| 1189 |
|
| 1190 |
|
| 1191 |
|
| 1192 |
Action() : impl_(NULL) {} |
| 1193 |
|
| 1194 |
|
| 1195 |
|
| 1196 |
explicit Action(ActionInterface<F>* impl) : impl_(impl) {} |
| 1197 |
|
| 1198 |
|
| 1199 |
Action(const Action& action) : impl_(action.impl_) {} |
| 1200 |
|
| 1201 |
|
| 1202 |
|
| 1203 |
|
| 1204 |
|
| 1205 |
template <typename Func> |
| 1206 |
explicit Action(const Action<Func>& action); |
| 1207 |
|
| 1208 |
|
| 1209 |
bool IsDoDefault() const { return impl_.get() == NULL; } |
| 1210 |
|
| 1211 |
|
| 1212 |
|
| 1213 |
|
| 1214 |
|
| 1215 |
|
| 1216 |
|
| 1217 |
Result Perform(const ArgumentTuple& args) const { |
| 1218 |
internal::Assert( |
| 1219 |
!IsDoDefault(), __FILE__, __LINE__, |
| 1220 |
"You are using DoDefault() inside a composite action like " |
| 1221 |
"DoAll() or WithArgs(). This is not supported for technical " |
| 1222 |
"reasons. Please instead spell out the default action, or " |
| 1223 |
"assign the default action to an Action variable and use " |
| 1224 |
"the variable in various places."); |
| 1225 |
return impl_->Perform(args); |
| 1226 |
} |
| 1227 |
|
| 1228 |
private: |
| 1229 |
template <typename F1, typename F2> |
| 1230 |
friend class internal::ActionAdaptor; |
| 1231 |
|
| 1232 |
internal::linked_ptr<ActionInterface<F> > impl_; |
| 1233 |
}; |
| 1234 |
|
| 1235 |
|
| 1236 |
|
| 1237 |
|
| 1238 |
|
| 1239 |
|
| 1240 |
|
| 1241 |
|
| 1242 |
|
| 1243 |
|
| 1244 |
|
| 1245 |
|
| 1246 |
|
| 1247 |
|
| 1248 |
|
| 1249 |
|
| 1250 |
|
| 1251 |
|
| 1252 |
|
| 1253 |
|
| 1254 |
|
| 1255 |
|
| 1256 |
template <typename Impl> |
| 1257 |
class PolymorphicAction { |
| 1258 |
public: |
| 1259 |
explicit PolymorphicAction(const Impl& impl) : impl_(impl) {} |
| 1260 |
|
| 1261 |
template <typename F> |
| 1262 |
operator Action<F>() const { |
| 1263 |
return Action<F>(new MonomorphicImpl<F>(impl_)); |
| 1264 |
} |
| 1265 |
|
| 1266 |
private: |
| 1267 |
template <typename F> |
| 1268 |
class MonomorphicImpl : public ActionInterface<F> { |
| 1269 |
public: |
| 1270 |
typedef typename internal::Function<F>::Result Result; |
| 1271 |
typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; |
| 1272 |
|
| 1273 |
explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {} |
| 1274 |
|
| 1275 |
virtual Result Perform(const ArgumentTuple& args) { |
| 1276 |
return impl_.template Perform<Result>(args); |
| 1277 |
} |
| 1278 |
|
| 1279 |
private: |
| 1280 |
Impl impl_; |
| 1281 |
|
| 1282 |
GTEST_DISALLOW_ASSIGN_(MonomorphicImpl); |
| 1283 |
}; |
| 1284 |
|
| 1285 |
Impl impl_; |
| 1286 |
|
| 1287 |
GTEST_DISALLOW_ASSIGN_(PolymorphicAction); |
| 1288 |
}; |
| 1289 |
|
| 1290 |
|
| 1291 |
|
| 1292 |
template <typename F> |
| 1293 |
Action<F> MakeAction(ActionInterface<F>* impl) { |
| 1294 |
return Action<F>(impl); |
| 1295 |
} |
| 1296 |
|
| 1297 |
|
| 1298 |
|
| 1299 |
|
| 1300 |
|
| 1301 |
|
| 1302 |
|
| 1303 |
|
| 1304 |
template <typename Impl> |
| 1305 |
inline PolymorphicAction<Impl> MakePolymorphicAction(const Impl& impl) { |
| 1306 |
return PolymorphicAction<Impl>(impl); |
| 1307 |
} |
| 1308 |
|
| 1309 |
namespace internal { |
| 1310 |
|
| 1311 |
|
| 1312 |
|
| 1313 |
template <typename F1, typename F2> |
| 1314 |
class ActionAdaptor : public ActionInterface<F1> { |
| 1315 |
public: |
| 1316 |
typedef typename internal::Function<F1>::Result Result; |
| 1317 |
typedef typename internal::Function<F1>::ArgumentTuple ArgumentTuple; |
| 1318 |
|
| 1319 |
explicit ActionAdaptor(const Action<F2>& from) : impl_(from.impl_) {} |
| 1320 |
|
| 1321 |
virtual Result Perform(const ArgumentTuple& args) { |
| 1322 |
return impl_->Perform(args); |
| 1323 |
} |
| 1324 |
|
| 1325 |
private: |
| 1326 |
const internal::linked_ptr<ActionInterface<F2> > impl_; |
| 1327 |
|
| 1328 |
GTEST_DISALLOW_ASSIGN_(ActionAdaptor); |
| 1329 |
}; |
| 1330 |
|
| 1331 |
|
| 1332 |
|
| 1333 |
|
| 1334 |
|
| 1335 |
|
| 1336 |
|
| 1337 |
|
| 1338 |
|
| 1339 |
|
| 1340 |
|
| 1341 |
|
| 1342 |
|
| 1343 |
|
| 1344 |
|
| 1345 |
|
| 1346 |
|
| 1347 |
|
| 1348 |
|
| 1349 |
|
| 1350 |
|
| 1351 |
|
| 1352 |
|
| 1353 |
|
| 1354 |
|
| 1355 |
template <typename R> |
| 1356 |
class ReturnAction { |
| 1357 |
public: |
| 1358 |
|
| 1359 |
|
| 1360 |
|
| 1361 |
explicit ReturnAction(R value) : value_(value) {} |
| 1362 |
|
| 1363 |
|
| 1364 |
|
| 1365 |
template <typename F> |
| 1366 |
operator Action<F>() const { |
| 1367 |
|
| 1368 |
|
| 1369 |
|
| 1370 |
|
| 1371 |
|
| 1372 |
|
| 1373 |
|
| 1374 |
|
| 1375 |
typedef typename Function<F>::Result Result; |
| 1376 |
GTEST_COMPILE_ASSERT_( |
| 1377 |
!internal::is_reference<Result>::value, |
| 1378 |
use_ReturnRef_instead_of_Return_to_return_a_reference); |
| 1379 |
return Action<F>(new Impl<F>(value_)); |
| 1380 |
} |
| 1381 |
|
| 1382 |
private: |
| 1383 |
|
| 1384 |
template <typename F> |
| 1385 |
class Impl : public ActionInterface<F> { |
| 1386 |
public: |
| 1387 |
typedef typename Function<F>::Result Result; |
| 1388 |
typedef typename Function<F>::ArgumentTuple ArgumentTuple; |
| 1389 |
|
| 1390 |
|
| 1391 |
|
| 1392 |
|
| 1393 |
|
| 1394 |
|
| 1395 |
|
| 1396 |
|
| 1397 |
explicit Impl(R value) |
| 1398 |
: value_(::testing::internal::ImplicitCast_<Result>(value)) {} |
| 1399 |
|
| 1400 |
virtual Result Perform(const ArgumentTuple&) { return value_; } |
| 1401 |
|
| 1402 |
private: |
| 1403 |
GTEST_COMPILE_ASSERT_(!internal::is_reference<Result>::value, |
| 1404 |
Result_cannot_be_a_reference_type); |
| 1405 |
Result value_; |
| 1406 |
|
| 1407 |
GTEST_DISALLOW_ASSIGN_(Impl); |
| 1408 |
}; |
| 1409 |
|
| 1410 |
R value_; |
| 1411 |
|
| 1412 |
GTEST_DISALLOW_ASSIGN_(ReturnAction); |
| 1413 |
}; |
| 1414 |
|
| 1415 |
|
| 1416 |
class ReturnNullAction { |
| 1417 |
public: |
| 1418 |
|
| 1419 |
template <typename Result, typename ArgumentTuple> |
| 1420 |
static Result Perform(const ArgumentTuple&) { |
| 1421 |
GTEST_COMPILE_ASSERT_(internal::is_pointer<Result>::value, |
| 1422 |
ReturnNull_can_be_used_to_return_a_pointer_only); |
| 1423 |
return NULL; |
| 1424 |
} |
| 1425 |
}; |
| 1426 |
|
| 1427 |
|
| 1428 |
class ReturnVoidAction { |
| 1429 |
public: |
| 1430 |
|
| 1431 |
template <typename Result, typename ArgumentTuple> |
| 1432 |
static void Perform(const ArgumentTuple&) { |
| 1433 |
CompileAssertTypesEqual<void, Result>(); |
| 1434 |
} |
| 1435 |
}; |
| 1436 |
|
| 1437 |
|
| 1438 |
|
| 1439 |
|
| 1440 |
template <typename T> |
| 1441 |
class ReturnRefAction { |
| 1442 |
public: |
| 1443 |
|
| 1444 |
explicit ReturnRefAction(T& ref) : ref_(ref) {} |
| 1445 |
|
| 1446 |
|
| 1447 |
|
| 1448 |
template <typename F> |
| 1449 |
operator Action<F>() const { |
| 1450 |
typedef typename Function<F>::Result Result; |
| 1451 |
|
| 1452 |
|
| 1453 |
|
| 1454 |
GTEST_COMPILE_ASSERT_(internal::is_reference<Result>::value, |
| 1455 |
use_Return_instead_of_ReturnRef_to_return_a_value); |
| 1456 |
return Action<F>(new Impl<F>(ref_)); |
| 1457 |
} |
| 1458 |
|
| 1459 |
private: |
| 1460 |
|
| 1461 |
template <typename F> |
| 1462 |
class Impl : public ActionInterface<F> { |
| 1463 |
public: |
| 1464 |
typedef typename Function<F>::Result Result; |
| 1465 |
typedef typename Function<F>::ArgumentTuple ArgumentTuple; |
| 1466 |
|
| 1467 |
explicit Impl(T& ref) : ref_(ref) {} |
| 1468 |
|
| 1469 |
virtual Result Perform(const ArgumentTuple&) { |
| 1470 |
return ref_; |
| 1471 |
} |
| 1472 |
|
| 1473 |
private: |
| 1474 |
T& ref_; |
| 1475 |
|
| 1476 |
GTEST_DISALLOW_ASSIGN_(Impl); |
| 1477 |
}; |
| 1478 |
|
| 1479 |
T& ref_; |
| 1480 |
|
| 1481 |
GTEST_DISALLOW_ASSIGN_(ReturnRefAction); |
| 1482 |
}; |
| 1483 |
|
| 1484 |
|
| 1485 |
|
| 1486 |
|
| 1487 |
template <typename T> |
| 1488 |
class ReturnRefOfCopyAction { |
| 1489 |
public: |
| 1490 |
|
| 1491 |
|
| 1492 |
explicit ReturnRefOfCopyAction(const T& value) : value_(value) {} |
| 1493 |
|
| 1494 |
|
| 1495 |
|
| 1496 |
template <typename F> |
| 1497 |
operator Action<F>() const { |
| 1498 |
typedef typename Function<F>::Result Result; |
| 1499 |
|
| 1500 |
|
| 1501 |
|
| 1502 |
GTEST_COMPILE_ASSERT_( |
| 1503 |
internal::is_reference<Result>::value, |
| 1504 |
use_Return_instead_of_ReturnRefOfCopy_to_return_a_value); |
| 1505 |
return Action<F>(new Impl<F>(value_)); |
| 1506 |
} |
| 1507 |
|
| 1508 |
private: |
| 1509 |
|
| 1510 |
template <typename F> |
| 1511 |
class Impl : public ActionInterface<F> { |
| 1512 |
public: |
| 1513 |
typedef typename Function<F>::Result Result; |
| 1514 |
typedef typename Function<F>::ArgumentTuple ArgumentTuple; |
| 1515 |
|
| 1516 |
explicit Impl(const T& value) : value_(value) {} |
| 1517 |
|
| 1518 |
virtual Result Perform(const ArgumentTuple&) { |
| 1519 |
return value_; |
| 1520 |
} |
| 1521 |
|
| 1522 |
private: |
| 1523 |
T value_; |
| 1524 |
|
| 1525 |
GTEST_DISALLOW_ASSIGN_(Impl); |
| 1526 |
}; |
| 1527 |
|
| 1528 |
const T value_; |
| 1529 |
|
| 1530 |
GTEST_DISALLOW_ASSIGN_(ReturnRefOfCopyAction); |
| 1531 |
}; |
| 1532 |
|
| 1533 |
|
| 1534 |
class DoDefaultAction { |
| 1535 |
public: |
| 1536 |
|
| 1537 |
|
| 1538 |
template <typename F> |
| 1539 |
operator Action<F>() const { return Action<F>(NULL); } |
| 1540 |
}; |
| 1541 |
|
| 1542 |
|
| 1543 |
|
| 1544 |
template <typename T1, typename T2> |
| 1545 |
class AssignAction { |
| 1546 |
public: |
| 1547 |
AssignAction(T1* ptr, T2 value) : ptr_(ptr), value_(value) {} |
| 1548 |
|
| 1549 |
template <typename Result, typename ArgumentTuple> |
| 1550 |
void Perform(const ArgumentTuple& ) const { |
| 1551 |
*ptr_ = value_; |
| 1552 |
} |
| 1553 |
|
| 1554 |
private: |
| 1555 |
T1* const ptr_; |
| 1556 |
const T2 value_; |
| 1557 |
|
| 1558 |
GTEST_DISALLOW_ASSIGN_(AssignAction); |
| 1559 |
}; |
| 1560 |
|
| 1561 |
#if !GTEST_OS_WINDOWS_MOBILE |
| 1562 |
|
| 1563 |
|
| 1564 |
|
| 1565 |
template <typename T> |
| 1566 |
class SetErrnoAndReturnAction { |
| 1567 |
public: |
| 1568 |
SetErrnoAndReturnAction(int errno_value, T result) |
| 1569 |
: errno_(errno_value), |
| 1570 |
result_(result) {} |
| 1571 |
template <typename Result, typename ArgumentTuple> |
| 1572 |
Result Perform(const ArgumentTuple& ) const { |
| 1573 |
errno = errno_; |
| 1574 |
return result_; |
| 1575 |
} |
| 1576 |
|
| 1577 |
private: |
| 1578 |
const int errno_; |
| 1579 |
const T result_; |
| 1580 |
|
| 1581 |
GTEST_DISALLOW_ASSIGN_(SetErrnoAndReturnAction); |
| 1582 |
}; |
| 1583 |
|
| 1584 |
#endif |
| 1585 |
|
| 1586 |
|
| 1587 |
|
| 1588 |
|
| 1589 |
|
| 1590 |
template <size_t N, typename A, bool kIsProto> |
| 1591 |
class SetArgumentPointeeAction { |
| 1592 |
public: |
| 1593 |
|
| 1594 |
|
| 1595 |
explicit SetArgumentPointeeAction(const A& value) : value_(value) {} |
| 1596 |
|
| 1597 |
template <typename Result, typename ArgumentTuple> |
| 1598 |
void Perform(const ArgumentTuple& args) const { |
| 1599 |
CompileAssertTypesEqual<void, Result>(); |
| 1600 |
*::std::tr1::get<N>(args) = value_; |
| 1601 |
} |
| 1602 |
|
| 1603 |
private: |
| 1604 |
const A value_; |
| 1605 |
|
| 1606 |
GTEST_DISALLOW_ASSIGN_(SetArgumentPointeeAction); |
| 1607 |
}; |
| 1608 |
|
| 1609 |
template <size_t N, typename Proto> |
| 1610 |
class SetArgumentPointeeAction<N, Proto, true> { |
| 1611 |
public: |
| 1612 |
|
| 1613 |
|
| 1614 |
|
| 1615 |
|
| 1616 |
explicit SetArgumentPointeeAction(const Proto& proto) : proto_(new Proto) { |
| 1617 |
proto_->CopyFrom(proto); |
| 1618 |
} |
| 1619 |
|
| 1620 |
template <typename Result, typename ArgumentTuple> |
| 1621 |
void Perform(const ArgumentTuple& args) const { |
| 1622 |
CompileAssertTypesEqual<void, Result>(); |
| 1623 |
::std::tr1::get<N>(args)->CopyFrom(*proto_); |
| 1624 |
} |
| 1625 |
|
| 1626 |
private: |
| 1627 |
const internal::linked_ptr<Proto> proto_; |
| 1628 |
|
| 1629 |
GTEST_DISALLOW_ASSIGN_(SetArgumentPointeeAction); |
| 1630 |
}; |
| 1631 |
|
| 1632 |
|
| 1633 |
|
| 1634 |
|
| 1635 |
|
| 1636 |
|
| 1637 |
template <typename FunctionImpl> |
| 1638 |
class InvokeWithoutArgsAction { |
| 1639 |
public: |
| 1640 |
|
| 1641 |
|
| 1642 |
explicit InvokeWithoutArgsAction(FunctionImpl function_impl) |
| 1643 |
: function_impl_(function_impl) {} |
| 1644 |
|
| 1645 |
|
| 1646 |
|
| 1647 |
template <typename Result, typename ArgumentTuple> |
| 1648 |
Result Perform(const ArgumentTuple&) { return function_impl_(); } |
| 1649 |
|
| 1650 |
private: |
| 1651 |
FunctionImpl function_impl_; |
| 1652 |
|
| 1653 |
GTEST_DISALLOW_ASSIGN_(InvokeWithoutArgsAction); |
| 1654 |
}; |
| 1655 |
|
| 1656 |
|
| 1657 |
template <class Class, typename MethodPtr> |
| 1658 |
class InvokeMethodWithoutArgsAction { |
| 1659 |
public: |
| 1660 |
InvokeMethodWithoutArgsAction(Class* obj_ptr, MethodPtr method_ptr) |
| 1661 |
: obj_ptr_(obj_ptr), method_ptr_(method_ptr) {} |
| 1662 |
|
| 1663 |
template <typename Result, typename ArgumentTuple> |
| 1664 |
Result Perform(const ArgumentTuple&) const { |
| 1665 |
return (obj_ptr_->*method_ptr_)(); |
| 1666 |
} |
| 1667 |
|
| 1668 |
private: |
| 1669 |
Class* const obj_ptr_; |
| 1670 |
const MethodPtr method_ptr_; |
| 1671 |
|
| 1672 |
GTEST_DISALLOW_ASSIGN_(InvokeMethodWithoutArgsAction); |
| 1673 |
}; |
| 1674 |
|
| 1675 |
|
| 1676 |
template <typename A> |
| 1677 |
class IgnoreResultAction { |
| 1678 |
public: |
| 1679 |
explicit IgnoreResultAction(const A& action) : action_(action) {} |
| 1680 |
|
| 1681 |
template <typename F> |
| 1682 |
operator Action<F>() const { |
| 1683 |
|
| 1684 |
|
| 1685 |
|
| 1686 |
|
| 1687 |
|
| 1688 |
|
| 1689 |
|
| 1690 |
|
| 1691 |
typedef typename internal::Function<F>::Result Result; |
| 1692 |
|
| 1693 |
|
| 1694 |
CompileAssertTypesEqual<void, Result>(); |
| 1695 |
|
| 1696 |
return Action<F>(new Impl<F>(action_)); |
| 1697 |
} |
| 1698 |
|
| 1699 |
private: |
| 1700 |
template <typename F> |
| 1701 |
class Impl : public ActionInterface<F> { |
| 1702 |
public: |
| 1703 |
typedef typename internal::Function<F>::Result Result; |
| 1704 |
typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; |
| 1705 |
|
| 1706 |
explicit Impl(const A& action) : action_(action) {} |
| 1707 |
|
| 1708 |
virtual void Perform(const ArgumentTuple& args) { |
| 1709 |
|
| 1710 |
action_.Perform(args); |
| 1711 |
} |
| 1712 |
|
| 1713 |
private: |
| 1714 |
|
| 1715 |
|
| 1716 |
typedef typename internal::Function<F>::MakeResultIgnoredValue |
| 1717 |
OriginalFunction; |
| 1718 |
|
| 1719 |
const Action<OriginalFunction> action_; |
| 1720 |
|
| 1721 |
GTEST_DISALLOW_ASSIGN_(Impl); |
| 1722 |
}; |
| 1723 |
|
| 1724 |
const A action_; |
| 1725 |
|
| 1726 |
GTEST_DISALLOW_ASSIGN_(IgnoreResultAction); |
| 1727 |
}; |
| 1728 |
|
| 1729 |
|
| 1730 |
|
| 1731 |
|
| 1732 |
|
| 1733 |
|
| 1734 |
|
| 1735 |
|
| 1736 |
template <typename T> |
| 1737 |
class ReferenceWrapper { |
| 1738 |
public: |
| 1739 |
|
| 1740 |
explicit ReferenceWrapper(T& l_value) : pointer_(&l_value) {} |
| 1741 |
|
| 1742 |
|
| 1743 |
|
| 1744 |
operator T&() const { return *pointer_; } |
| 1745 |
private: |
| 1746 |
T* pointer_; |
| 1747 |
}; |
| 1748 |
|
| 1749 |
|
| 1750 |
template <typename T> |
| 1751 |
void PrintTo(const ReferenceWrapper<T>& ref, ::std::ostream* os) { |
| 1752 |
T& value = ref; |
| 1753 |
UniversalPrinter<T&>::Print(value, os); |
| 1754 |
} |
| 1755 |
|
| 1756 |
|
| 1757 |
|
| 1758 |
template <typename Action1, typename Action2> |
| 1759 |
class DoBothAction { |
| 1760 |
public: |
| 1761 |
DoBothAction(Action1 action1, Action2 action2) |
| 1762 |
: action1_(action1), action2_(action2) {} |
| 1763 |
|
| 1764 |
|
| 1765 |
|
| 1766 |
template <typename F> |
| 1767 |
operator Action<F>() const { |
| 1768 |
return Action<F>(new Impl<F>(action1_, action2_)); |
| 1769 |
} |
| 1770 |
|
| 1771 |
private: |
| 1772 |
|
| 1773 |
template <typename F> |
| 1774 |
class Impl : public ActionInterface<F> { |
| 1775 |
public: |
| 1776 |
typedef typename Function<F>::Result Result; |
| 1777 |
typedef typename Function<F>::ArgumentTuple ArgumentTuple; |
| 1778 |
typedef typename Function<F>::MakeResultVoid VoidResult; |
| 1779 |
|
| 1780 |
Impl(const Action<VoidResult>& action1, const Action<F>& action2) |
| 1781 |
: action1_(action1), action2_(action2) {} |
| 1782 |
|
| 1783 |
virtual Result Perform(const ArgumentTuple& args) { |
| 1784 |
action1_.Perform(args); |
| 1785 |
return action2_.Perform(args); |
| 1786 |
} |
| 1787 |
|
| 1788 |
private: |
| 1789 |
const Action<VoidResult> action1_; |
| 1790 |
const Action<F> action2_; |
| 1791 |
|
| 1792 |
GTEST_DISALLOW_ASSIGN_(Impl); |
| 1793 |
}; |
| 1794 |
|
| 1795 |
Action1 action1_; |
| 1796 |
Action2 action2_; |
| 1797 |
|
| 1798 |
GTEST_DISALLOW_ASSIGN_(DoBothAction); |
| 1799 |
}; |
| 1800 |
|
| 1801 |
} |
| 1802 |
|
| 1803 |
|
| 1804 |
|
| 1805 |
|
| 1806 |
|
| 1807 |
|
| 1808 |
|
| 1809 |
|
| 1810 |
|
| 1811 |
|
| 1812 |
|
| 1813 |
|
| 1814 |
|
| 1815 |
|
| 1816 |
|
| 1817 |
|
| 1818 |
|
| 1819 |
|
| 1820 |
|
| 1821 |
|
| 1822 |
|
| 1823 |
|
| 1824 |
|
| 1825 |
|
| 1826 |
|
| 1827 |
|
| 1828 |
|
| 1829 |
|
| 1830 |
|
| 1831 |
|
| 1832 |
|
| 1833 |
typedef internal::IgnoredValue Unused; |
| 1834 |
|
| 1835 |
|
| 1836 |
|
| 1837 |
|
| 1838 |
|
| 1839 |
template <typename To> |
| 1840 |
template <typename From> |
| 1841 |
Action<To>::Action(const Action<From>& from) |
| 1842 |
: impl_(new internal::ActionAdaptor<To, From>(from)) {} |
| 1843 |
|
| 1844 |
|
| 1845 |
|
| 1846 |
|
| 1847 |
template <typename R> |
| 1848 |
internal::ReturnAction<R> Return(R value) { |
| 1849 |
return internal::ReturnAction<R>(value); |
| 1850 |
} |
| 1851 |
|
| 1852 |
|
| 1853 |
inline PolymorphicAction<internal::ReturnNullAction> ReturnNull() { |
| 1854 |
return MakePolymorphicAction(internal::ReturnNullAction()); |
| 1855 |
} |
| 1856 |
|
| 1857 |
|
| 1858 |
inline PolymorphicAction<internal::ReturnVoidAction> Return() { |
| 1859 |
return MakePolymorphicAction(internal::ReturnVoidAction()); |
| 1860 |
} |
| 1861 |
|
| 1862 |
|
| 1863 |
template <typename R> |
| 1864 |
inline internal::ReturnRefAction<R> ReturnRef(R& x) { |
| 1865 |
return internal::ReturnRefAction<R>(x); |
| 1866 |
} |
| 1867 |
|
| 1868 |
|
| 1869 |
|
| 1870 |
|
| 1871 |
template <typename R> |
| 1872 |
inline internal::ReturnRefOfCopyAction<R> ReturnRefOfCopy(const R& x) { |
| 1873 |
return internal::ReturnRefOfCopyAction<R>(x); |
| 1874 |
} |
| 1875 |
|
| 1876 |
|
| 1877 |
inline internal::DoDefaultAction DoDefault() { |
| 1878 |
return internal::DoDefaultAction(); |
| 1879 |
} |
| 1880 |
|
| 1881 |
|
| 1882 |
|
| 1883 |
template <size_t N, typename T> |
| 1884 |
PolymorphicAction< |
| 1885 |
internal::SetArgumentPointeeAction< |
| 1886 |
N, T, internal::IsAProtocolMessage<T>::value> > |
| 1887 |
SetArgPointee(const T& x) { |
| 1888 |
return MakePolymorphicAction(internal::SetArgumentPointeeAction< |
| 1889 |
N, T, internal::IsAProtocolMessage<T>::value>(x)); |
| 1890 |
} |
| 1891 |
|
| 1892 |
#if !((GTEST_GCC_VER_ && GTEST_GCC_VER_ < 40000) || GTEST_OS_SYMBIAN) |
| 1893 |
|
| 1894 |
|
| 1895 |
|
| 1896 |
template <size_t N> |
| 1897 |
PolymorphicAction< |
| 1898 |
internal::SetArgumentPointeeAction<N, const char*, false> > |
| 1899 |
SetArgPointee(const char* p) { |
| 1900 |
return MakePolymorphicAction(internal::SetArgumentPointeeAction< |
| 1901 |
N, const char*, false>(p)); |
| 1902 |
} |
| 1903 |
|
| 1904 |
template <size_t N> |
| 1905 |
PolymorphicAction< |
| 1906 |
internal::SetArgumentPointeeAction<N, const wchar_t*, false> > |
| 1907 |
SetArgPointee(const wchar_t* p) { |
| 1908 |
return MakePolymorphicAction(internal::SetArgumentPointeeAction< |
| 1909 |
N, const wchar_t*, false>(p)); |
| 1910 |
} |
| 1911 |
#endif |
| 1912 |
|
| 1913 |
|
| 1914 |
template <size_t N, typename T> |
| 1915 |
PolymorphicAction< |
| 1916 |
internal::SetArgumentPointeeAction< |
| 1917 |
N, T, internal::IsAProtocolMessage<T>::value> > |
| 1918 |
SetArgumentPointee(const T& x) { |
| 1919 |
return MakePolymorphicAction(internal::SetArgumentPointeeAction< |
| 1920 |
N, T, internal::IsAProtocolMessage<T>::value>(x)); |
| 1921 |
} |
| 1922 |
|
| 1923 |
|
| 1924 |
template <typename T1, typename T2> |
| 1925 |
PolymorphicAction<internal::AssignAction<T1, T2> > Assign(T1* ptr, T2 val) { |
| 1926 |
return MakePolymorphicAction(internal::AssignAction<T1, T2>(ptr, val)); |
| 1927 |
} |
| 1928 |
|
| 1929 |
#if !GTEST_OS_WINDOWS_MOBILE |
| 1930 |
|
| 1931 |
|
| 1932 |
template <typename T> |
| 1933 |
PolymorphicAction<internal::SetErrnoAndReturnAction<T> > |
| 1934 |
SetErrnoAndReturn(int errval, T result) { |
| 1935 |
return MakePolymorphicAction( |
| 1936 |
internal::SetErrnoAndReturnAction<T>(errval, result)); |
| 1937 |
} |
| 1938 |
|
| 1939 |
#endif |
| 1940 |
|
| 1941 |
|
| 1942 |
|
| 1943 |
|
| 1944 |
template <typename FunctionImpl> |
| 1945 |
PolymorphicAction<internal::InvokeWithoutArgsAction<FunctionImpl> > |
| 1946 |
InvokeWithoutArgs(FunctionImpl function_impl) { |
| 1947 |
return MakePolymorphicAction( |
| 1948 |
internal::InvokeWithoutArgsAction<FunctionImpl>(function_impl)); |
| 1949 |
} |
| 1950 |
|
| 1951 |
|
| 1952 |
|
| 1953 |
template <class Class, typename MethodPtr> |
| 1954 |
PolymorphicAction<internal::InvokeMethodWithoutArgsAction<Class, MethodPtr> > |
| 1955 |
InvokeWithoutArgs(Class* obj_ptr, MethodPtr method_ptr) { |
| 1956 |
return MakePolymorphicAction( |
| 1957 |
internal::InvokeMethodWithoutArgsAction<Class, MethodPtr>( |
| 1958 |
obj_ptr, method_ptr)); |
| 1959 |
} |
| 1960 |
|
| 1961 |
|
| 1962 |
|
| 1963 |
|
| 1964 |
template <typename A> |
| 1965 |
inline internal::IgnoreResultAction<A> IgnoreResult(const A& an_action) { |
| 1966 |
return internal::IgnoreResultAction<A>(an_action); |
| 1967 |
} |
| 1968 |
|
| 1969 |
|
| 1970 |
|
| 1971 |
|
| 1972 |
|
| 1973 |
|
| 1974 |
|
| 1975 |
|
| 1976 |
template <typename T> |
| 1977 |
inline internal::ReferenceWrapper<T> ByRef(T& l_value) { |
| 1978 |
return internal::ReferenceWrapper<T>(l_value); |
| 1979 |
} |
| 1980 |
|
| 1981 |
} |
| 1982 |
|
| 1983 |
#endif |
| 1984 |
|
| 1985 |
|
| 1986 |
|
| 1987 |
|
| 1988 |
|
| 1989 |
|
| 1990 |
|
| 1991 |
|
| 1992 |
|
| 1993 |
|
| 1994 |
|
| 1995 |
|
| 1996 |
|
| 1997 |
|
| 1998 |
|
| 1999 |
|
| 2000 |
|
| 2001 |
|
| 2002 |
|
| 2003 |
|
| 2004 |
|
| 2005 |
|
| 2006 |
|
| 2007 |
|
| 2008 |
|
| 2009 |
|
| 2010 |
|
| 2011 |
|
| 2012 |
|
| 2013 |
|
| 2014 |
|
| 2015 |
|
| 2016 |
|
| 2017 |
|
| 2018 |
|
| 2019 |
|
| 2020 |
|
| 2021 |
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ |
| 2022 |
#define GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ |
| 2023 |
|
| 2024 |
#include <limits.h> |
| 2025 |
#include <ostream> |
| 2026 |
|
| 2027 |
namespace testing { |
| 2028 |
|
| 2029 |
|
| 2030 |
|
| 2031 |
|
| 2032 |
|
| 2033 |
|
| 2034 |
|
| 2035 |
|
| 2036 |
|
| 2037 |
|
| 2038 |
|
| 2039 |
|
| 2040 |
class CardinalityInterface { |
| 2041 |
public: |
| 2042 |
virtual ~CardinalityInterface() {} |
| 2043 |
|
| 2044 |
|
| 2045 |
|
| 2046 |
virtual int ConservativeLowerBound() const { return 0; } |
| 2047 |
virtual int ConservativeUpperBound() const { return INT_MAX; } |
| 2048 |
|
| 2049 |
|
| 2050 |
virtual bool IsSatisfiedByCallCount(int call_count) const = 0; |
| 2051 |
|
| 2052 |
|
| 2053 |
virtual bool IsSaturatedByCallCount(int call_count) const = 0; |
| 2054 |
|
| 2055 |
|
| 2056 |
virtual void DescribeTo(::std::ostream* os) const = 0; |
| 2057 |
}; |
| 2058 |
|
| 2059 |
|
| 2060 |
|
| 2061 |
|
| 2062 |
|
| 2063 |
|
| 2064 |
class GTEST_API_ Cardinality { |
| 2065 |
public: |
| 2066 |
|
| 2067 |
|
| 2068 |
Cardinality() {} |
| 2069 |
|
| 2070 |
|
| 2071 |
explicit Cardinality(const CardinalityInterface* impl) : impl_(impl) {} |
| 2072 |
|
| 2073 |
|
| 2074 |
|
| 2075 |
int ConservativeLowerBound() const { return impl_->ConservativeLowerBound(); } |
| 2076 |
int ConservativeUpperBound() const { return impl_->ConservativeUpperBound(); } |
| 2077 |
|
| 2078 |
|
| 2079 |
bool IsSatisfiedByCallCount(int call_count) const { |
| 2080 |
return impl_->IsSatisfiedByCallCount(call_count); |
| 2081 |
} |
| 2082 |
|
| 2083 |
|
| 2084 |
bool IsSaturatedByCallCount(int call_count) const { |
| 2085 |
return impl_->IsSaturatedByCallCount(call_count); |
| 2086 |
} |
| 2087 |
|
| 2088 |
|
| 2089 |
|
| 2090 |
bool IsOverSaturatedByCallCount(int call_count) const { |
| 2091 |
return impl_->IsSaturatedByCallCount(call_count) && |
| 2092 |
!impl_->IsSatisfiedByCallCount(call_count); |
| 2093 |
} |
| 2094 |
|
| 2095 |
|
| 2096 |
void DescribeTo(::std::ostream* os) const { impl_->DescribeTo(os); } |
| 2097 |
|
| 2098 |
|
| 2099 |
static void DescribeActualCallCountTo(int actual_call_count, |
| 2100 |
::std::ostream* os); |
| 2101 |
|
| 2102 |
private: |
| 2103 |
internal::linked_ptr<const CardinalityInterface> impl_; |
| 2104 |
}; |
| 2105 |
|
| 2106 |
|
| 2107 |
GTEST_API_ Cardinality AtLeast(int n); |
| 2108 |
|
| 2109 |
|
| 2110 |
GTEST_API_ Cardinality AtMost(int n); |
| 2111 |
|
| 2112 |
|
| 2113 |
GTEST_API_ Cardinality AnyNumber(); |
| 2114 |
|
| 2115 |
|
| 2116 |
GTEST_API_ Cardinality Between(int min, int max); |
| 2117 |
|
| 2118 |
|
| 2119 |
GTEST_API_ Cardinality Exactly(int n); |
| 2120 |
|
| 2121 |
|
| 2122 |
inline Cardinality MakeCardinality(const CardinalityInterface* c) { |
| 2123 |
return Cardinality(c); |
| 2124 |
} |
| 2125 |
|
| 2126 |
} |
| 2127 |
|
| 2128 |
#endif |
| 2129 |
|
| 2130 |
|
| 2131 |
|
| 2132 |
|
| 2133 |
|
| 2134 |
|
| 2135 |
|
| 2136 |
|
| 2137 |
|
| 2138 |
|
| 2139 |
|
| 2140 |
|
| 2141 |
|
| 2142 |
|
| 2143 |
|
| 2144 |
|
| 2145 |
|
| 2146 |
|
| 2147 |
|
| 2148 |
|
| 2149 |
|
| 2150 |
|
| 2151 |
|
| 2152 |
|
| 2153 |
|
| 2154 |
|
| 2155 |
|
| 2156 |
|
| 2157 |
|
| 2158 |
|
| 2159 |
|
| 2160 |
|
| 2161 |
|
| 2162 |
|
| 2163 |
|
| 2164 |
|
| 2165 |
|
| 2166 |
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ |
| 2167 |
#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ |
| 2168 |
|
| 2169 |
|
| 2170 |
namespace testing { |
| 2171 |
namespace internal { |
| 2172 |
|
| 2173 |
|
| 2174 |
|
| 2175 |
|
| 2176 |
template <typename Result, typename ArgumentTuple> |
| 2177 |
class InvokeHelper; |
| 2178 |
|
| 2179 |
template <typename R> |
| 2180 |
class InvokeHelper<R, ::std::tr1::tuple<> > { |
| 2181 |
public: |
| 2182 |
template <typename Function> |
| 2183 |
static R Invoke(Function function, const ::std::tr1::tuple<>&) { |
| 2184 |
return function(); |
| 2185 |
} |
| 2186 |
|
| 2187 |
template <class Class, typename MethodPtr> |
| 2188 |
static R InvokeMethod(Class* obj_ptr, |
| 2189 |
MethodPtr method_ptr, |
| 2190 |
const ::std::tr1::tuple<>&) { |
| 2191 |
return (obj_ptr->*method_ptr)(); |
| 2192 |
} |
| 2193 |
}; |
| 2194 |
|
| 2195 |
template <typename R, typename A1> |
| 2196 |
class InvokeHelper<R, ::std::tr1::tuple<A1> > { |
| 2197 |
public: |
| 2198 |
template <typename Function> |
| 2199 |
static R Invoke(Function function, const ::std::tr1::tuple<A1>& args) { |
| 2200 |
using ::std::tr1::get; |
| 2201 |
return function(get<0>(args)); |
| 2202 |
} |
| 2203 |
|
| 2204 |
template <class Class, typename MethodPtr> |
| 2205 |
static R InvokeMethod(Class* obj_ptr, |
| 2206 |
MethodPtr method_ptr, |
| 2207 |
const ::std::tr1::tuple<A1>& args) { |
| 2208 |
using ::std::tr1::get; |
| 2209 |
return (obj_ptr->*method_ptr)(get<0>(args)); |
| 2210 |
} |
| 2211 |
}; |
| 2212 |
|
| 2213 |
template <typename R, typename A1, typename A2> |
| 2214 |
class InvokeHelper<R, ::std::tr1::tuple<A1, A2> > { |
| 2215 |
public: |
| 2216 |
template <typename Function> |
| 2217 |
static R Invoke(Function function, const ::std::tr1::tuple<A1, A2>& args) { |
| 2218 |
using ::std::tr1::get; |
| 2219 |
return function(get<0>(args), get<1>(args)); |
| 2220 |
} |
| 2221 |
|
| 2222 |
template <class Class, typename MethodPtr> |
| 2223 |
static R InvokeMethod(Class* obj_ptr, |
| 2224 |
MethodPtr method_ptr, |
| 2225 |
const ::std::tr1::tuple<A1, A2>& args) { |
| 2226 |
using ::std::tr1::get; |
| 2227 |
return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args)); |
| 2228 |
} |
| 2229 |
}; |
| 2230 |
|
| 2231 |
template <typename R, typename A1, typename A2, typename A3> |
| 2232 |
class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3> > { |
| 2233 |
public: |
| 2234 |
template <typename Function> |
| 2235 |
static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, |
| 2236 |
A3>& args) { |
| 2237 |
using ::std::tr1::get; |
| 2238 |
return function(get<0>(args), get<1>(args), get<2>(args)); |
| 2239 |
} |
| 2240 |
|
| 2241 |
template <class Class, typename MethodPtr> |
| 2242 |
static R InvokeMethod(Class* obj_ptr, |
| 2243 |
MethodPtr method_ptr, |
| 2244 |
const ::std::tr1::tuple<A1, A2, A3>& args) { |
| 2245 |
using ::std::tr1::get; |
| 2246 |
return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args)); |
| 2247 |
} |
| 2248 |
}; |
| 2249 |
|
| 2250 |
template <typename R, typename A1, typename A2, typename A3, typename A4> |
| 2251 |
class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4> > { |
| 2252 |
public: |
| 2253 |
template <typename Function> |
| 2254 |
static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, |
| 2255 |
A4>& args) { |
| 2256 |
using ::std::tr1::get; |
| 2257 |
return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args)); |
| 2258 |
} |
| 2259 |
|
| 2260 |
template <class Class, typename MethodPtr> |
| 2261 |
static R InvokeMethod(Class* obj_ptr, |
| 2262 |
MethodPtr method_ptr, |
| 2263 |
const ::std::tr1::tuple<A1, A2, A3, A4>& args) { |
| 2264 |
using ::std::tr1::get; |
| 2265 |
return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args), |
| 2266 |
get<3>(args)); |
| 2267 |
} |
| 2268 |
}; |
| 2269 |
|
| 2270 |
template <typename R, typename A1, typename A2, typename A3, typename A4, |
| 2271 |
typename A5> |
| 2272 |
class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5> > { |
| 2273 |
public: |
| 2274 |
template <typename Function> |
| 2275 |
static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4, |
| 2276 |
A5>& args) { |
| 2277 |
using ::std::tr1::get; |
| 2278 |
return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args), |
| 2279 |
get<4>(args)); |
| 2280 |
} |
| 2281 |
|
| 2282 |
template <class Class, typename MethodPtr> |
| 2283 |
static R InvokeMethod(Class* obj_ptr, |
| 2284 |
MethodPtr method_ptr, |
| 2285 |
const ::std::tr1::tuple<A1, A2, A3, A4, A5>& args) { |
| 2286 |
using ::std::tr1::get; |
| 2287 |
return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args), |
| 2288 |
get<3>(args), get<4>(args)); |
| 2289 |
} |
| 2290 |
}; |
| 2291 |
|
| 2292 |
template <typename R, typename A1, typename A2, typename A3, typename A4, |
| 2293 |
typename A5, typename A6> |
| 2294 |
class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5, A6> > { |
| 2295 |
public: |
| 2296 |
template <typename Function> |
| 2297 |
static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4, |
| 2298 |
A5, A6>& args) { |
| 2299 |
using ::std::tr1::get; |
| 2300 |
return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args), |
| 2301 |
get<4>(args), get<5>(args)); |
| 2302 |
} |
| 2303 |
|
| 2304 |
template <class Class, typename MethodPtr> |
| 2305 |
static R InvokeMethod(Class* obj_ptr, |
| 2306 |
MethodPtr method_ptr, |
| 2307 |
const ::std::tr1::tuple<A1, A2, A3, A4, A5, A6>& args) { |
| 2308 |
using ::std::tr1::get; |
| 2309 |
return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args), |
| 2310 |
get<3>(args), get<4>(args), get<5>(args)); |
| 2311 |
} |
| 2312 |
}; |
| 2313 |
|
| 2314 |
template <typename R, typename A1, typename A2, typename A3, typename A4, |
| 2315 |
typename A5, typename A6, typename A7> |
| 2316 |
class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7> > { |
| 2317 |
public: |
| 2318 |
template <typename Function> |
| 2319 |
static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4, |
| 2320 |
A5, A6, A7>& args) { |
| 2321 |
using ::std::tr1::get; |
| 2322 |
return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args), |
| 2323 |
get<4>(args), get<5>(args), get<6>(args)); |
| 2324 |
} |
| 2325 |
|
| 2326 |
template <class Class, typename MethodPtr> |
| 2327 |
static R InvokeMethod(Class* obj_ptr, |
| 2328 |
MethodPtr method_ptr, |
| 2329 |
const ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, |
| 2330 |
A7>& args) { |
| 2331 |
using ::std::tr1::get; |
| 2332 |
return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args), |
| 2333 |
get<3>(args), get<4>(args), get<5>(args), get<6>(args)); |
| 2334 |
} |
| 2335 |
}; |
| 2336 |
|
| 2337 |
template <typename R, typename A1, typename A2, typename A3, typename A4, |
| 2338 |
typename A5, typename A6, typename A7, typename A8> |
| 2339 |
class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8> > { |
| 2340 |
public: |
| 2341 |
template <typename Function> |
| 2342 |
static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4, |
| 2343 |
A5, A6, A7, A8>& args) { |
| 2344 |
using ::std::tr1::get; |
| 2345 |
return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args), |
| 2346 |
get<4>(args), get<5>(args), get<6>(args), get<7>(args)); |
| 2347 |
} |
| 2348 |
|
| 2349 |
template <class Class, typename MethodPtr> |
| 2350 |
static R InvokeMethod(Class* obj_ptr, |
| 2351 |
MethodPtr method_ptr, |
| 2352 |
const ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, |
| 2353 |
A8>& args) { |
| 2354 |
using ::std::tr1::get; |
| 2355 |
return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args), |
| 2356 |
get<3>(args), get<4>(args), get<5>(args), get<6>(args), get<7>(args)); |
| 2357 |
} |
| 2358 |
}; |
| 2359 |
|
| 2360 |
template <typename R, typename A1, typename A2, typename A3, typename A4, |
| 2361 |
typename A5, typename A6, typename A7, typename A8, typename A9> |
| 2362 |
class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> > { |
| 2363 |
public: |
| 2364 |
template <typename Function> |
| 2365 |
static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4, |
| 2366 |
A5, A6, A7, A8, A9>& args) { |
| 2367 |
using ::std::tr1::get; |
| 2368 |
return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args), |
| 2369 |
get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args)); |
| 2370 |
} |
| 2371 |
|
| 2372 |
template <class Class, typename MethodPtr> |
| 2373 |
static R InvokeMethod(Class* obj_ptr, |
| 2374 |
MethodPtr method_ptr, |
| 2375 |
const ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8, |
| 2376 |
A9>& args) { |
| 2377 |
using ::std::tr1::get; |
| 2378 |
return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args), |
| 2379 |
get<3>(args), get<4>(args), get<5>(args), get<6>(args), get<7>(args), |
| 2380 |
get<8>(args)); |
| 2381 |
} |
| 2382 |
}; |
| 2383 |
|
| 2384 |
template <typename R, typename A1, typename A2, typename A3, typename A4, |
| 2385 |
typename A5, typename A6, typename A7, typename A8, typename A9, |
| 2386 |
typename A10> |
| 2387 |
class InvokeHelper<R, ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9, |
| 2388 |
A10> > { |
| 2389 |
public: |
| 2390 |
template <typename Function> |
| 2391 |
static R Invoke(Function function, const ::std::tr1::tuple<A1, A2, A3, A4, |
| 2392 |
A5, A6, A7, A8, A9, A10>& args) { |
| 2393 |
using ::std::tr1::get; |
| 2394 |
return function(get<0>(args), get<1>(args), get<2>(args), get<3>(args), |
| 2395 |
get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args), |
| 2396 |
get<9>(args)); |
| 2397 |
} |
| 2398 |
|
| 2399 |
template <class Class, typename MethodPtr> |
| 2400 |
static R InvokeMethod(Class* obj_ptr, |
| 2401 |
MethodPtr method_ptr, |
| 2402 |
const ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7, A8, |
| 2403 |
A9, A10>& args) { |
| 2404 |
using ::std::tr1::get; |
| 2405 |
return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(args), |
| 2406 |
get<3>(args), get<4>(args), get<5>(args), get<6>(args), get<7>(args), |
| 2407 |
get<8>(args), get<9>(args)); |
| 2408 |
} |
| 2409 |
}; |
| 2410 |
|
| 2411 |
|
| 2412 |
|
| 2413 |
|
| 2414 |
|
| 2415 |
|
| 2416 |
|
| 2417 |
|
| 2418 |
|
| 2419 |
|
| 2420 |
|
| 2421 |
template <typename R> |
| 2422 |
class CallableHelper { |
| 2423 |
public: |
| 2424 |
|
| 2425 |
template <typename Function> |
| 2426 |
static R Call(Function function) { return function(); } |
| 2427 |
|
| 2428 |
|
| 2429 |
|
| 2430 |
|
| 2431 |
|
| 2432 |
|
| 2433 |
|
| 2434 |
|
| 2435 |
|
| 2436 |
|
| 2437 |
|
| 2438 |
|
| 2439 |
|
| 2440 |
|
| 2441 |
template <typename Function, typename A1> |
| 2442 |
static R Call(Function function, A1 a1) { return function(a1); } |
| 2443 |
|
| 2444 |
|
| 2445 |
template <typename Function, typename A1, typename A2> |
| 2446 |
static R Call(Function function, A1 a1, A2 a2) { |
| 2447 |
return function(a1, a2); |
| 2448 |
} |
| 2449 |
|
| 2450 |
|
| 2451 |
template <typename Function, typename A1, typename A2, typename A3> |
| 2452 |
static R Call(Function function, A1 a1, A2 a2, A3 a3) { |
| 2453 |
return function(a1, a2, a3); |
| 2454 |
} |
| 2455 |
|
| 2456 |
|
| 2457 |
template <typename Function, typename A1, typename A2, typename A3, |
| 2458 |
typename A4> |
| 2459 |
static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4) { |
| 2460 |
return function(a1, a2, a3, a4); |
| 2461 |
} |
| 2462 |
|
| 2463 |
|
| 2464 |
template <typename Function, typename A1, typename A2, typename A3, |
| 2465 |
typename A4, typename A5> |
| 2466 |
static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) { |
| 2467 |
return function(a1, a2, a3, a4, a5); |
| 2468 |
} |
| 2469 |
|
| 2470 |
|
| 2471 |
template <typename Function, typename A1, typename A2, typename A3, |
| 2472 |
typename A4, typename A5, typename A6> |
| 2473 |
static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) { |
| 2474 |
return function(a1, a2, a3, a4, a5, a6); |
| 2475 |
} |
| 2476 |
|
| 2477 |
|
| 2478 |
template <typename Function, typename A1, typename A2, typename A3, |
| 2479 |
typename A4, typename A5, typename A6, typename A7> |
| 2480 |
static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, |
| 2481 |
A7 a7) { |
| 2482 |
return function(a1, a2, a3, a4, a5, a6, a7); |
| 2483 |
} |
| 2484 |
|
| 2485 |
|
| 2486 |
template <typename Function, typename A1, typename A2, typename A3, |
| 2487 |
typename A4, typename A5, typename A6, typename A7, typename A8> |
| 2488 |
static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, |
| 2489 |
A7 a7, A8 a8) { |
| 2490 |
return function(a1, a2, a3, a4, a5, a6, a7, a8); |
| 2491 |
} |
| 2492 |
|
| 2493 |
|
| 2494 |
template <typename Function, typename A1, typename A2, typename A3, |
| 2495 |
typename A4, typename A5, typename A6, typename A7, typename A8, |
| 2496 |
typename A9> |
| 2497 |
static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, |
| 2498 |
A7 a7, A8 a8, A9 a9) { |
| 2499 |
return function(a1, a2, a3, a4, a5, a6, a7, a8, a9); |
| 2500 |
} |
| 2501 |
|
| 2502 |
|
| 2503 |
template <typename Function, typename A1, typename A2, typename A3, |
| 2504 |
typename A4, typename A5, typename A6, typename A7, typename A8, |
| 2505 |
typename A9, typename A10> |
| 2506 |
static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, |
| 2507 |
A7 a7, A8 a8, A9 a9, A10 a10) { |
| 2508 |
return function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); |
| 2509 |
} |
| 2510 |
}; |
| 2511 |
|
| 2512 |
|
| 2513 |
|
| 2514 |
#define GMOCK_FIELD_(Tuple, N) \ |
| 2515 |
typename ::std::tr1::tuple_element<N, Tuple>::type |
| 2516 |
|
| 2517 |
|
| 2518 |
|
| 2519 |
|
| 2520 |
|
| 2521 |
|
| 2522 |
|
| 2523 |
|
| 2524 |
|
| 2525 |
|
| 2526 |
|
| 2527 |
|
| 2528 |
|
| 2529 |
|
| 2530 |
|
| 2531 |
|
| 2532 |
|
| 2533 |
|
| 2534 |
|
| 2535 |
template <typename Result, typename ArgumentTuple, int k1, int k2, int k3, |
| 2536 |
int k4, int k5, int k6, int k7, int k8, int k9, int k10> |
| 2537 |
class SelectArgs { |
| 2538 |
public: |
| 2539 |
typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), |
| 2540 |
GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3), |
| 2541 |
GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5), |
| 2542 |
GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7), |
| 2543 |
GMOCK_FIELD_(ArgumentTuple, k8), GMOCK_FIELD_(ArgumentTuple, k9), |
| 2544 |
GMOCK_FIELD_(ArgumentTuple, k10)); |
| 2545 |
typedef typename Function<type>::ArgumentTuple SelectedArgs; |
| 2546 |
static SelectedArgs Select(const ArgumentTuple& args) { |
| 2547 |
using ::std::tr1::get; |
| 2548 |
return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args), |
| 2549 |
get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args), |
| 2550 |
get<k8>(args), get<k9>(args), get<k10>(args)); |
| 2551 |
} |
| 2552 |
}; |
| 2553 |
|
| 2554 |
template <typename Result, typename ArgumentTuple> |
| 2555 |
class SelectArgs<Result, ArgumentTuple, |
| 2556 |
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1> { |
| 2557 |
public: |
| 2558 |
typedef Result type(); |
| 2559 |
typedef typename Function<type>::ArgumentTuple SelectedArgs; |
| 2560 |
static SelectedArgs Select(const ArgumentTuple& ) { |
| 2561 |
using ::std::tr1::get; |
| 2562 |
return SelectedArgs(); |
| 2563 |
} |
| 2564 |
}; |
| 2565 |
|
| 2566 |
template <typename Result, typename ArgumentTuple, int k1> |
| 2567 |
class SelectArgs<Result, ArgumentTuple, |
| 2568 |
k1, -1, -1, -1, -1, -1, -1, -1, -1, -1> { |
| 2569 |
public: |
| 2570 |
typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1)); |
| 2571 |
typedef typename Function<type>::ArgumentTuple SelectedArgs; |
| 2572 |
static SelectedArgs Select(const ArgumentTuple& args) { |
| 2573 |
using ::std::tr1::get; |
| 2574 |
return SelectedArgs(get<k1>(args)); |
| 2575 |
} |
| 2576 |
}; |
| 2577 |
|
| 2578 |
template <typename Result, typename ArgumentTuple, int k1, int k2> |
| 2579 |
class SelectArgs<Result, ArgumentTuple, |
| 2580 |
k1, k2, -1, -1, -1, -1, -1, -1, -1, -1> { |
| 2581 |
public: |
| 2582 |
typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), |
| 2583 |
GMOCK_FIELD_(ArgumentTuple, k2)); |
| 2584 |
typedef typename Function<type>::ArgumentTuple SelectedArgs; |
| 2585 |
static SelectedArgs Select(const ArgumentTuple& args) { |
| 2586 |
using ::std::tr1::get; |
| 2587 |
return SelectedArgs(get<k1>(args), get<k2>(args)); |
| 2588 |
} |
| 2589 |
}; |
| 2590 |
|
| 2591 |
template <typename Result, typename ArgumentTuple, int k1, int k2, int k3> |
| 2592 |
class SelectArgs<Result, ArgumentTuple, |
| 2593 |
k1, k2, k3, -1, -1, -1, -1, -1, -1, -1> { |
| 2594 |
public: |
| 2595 |
typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), |
| 2596 |
GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3)); |
| 2597 |
typedef typename Function<type>::ArgumentTuple SelectedArgs; |
| 2598 |
static SelectedArgs Select(const ArgumentTuple& args) { |
| 2599 |
using ::std::tr1::get; |
| 2600 |
return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args)); |
| 2601 |
} |
| 2602 |
}; |
| 2603 |
|
| 2604 |
template <typename Result, typename ArgumentTuple, int k1, int k2, int k3, |
| 2605 |
int k4> |
| 2606 |
class SelectArgs<Result, ArgumentTuple, |
| 2607 |
k1, k2, k3, k4, -1, -1, -1, -1, -1, -1> { |
| 2608 |
public: |
| 2609 |
typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), |
| 2610 |
GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3), |
| 2611 |
GMOCK_FIELD_(ArgumentTuple, k4)); |
| 2612 |
typedef typename Function<type>::ArgumentTuple SelectedArgs; |
| 2613 |
static SelectedArgs Select(const ArgumentTuple& args) { |
| 2614 |
using ::std::tr1::get; |
| 2615 |
return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args), |
| 2616 |
get<k4>(args)); |
| 2617 |
} |
| 2618 |
}; |
| 2619 |
|
| 2620 |
template <typename Result, typename ArgumentTuple, int k1, int k2, int k3, |
| 2621 |
int k4, int k5> |
| 2622 |
class SelectArgs<Result, ArgumentTuple, |
| 2623 |
k1, k2, k3, k4, k5, -1, -1, -1, -1, -1> { |
| 2624 |
public: |
| 2625 |
typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), |
| 2626 |
GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3), |
| 2627 |
GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5)); |
| 2628 |
typedef typename Function<type>::ArgumentTuple SelectedArgs; |
| 2629 |
static SelectedArgs Select(const ArgumentTuple& args) { |
| 2630 |
using ::std::tr1::get; |
| 2631 |
return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args), |
| 2632 |
get<k4>(args), get<k5>(args)); |
| 2633 |
} |
| 2634 |
}; |
| 2635 |
|
| 2636 |
template <typename Result, typename ArgumentTuple, int k1, int k2, int k3, |
| 2637 |
int k4, int k5, int k6> |
| 2638 |
class SelectArgs<Result, ArgumentTuple, |
| 2639 |
k1, k2, k3, k4, k5, k6, -1, -1, -1, -1> { |
| 2640 |
public: |
| 2641 |
typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), |
| 2642 |
GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3), |
| 2643 |
GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5), |
| 2644 |
GMOCK_FIELD_(ArgumentTuple, k6)); |
| 2645 |
typedef typename Function<type>::ArgumentTuple SelectedArgs; |
| 2646 |
static SelectedArgs Select(const ArgumentTuple& args) { |
| 2647 |
using ::std::tr1::get; |
| 2648 |
return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args), |
| 2649 |
get<k4>(args), get<k5>(args), get<k6>(args)); |
| 2650 |
} |
| 2651 |
}; |
| 2652 |
|
| 2653 |
template <typename Result, typename ArgumentTuple, int k1, int k2, int k3, |
| 2654 |
int k4, int k5, int k6, int k7> |
| 2655 |
class SelectArgs<Result, ArgumentTuple, |
| 2656 |
k1, k2, k3, k4, k5, k6, k7, -1, -1, -1> { |
| 2657 |
public: |
| 2658 |
typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), |
| 2659 |
GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3), |
| 2660 |
GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5), |
| 2661 |
GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7)); |
| 2662 |
typedef typename Function<type>::ArgumentTuple SelectedArgs; |
| 2663 |
static SelectedArgs Select(const ArgumentTuple& args) { |
| 2664 |
using ::std::tr1::get; |
| 2665 |
return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args), |
| 2666 |
get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args)); |
| 2667 |
} |
| 2668 |
}; |
| 2669 |
|
| 2670 |
template <typename Result, typename ArgumentTuple, int k1, int k2, int k3, |
| 2671 |
int k4, int k5, int k6, int k7, int k8> |
| 2672 |
class SelectArgs<Result, ArgumentTuple, |
| 2673 |
k1, k2, k3, k4, k5, k6, k7, k8, -1, -1> { |
| 2674 |
public: |
| 2675 |
typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), |
| 2676 |
GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3), |
| 2677 |
GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5), |
| 2678 |
GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7), |
| 2679 |
GMOCK_FIELD_(ArgumentTuple, k8)); |
| 2680 |
typedef typename Function<type>::ArgumentTuple SelectedArgs; |
| 2681 |
static SelectedArgs Select(const ArgumentTuple& args) { |
| 2682 |
using ::std::tr1::get; |
| 2683 |
return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args), |
| 2684 |
get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args), |
| 2685 |
get<k8>(args)); |
| 2686 |
} |
| 2687 |
}; |
| 2688 |
|
| 2689 |
template <typename Result, typename ArgumentTuple, int k1, int k2, int k3, |
| 2690 |
int k4, int k5, int k6, int k7, int k8, int k9> |
| 2691 |
class SelectArgs<Result, ArgumentTuple, |
| 2692 |
k1, k2, k3, k4, k5, k6, k7, k8, k9, -1> { |
| 2693 |
public: |
| 2694 |
typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1), |
| 2695 |
GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3), |
| 2696 |
GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5), |
| 2697 |
GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7), |
| 2698 |
GMOCK_FIELD_(ArgumentTuple, k8), GMOCK_FIELD_(ArgumentTuple, k9)); |
| 2699 |
typedef typename Function<type>::ArgumentTuple SelectedArgs; |
| 2700 |
static SelectedArgs Select(const ArgumentTuple& args) { |
| 2701 |
using ::std::tr1::get; |
| 2702 |
return SelectedArgs(get<k1>(args), get<k2>(args), get<k3>(args), |
| 2703 |
get<k4>(args), get<k5>(args), get<k6>(args), get<k7>(args), |
| 2704 |
get<k8>(args), get<k9>(args)); |
| 2705 |
} |
| 2706 |
}; |
| 2707 |
|
| 2708 |
#undef GMOCK_FIELD_ |
| 2709 |
|
| 2710 |
|
| 2711 |
template <typename InnerAction, int k1 = -1, int k2 = -1, int k3 = -1, |
| 2712 |
int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1, int k8 = -1, |
| 2713 |
int k9 = -1, int k10 = -1> |
| 2714 |
class WithArgsAction { |
| 2715 |
public: |
| 2716 |
explicit WithArgsAction(const InnerAction& action) : action_(action) {} |
| 2717 |
|
| 2718 |
template <typename F> |
| 2719 |
operator Action<F>() const { return MakeAction(new Impl<F>(action_)); } |
| 2720 |
|
| 2721 |
private: |
| 2722 |
template <typename F> |
| 2723 |
class Impl : public ActionInterface<F> { |
| 2724 |
public: |
| 2725 |
typedef typename Function<F>::Result Result; |
| 2726 |
typedef typename Function<F>::ArgumentTuple ArgumentTuple; |
| 2727 |
|
| 2728 |
explicit Impl(const InnerAction& action) : action_(action) {} |
| 2729 |
|
| 2730 |
virtual Result Perform(const ArgumentTuple& args) { |
| 2731 |
return action_.Perform(SelectArgs<Result, ArgumentTuple, k1, k2, k3, k4, |
| 2732 |
k5, k6, k7, k8, k9, k10>::Select(args)); |
| 2733 |
} |
| 2734 |
|
| 2735 |
private: |
| 2736 |
typedef typename SelectArgs<Result, ArgumentTuple, |
| 2737 |
k1, k2, k3, k4, k5, k6, k7, k8, k9, k10>::type InnerFunctionType; |
| 2738 |
|
| 2739 |
Action<InnerFunctionType> action_; |
| 2740 |
}; |
| 2741 |
|
| 2742 |
const InnerAction action_; |
| 2743 |
|
| 2744 |
GTEST_DISALLOW_ASSIGN_(WithArgsAction); |
| 2745 |
}; |
| 2746 |
|
| 2747 |
|
| 2748 |
|
| 2749 |
|
| 2750 |
|
| 2751 |
|
| 2752 |
|
| 2753 |
|
| 2754 |
|
| 2755 |
|
| 2756 |
|
| 2757 |
|
| 2758 |
|
| 2759 |
|
| 2760 |
|
| 2761 |
struct ExcessiveArg {}; |
| 2762 |
|
| 2763 |
|
| 2764 |
template <typename Result, class Impl> |
| 2765 |
class ActionHelper { |
| 2766 |
public: |
| 2767 |
static Result Perform(Impl* impl, const ::std::tr1::tuple<>& args) { |
| 2768 |
using ::std::tr1::get; |
| 2769 |
return impl->template gmock_PerformImpl<>(args, ExcessiveArg(), |
| 2770 |
ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), |
| 2771 |
ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), |
| 2772 |
ExcessiveArg()); |
| 2773 |
} |
| 2774 |
|
| 2775 |
template <typename A0> |
| 2776 |
static Result Perform(Impl* impl, const ::std::tr1::tuple<A0>& args) { |
| 2777 |
using ::std::tr1::get; |
| 2778 |
return impl->template gmock_PerformImpl<A0>(args, get<0>(args), |
| 2779 |
ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), |
| 2780 |
ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), |
| 2781 |
ExcessiveArg()); |
| 2782 |
} |
| 2783 |
|
| 2784 |
template <typename A0, typename A1> |
| 2785 |
static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1>& args) { |
| 2786 |
using ::std::tr1::get; |
| 2787 |
return impl->template gmock_PerformImpl<A0, A1>(args, get<0>(args), |
| 2788 |
get<1>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), |
| 2789 |
ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), |
| 2790 |
ExcessiveArg()); |
| 2791 |
} |
| 2792 |
|
| 2793 |
template <typename A0, typename A1, typename A2> |
| 2794 |
static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2>& args) { |
| 2795 |
using ::std::tr1::get; |
| 2796 |
return impl->template gmock_PerformImpl<A0, A1, A2>(args, get<0>(args), |
| 2797 |
get<1>(args), get<2>(args), ExcessiveArg(), ExcessiveArg(), |
| 2798 |
ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), |
| 2799 |
ExcessiveArg()); |
| 2800 |
} |
| 2801 |
|
| 2802 |
template <typename A0, typename A1, typename A2, typename A3> |
| 2803 |
static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, |
| 2804 |
A3>& args) { |
| 2805 |
using ::std::tr1::get; |
| 2806 |
return impl->template gmock_PerformImpl<A0, A1, A2, A3>(args, get<0>(args), |
| 2807 |
get<1>(args), get<2>(args), get<3>(args), ExcessiveArg(), |
| 2808 |
ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), |
| 2809 |
ExcessiveArg()); |
| 2810 |
} |
| 2811 |
|
| 2812 |
template <typename A0, typename A1, typename A2, typename A3, typename A4> |
| 2813 |
static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, |
| 2814 |
A4>& args) { |
| 2815 |
using ::std::tr1::get; |
| 2816 |
return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4>(args, |
| 2817 |
get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args), |
| 2818 |
ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), |
| 2819 |
ExcessiveArg()); |
| 2820 |
} |
| 2821 |
|
| 2822 |
template <typename A0, typename A1, typename A2, typename A3, typename A4, |
| 2823 |
typename A5> |
| 2824 |
static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4, |
| 2825 |
A5>& args) { |
| 2826 |
using ::std::tr1::get; |
| 2827 |
return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5>(args, |
| 2828 |
get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args), |
| 2829 |
get<5>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), |
| 2830 |
ExcessiveArg()); |
| 2831 |
} |
| 2832 |
|
| 2833 |
template <typename A0, typename A1, typename A2, typename A3, typename A4, |
| 2834 |
typename A5, typename A6> |
| 2835 |
static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4, |
| 2836 |
A5, A6>& args) { |
| 2837 |
using ::std::tr1::get; |
| 2838 |
return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6>(args, |
| 2839 |
get<0>(args), get<1>(args), get<2>(args), get<3>(args), get<4>(args), |
| 2840 |
get<5>(args), get<6>(args), ExcessiveArg(), ExcessiveArg(), |
| 2841 |
ExcessiveArg()); |
| 2842 |
} |
| 2843 |
|
| 2844 |
template <typename A0, typename A1, typename A2, typename A3, typename A4, |
| 2845 |
typename A5, typename A6, typename A7> |
| 2846 |
static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4, |
| 2847 |
A5, A6, A7>& args) { |
| 2848 |
using ::std::tr1::get; |
| 2849 |
return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6, |
| 2850 |
A7>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args), |
| 2851 |
get<4>(args), get<5>(args), get<6>(args), get<7>(args), ExcessiveArg(), |
| 2852 |
ExcessiveArg()); |
| 2853 |
} |
| 2854 |
|
| 2855 |
template <typename A0, typename A1, typename A2, typename A3, typename A4, |
| 2856 |
typename A5, typename A6, typename A7, typename A8> |
| 2857 |
static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4, |
| 2858 |
A5, A6, A7, A8>& args) { |
| 2859 |
using ::std::tr1::get; |
| 2860 |
return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6, A7, |
| 2861 |
A8>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args), |
| 2862 |
get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args), |
| 2863 |
ExcessiveArg()); |
| 2864 |
} |
| 2865 |
|
| 2866 |
template <typename A0, typename A1, typename A2, typename A3, typename A4, |
| 2867 |
typename A5, typename A6, typename A7, typename A8, typename A9> |
| 2868 |
static Result Perform(Impl* impl, const ::std::tr1::tuple<A0, A1, A2, A3, A4, |
| 2869 |
A5, A6, A7, A8, A9>& args) { |
| 2870 |
using ::std::tr1::get; |
| 2871 |
return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6, A7, A8, |
| 2872 |
A9>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args), |
| 2873 |
get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args), |
| 2874 |
get<9>(args)); |
| 2875 |
} |
| 2876 |
}; |
| 2877 |
|
| 2878 |
} |
| 2879 |
|
| 2880 |
|
| 2881 |
|
| 2882 |
|
| 2883 |
|
| 2884 |
|
| 2885 |
|
| 2886 |
|
| 2887 |
template <int k1, typename InnerAction> |
| 2888 |
inline internal::WithArgsAction<InnerAction, k1> |
| 2889 |
WithArgs(const InnerAction& action) { |
| 2890 |
return internal::WithArgsAction<InnerAction, k1>(action); |
| 2891 |
} |
| 2892 |
|
| 2893 |
template <int k1, int k2, typename InnerAction> |
| 2894 |
inline internal::WithArgsAction<InnerAction, k1, k2> |
| 2895 |
WithArgs(const InnerAction& action) { |
| 2896 |
return internal::WithArgsAction<InnerAction, k1, k2>(action); |
| 2897 |
} |
| 2898 |
|
| 2899 |
template <int k1, int k2, int k3, typename InnerAction> |
| 2900 |
inline internal::WithArgsAction<InnerAction, k1, k2, k3> |
| 2901 |
WithArgs(const InnerAction& action) { |
| 2902 |
return internal::WithArgsAction<InnerAction, k1, k2, k3>(action); |
| 2903 |
} |
| 2904 |
|
| 2905 |
template <int k1, int k2, int k3, int k4, typename InnerAction> |
| 2906 |
inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4> |
| 2907 |
WithArgs(const InnerAction& action) { |
| 2908 |
return internal::WithArgsAction<InnerAction, k1, k2, k3, k4>(action); |
| 2909 |
} |
| 2910 |
|
| 2911 |
template <int k1, int k2, int k3, int k4, int k5, typename InnerAction> |
| 2912 |
inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5> |
| 2913 |
WithArgs(const InnerAction& action) { |
| 2914 |
return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5>(action); |
| 2915 |
} |
| 2916 |
|
| 2917 |
template <int k1, int k2, int k3, int k4, int k5, int k6, typename InnerAction> |
| 2918 |
inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6> |
| 2919 |
WithArgs(const InnerAction& action) { |
| 2920 |
return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6>(action); |
| 2921 |
} |
| 2922 |
|
| 2923 |
template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, |
| 2924 |
typename InnerAction> |
| 2925 |
inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7> |
| 2926 |
WithArgs(const InnerAction& action) { |
| 2927 |
return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, |
| 2928 |
k7>(action); |
| 2929 |
} |
| 2930 |
|
| 2931 |
template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8, |
| 2932 |
typename InnerAction> |
| 2933 |
inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8> |
| 2934 |
WithArgs(const InnerAction& action) { |
| 2935 |
return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, |
| 2936 |
k8>(action); |
| 2937 |
} |
| 2938 |
|
| 2939 |
template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8, |
| 2940 |
int k9, typename InnerAction> |
| 2941 |
inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8, k9> |
| 2942 |
WithArgs(const InnerAction& action) { |
| 2943 |
return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8, |
| 2944 |
k9>(action); |
| 2945 |
} |
| 2946 |
|
| 2947 |
template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8, |
| 2948 |
int k9, int k10, typename InnerAction> |
| 2949 |
inline internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8, |
| 2950 |
k9, k10> |
| 2951 |
WithArgs(const InnerAction& action) { |
| 2952 |
return internal::WithArgsAction<InnerAction, k1, k2, k3, k4, k5, k6, k7, k8, |
| 2953 |
k9, k10>(action); |
| 2954 |
} |
| 2955 |
|
| 2956 |
|
| 2957 |
|
| 2958 |
template <typename Action1, typename Action2> |
| 2959 |
inline internal::DoBothAction<Action1, Action2> |
| 2960 |
DoAll(Action1 a1, Action2 a2) { |
| 2961 |
return internal::DoBothAction<Action1, Action2>(a1, a2); |
| 2962 |
} |
| 2963 |
|
| 2964 |
template <typename Action1, typename Action2, typename Action3> |
| 2965 |
inline internal::DoBothAction<Action1, internal::DoBothAction<Action2, |
| 2966 |
Action3> > |
| 2967 |
DoAll(Action1 a1, Action2 a2, Action3 a3) { |
| 2968 |
return DoAll(a1, DoAll(a2, a3)); |
| 2969 |
} |
| 2970 |
|
| 2971 |
template <typename Action1, typename Action2, typename Action3, |
| 2972 |
typename Action4> |
| 2973 |
inline internal::DoBothAction<Action1, internal::DoBothAction<Action2, |
| 2974 |
internal::DoBothAction<Action3, Action4> > > |
| 2975 |
DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4) { |
| 2976 |
return DoAll(a1, DoAll(a2, a3, a4)); |
| 2977 |
} |
| 2978 |
|
| 2979 |
template <typename Action1, typename Action2, typename Action3, |
| 2980 |
typename Action4, typename Action5> |
| 2981 |
inline internal::DoBothAction<Action1, internal::DoBothAction<Action2, |
| 2982 |
internal::DoBothAction<Action3, internal::DoBothAction<Action4, |
| 2983 |
Action5> > > > |
| 2984 |
DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5) { |
| 2985 |
return DoAll(a1, DoAll(a2, a3, a4, a5)); |
| 2986 |
} |
| 2987 |
|
| 2988 |
template <typename Action1, typename Action2, typename Action3, |
| 2989 |
typename Action4, typename Action5, typename Action6> |
| 2990 |
inline internal::DoBothAction<Action1, internal::DoBothAction<Action2, |
| 2991 |
internal::DoBothAction<Action3, internal::DoBothAction<Action4, |
| 2992 |
internal::DoBothAction<Action5, Action6> > > > > |
| 2993 |
DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6) { |
| 2994 |
return DoAll(a1, DoAll(a2, a3, a4, a5, a6)); |
| 2995 |
} |
| 2996 |
|
| 2997 |
template <typename Action1, typename Action2, typename Action3, |
| 2998 |
typename Action4, typename Action5, typename Action6, typename Action7> |
| 2999 |
inline internal::DoBothAction<Action1, internal::DoBothAction<Action2, |
| 3000 |
internal::DoBothAction<Action3, internal::DoBothAction<Action4, |
| 3001 |
internal::DoBothAction<Action5, internal::DoBothAction<Action6, |
| 3002 |
Action7> > > > > > |
| 3003 |
DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6, |
| 3004 |
Action7 a7) { |
| 3005 |
return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7)); |
| 3006 |
} |
| 3007 |
|
| 3008 |
template <typename Action1, typename Action2, typename Action3, |
| 3009 |
typename Action4, typename Action5, typename Action6, typename Action7, |
| 3010 |
typename Action8> |
| 3011 |
inline internal::DoBothAction<Action1, internal::DoBothAction<Action2, |
| 3012 |
internal::DoBothAction<Action3, internal::DoBothAction<Action4, |
| 3013 |
internal::DoBothAction<Action5, internal::DoBothAction<Action6, |
| 3014 |
internal::DoBothAction<Action7, Action8> > > > > > > |
| 3015 |
DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6, |
| 3016 |
Action7 a7, Action8 a8) { |
| 3017 |
return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8)); |
| 3018 |
} |
| 3019 |
|
| 3020 |
template <typename Action1, typename Action2, typename Action3, |
| 3021 |
typename Action4, typename Action5, typename Action6, typename Action7, |
| 3022 |
typename Action8, typename Action9> |
| 3023 |
inline internal::DoBothAction<Action1, internal::DoBothAction<Action2, |
| 3024 |
internal::DoBothAction<Action3, internal::DoBothAction<Action4, |
| 3025 |
internal::DoBothAction<Action5, internal::DoBothAction<Action6, |
| 3026 |
internal::DoBothAction<Action7, internal::DoBothAction<Action8, |
| 3027 |
Action9> > > > > > > > |
| 3028 |
DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6, |
| 3029 |
Action7 a7, Action8 a8, Action9 a9) { |
| 3030 |
return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8, a9)); |
| 3031 |
} |
| 3032 |
|
| 3033 |
template <typename Action1, typename Action2, typename Action3, |
| 3034 |
typename Action4, typename Action5, typename Action6, typename Action7, |
| 3035 |
typename Action8, typename Action9, typename Action10> |
| 3036 |
inline internal::DoBothAction<Action1, internal::DoBothAction<Action2, |
| 3037 |
internal::DoBothAction<Action3, internal::DoBothAction<Action4, |
| 3038 |
internal::DoBothAction<Action5, internal::DoBothAction<Action6, |
| 3039 |
internal::DoBothAction<Action7, internal::DoBothAction<Action8, |
| 3040 |
internal::DoBothAction<Action9, Action10> > > > > > > > > |
| 3041 |
DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6, |
| 3042 |
Action7 a7, Action8 a8, Action9 a9, Action10 a10) { |
| 3043 |
return DoAll(a1, DoAll(a2, a3, a4, a5, a6, a7, a8, a9, a10)); |
| 3044 |
} |
| 3045 |
|
| 3046 |
} |
| 3047 |
|
| 3048 |
|
| 3049 |
|
| 3050 |
|
| 3051 |
|
| 3052 |
|
| 3053 |
|
| 3054 |
|
| 3055 |
|
| 3056 |
|
| 3057 |
|
| 3058 |
|
| 3059 |
|
| 3060 |
|
| 3061 |
|
| 3062 |
|
| 3063 |
|
| 3064 |
|
| 3065 |
|
| 3066 |
|
| 3067 |
|
| 3068 |
|
| 3069 |
|
| 3070 |
|
| 3071 |
|
| 3072 |
|
| 3073 |
|
| 3074 |
|
| 3075 |
|
| 3076 |
|
| 3077 |
|
| 3078 |
|
| 3079 |
|
| 3080 |
|
| 3081 |
|
| 3082 |
|
| 3083 |
|
| 3084 |
|
| 3085 |
|
| 3086 |
|
| 3087 |
|
| 3088 |
|
| 3089 |
|
| 3090 |
|
| 3091 |
|
| 3092 |
|
| 3093 |
|
| 3094 |
|
| 3095 |
|
| 3096 |
|
| 3097 |
|
| 3098 |
|
| 3099 |
|
| 3100 |
|
| 3101 |
|
| 3102 |
|
| 3103 |
|
| 3104 |
|
| 3105 |
|
| 3106 |
|
| 3107 |
|
| 3108 |
|
| 3109 |
|
| 3110 |
|
| 3111 |
|
| 3112 |
|
| 3113 |
|
| 3114 |
|
| 3115 |
|
| 3116 |
|
| 3117 |
|
| 3118 |
|
| 3119 |
|
| 3120 |
|
| 3121 |
|
| 3122 |
|
| 3123 |
|
| 3124 |
|
| 3125 |
|
| 3126 |
|
| 3127 |
|
| 3128 |
|
| 3129 |
|
| 3130 |
|
| 3131 |
|
| 3132 |
|
| 3133 |
|
| 3134 |
|
| 3135 |
|
| 3136 |
|
| 3137 |
|
| 3138 |
|
| 3139 |
|
| 3140 |
|
| 3141 |
|
| 3142 |
|
| 3143 |
|
| 3144 |
|
| 3145 |
#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_\ |
| 3146 |
const args_type& args GTEST_ATTRIBUTE_UNUSED_, \ |
| 3147 |
arg0_type arg0 GTEST_ATTRIBUTE_UNUSED_, \ |
| 3148 |
arg1_type arg1 GTEST_ATTRIBUTE_UNUSED_, \ |
| 3149 |
arg2_type arg2 GTEST_ATTRIBUTE_UNUSED_, \ |
| 3150 |
arg3_type arg3 GTEST_ATTRIBUTE_UNUSED_, \ |
| 3151 |
arg4_type arg4 GTEST_ATTRIBUTE_UNUSED_, \ |
| 3152 |
arg5_type arg5 GTEST_ATTRIBUTE_UNUSED_, \ |
| 3153 |
arg6_type arg6 GTEST_ATTRIBUTE_UNUSED_, \ |
| 3154 |
arg7_type arg7 GTEST_ATTRIBUTE_UNUSED_, \ |
| 3155 |
arg8_type arg8 GTEST_ATTRIBUTE_UNUSED_, \ |
| 3156 |
arg9_type arg9 GTEST_ATTRIBUTE_UNUSED_ |
| 3157 |
|
| 3158 |
|
| 3159 |
|
| 3160 |
|
| 3161 |
|
| 3162 |
|
| 3163 |
|
| 3164 |
|
| 3165 |
|
| 3166 |
|
| 3167 |
|
| 3168 |
|
| 3169 |
|
| 3170 |
|
| 3171 |
|
| 3172 |
|
| 3173 |
|
| 3174 |
|
| 3175 |
|
| 3176 |
|
| 3177 |
|
| 3178 |
|
| 3179 |
|
| 3180 |
|
| 3181 |
|
| 3182 |
|
| 3183 |
|
| 3184 |
|
| 3185 |
|
| 3186 |
|
| 3187 |
|
| 3188 |
|
| 3189 |
|
| 3190 |
|
| 3191 |
|
| 3192 |
|
| 3193 |
|
| 3194 |
|
| 3195 |
|
| 3196 |
|
| 3197 |
|
| 3198 |
|
| 3199 |
|
| 3200 |
|
| 3201 |
|
| 3202 |
|
| 3203 |
|
| 3204 |
|
| 3205 |
|
| 3206 |
|
| 3207 |
|
| 3208 |
|
| 3209 |
|
| 3210 |
|
| 3211 |
|
| 3212 |
|
| 3213 |
|
| 3214 |
|
| 3215 |
|
| 3216 |
|
| 3217 |
|
| 3218 |
|
| 3219 |
|
| 3220 |
|
| 3221 |
|
| 3222 |
|
| 3223 |
|
| 3224 |
|
| 3225 |
|
| 3226 |
|
| 3227 |
|
| 3228 |
|
| 3229 |
|
| 3230 |
|
| 3231 |
|
| 3232 |
|
| 3233 |
|
| 3234 |
|
| 3235 |
|
| 3236 |
|
| 3237 |
|
| 3238 |
|
| 3239 |
|
| 3240 |
#define GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(kind0, name0) kind0 name0 |
| 3241 |
#define GMOCK_INTERNAL_DECL_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \ |
| 3242 |
name1) kind0 name0, kind1 name1 |
| 3243 |
#define GMOCK_INTERNAL_DECL_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ |
| 3244 |
kind2, name2) kind0 name0, kind1 name1, kind2 name2 |
| 3245 |
#define GMOCK_INTERNAL_DECL_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ |
| 3246 |
kind2, name2, kind3, name3) kind0 name0, kind1 name1, kind2 name2, \ |
| 3247 |
kind3 name3 |
| 3248 |
#define GMOCK_INTERNAL_DECL_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ |
| 3249 |
kind2, name2, kind3, name3, kind4, name4) kind0 name0, kind1 name1, \ |
| 3250 |
kind2 name2, kind3 name3, kind4 name4 |
| 3251 |
#define GMOCK_INTERNAL_DECL_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ |
| 3252 |
kind2, name2, kind3, name3, kind4, name4, kind5, name5) kind0 name0, \ |
| 3253 |
kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5 |
| 3254 |
#define GMOCK_INTERNAL_DECL_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ |
| 3255 |
kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \ |
| 3256 |
name6) kind0 name0, kind1 name1, kind2 name2, kind3 name3, kind4 name4, \ |
| 3257 |
kind5 name5, kind6 name6 |
| 3258 |
#define GMOCK_INTERNAL_DECL_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ |
| 3259 |
kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \ |
| 3260 |
kind7, name7) kind0 name0, kind1 name1, kind2 name2, kind3 name3, \ |
| 3261 |
kind4 name4, kind5 name5, kind6 name6, kind7 name7 |
| 3262 |
#define GMOCK_INTERNAL_DECL_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ |
| 3263 |
kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \ |
| 3264 |
kind7, name7, kind8, name8) kind0 name0, kind1 name1, kind2 name2, \ |
| 3265 |
kind3 name3, kind4 name4, kind5 name5, kind6 name6, kind7 name7, \ |
| 3266 |
kind8 name8 |
| 3267 |
#define GMOCK_INTERNAL_DECL_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \ |
| 3268 |
name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \ |
| 3269 |
name6, kind7, name7, kind8, name8, kind9, name9) kind0 name0, \ |
| 3270 |
kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5, \ |
| 3271 |
kind6 name6, kind7 name7, kind8 name8, kind9 name9 |
| 3272 |
|
| 3273 |
|
| 3274 |
#define GMOCK_INTERNAL_LIST_HAS_1_TEMPLATE_PARAMS(kind0, name0) name0 |
| 3275 |
#define GMOCK_INTERNAL_LIST_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \ |
| 3276 |
name1) name0, name1 |
| 3277 |
#define GMOCK_INTERNAL_LIST_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ |
| 3278 |
kind2, name2) name0, name1, name2 |
| 3279 |
#define GMOCK_INTERNAL_LIST_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ |
| 3280 |
kind2, name2, kind3, name3) name0, name1, name2, name3 |
| 3281 |
#define GMOCK_INTERNAL_LIST_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ |
| 3282 |
kind2, name2, kind3, name3, kind4, name4) name0, name1, name2, name3, \ |
| 3283 |
name4 |
| 3284 |
#define GMOCK_INTERNAL_LIST_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ |
| 3285 |
kind2, name2, kind3, name3, kind4, name4, kind5, name5) name0, name1, \ |
| 3286 |
name2, name3, name4, name5 |
| 3287 |
#define GMOCK_INTERNAL_LIST_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ |
| 3288 |
kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \ |
| 3289 |
name6) name0, name1, name2, name3, name4, name5, name6 |
| 3290 |
#define GMOCK_INTERNAL_LIST_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ |
| 3291 |
kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \ |
| 3292 |
kind7, name7) name0, name1, name2, name3, name4, name5, name6, name7 |
| 3293 |
#define GMOCK_INTERNAL_LIST_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ |
| 3294 |
kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \ |
| 3295 |
kind7, name7, kind8, name8) name0, name1, name2, name3, name4, name5, \ |
| 3296 |
name6, name7, name8 |
| 3297 |
#define GMOCK_INTERNAL_LIST_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \ |
| 3298 |
name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \ |
| 3299 |
name6, kind7, name7, kind8, name8, kind9, name9) name0, name1, name2, \ |
| 3300 |
name3, name4, name5, name6, name7, name8, name9 |
| 3301 |
|
| 3302 |
|
| 3303 |
#define GMOCK_INTERNAL_DECL_TYPE_AND_0_VALUE_PARAMS() |
| 3304 |
#define GMOCK_INTERNAL_DECL_TYPE_AND_1_VALUE_PARAMS(p0) , typename p0##_type |
| 3305 |
#define GMOCK_INTERNAL_DECL_TYPE_AND_2_VALUE_PARAMS(p0, p1) , \ |
| 3306 |
typename p0##_type, typename p1##_type |
| 3307 |
#define GMOCK_INTERNAL_DECL_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , \ |
| 3308 |
typename p0##_type, typename p1##_type, typename p2##_type |
| 3309 |
#define GMOCK_INTERNAL_DECL_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \ |
| 3310 |
typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 3311 |
typename p3##_type |
| 3312 |
#define GMOCK_INTERNAL_DECL_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \ |
| 3313 |
typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 3314 |
typename p3##_type, typename p4##_type |
| 3315 |
#define GMOCK_INTERNAL_DECL_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) , \ |
| 3316 |
typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 3317 |
typename p3##_type, typename p4##_type, typename p5##_type |
| 3318 |
#define GMOCK_INTERNAL_DECL_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ |
| 3319 |
p6) , typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 3320 |
typename p3##_type, typename p4##_type, typename p5##_type, \ |
| 3321 |
typename p6##_type |
| 3322 |
#define GMOCK_INTERNAL_DECL_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ |
| 3323 |
p6, p7) , typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 3324 |
typename p3##_type, typename p4##_type, typename p5##_type, \ |
| 3325 |
typename p6##_type, typename p7##_type |
| 3326 |
#define GMOCK_INTERNAL_DECL_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ |
| 3327 |
p6, p7, p8) , typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 3328 |
typename p3##_type, typename p4##_type, typename p5##_type, \ |
| 3329 |
typename p6##_type, typename p7##_type, typename p8##_type |
| 3330 |
#define GMOCK_INTERNAL_DECL_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ |
| 3331 |
p6, p7, p8, p9) , typename p0##_type, typename p1##_type, \ |
| 3332 |
typename p2##_type, typename p3##_type, typename p4##_type, \ |
| 3333 |
typename p5##_type, typename p6##_type, typename p7##_type, \ |
| 3334 |
typename p8##_type, typename p9##_type |
| 3335 |
|
| 3336 |
|
| 3337 |
#define GMOCK_INTERNAL_INIT_AND_0_VALUE_PARAMS()\ |
| 3338 |
() |
| 3339 |
#define GMOCK_INTERNAL_INIT_AND_1_VALUE_PARAMS(p0)\ |
| 3340 |
(p0##_type gmock_p0) : p0(gmock_p0) |
| 3341 |
#define GMOCK_INTERNAL_INIT_AND_2_VALUE_PARAMS(p0, p1)\ |
| 3342 |
(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), p1(gmock_p1) |
| 3343 |
#define GMOCK_INTERNAL_INIT_AND_3_VALUE_PARAMS(p0, p1, p2)\ |
| 3344 |
(p0##_type gmock_p0, p1##_type gmock_p1, \ |
| 3345 |
p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) |
| 3346 |
#define GMOCK_INTERNAL_INIT_AND_4_VALUE_PARAMS(p0, p1, p2, p3)\ |
| 3347 |
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
| 3348 |
p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
| 3349 |
p3(gmock_p3) |
| 3350 |
#define GMOCK_INTERNAL_INIT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)\ |
| 3351 |
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
| 3352 |
p3##_type gmock_p3, p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), \ |
| 3353 |
p2(gmock_p2), p3(gmock_p3), p4(gmock_p4) |
| 3354 |
#define GMOCK_INTERNAL_INIT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)\ |
| 3355 |
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
| 3356 |
p3##_type gmock_p3, p4##_type gmock_p4, \ |
| 3357 |
p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
| 3358 |
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) |
| 3359 |
#define GMOCK_INTERNAL_INIT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)\ |
| 3360 |
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
| 3361 |
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ |
| 3362 |
p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
| 3363 |
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6) |
| 3364 |
#define GMOCK_INTERNAL_INIT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)\ |
| 3365 |
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
| 3366 |
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ |
| 3367 |
p6##_type gmock_p6, p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), \ |
| 3368 |
p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ |
| 3369 |
p7(gmock_p7) |
| 3370 |
#define GMOCK_INTERNAL_INIT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ |
| 3371 |
p7, p8)\ |
| 3372 |
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
| 3373 |
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ |
| 3374 |
p6##_type gmock_p6, p7##_type gmock_p7, \ |
| 3375 |
p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
| 3376 |
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ |
| 3377 |
p8(gmock_p8) |
| 3378 |
#define GMOCK_INTERNAL_INIT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ |
| 3379 |
p7, p8, p9)\ |
| 3380 |
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
| 3381 |
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ |
| 3382 |
p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \ |
| 3383 |
p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
| 3384 |
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ |
| 3385 |
p8(gmock_p8), p9(gmock_p9) |
| 3386 |
|
| 3387 |
|
| 3388 |
#define GMOCK_INTERNAL_DEFN_AND_0_VALUE_PARAMS() |
| 3389 |
#define GMOCK_INTERNAL_DEFN_AND_1_VALUE_PARAMS(p0) p0##_type p0; |
| 3390 |
#define GMOCK_INTERNAL_DEFN_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0; \ |
| 3391 |
p1##_type p1; |
| 3392 |
#define GMOCK_INTERNAL_DEFN_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0; \ |
| 3393 |
p1##_type p1; p2##_type p2; |
| 3394 |
#define GMOCK_INTERNAL_DEFN_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0; \ |
| 3395 |
p1##_type p1; p2##_type p2; p3##_type p3; |
| 3396 |
#define GMOCK_INTERNAL_DEFN_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \ |
| 3397 |
p4) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; |
| 3398 |
#define GMOCK_INTERNAL_DEFN_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \ |
| 3399 |
p5) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \ |
| 3400 |
p5##_type p5; |
| 3401 |
#define GMOCK_INTERNAL_DEFN_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ |
| 3402 |
p6) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \ |
| 3403 |
p5##_type p5; p6##_type p6; |
| 3404 |
#define GMOCK_INTERNAL_DEFN_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ |
| 3405 |
p7) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \ |
| 3406 |
p5##_type p5; p6##_type p6; p7##_type p7; |
| 3407 |
#define GMOCK_INTERNAL_DEFN_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ |
| 3408 |
p7, p8) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \ |
| 3409 |
p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8; |
| 3410 |
#define GMOCK_INTERNAL_DEFN_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ |
| 3411 |
p7, p8, p9) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \ |
| 3412 |
p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8; \ |
| 3413 |
p9##_type p9; |
| 3414 |
|
| 3415 |
|
| 3416 |
#define GMOCK_INTERNAL_LIST_AND_0_VALUE_PARAMS() |
| 3417 |
#define GMOCK_INTERNAL_LIST_AND_1_VALUE_PARAMS(p0) p0 |
| 3418 |
#define GMOCK_INTERNAL_LIST_AND_2_VALUE_PARAMS(p0, p1) p0, p1 |
| 3419 |
#define GMOCK_INTERNAL_LIST_AND_3_VALUE_PARAMS(p0, p1, p2) p0, p1, p2 |
| 3420 |
#define GMOCK_INTERNAL_LIST_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0, p1, p2, p3 |
| 3421 |
#define GMOCK_INTERNAL_LIST_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) p0, p1, \ |
| 3422 |
p2, p3, p4 |
| 3423 |
#define GMOCK_INTERNAL_LIST_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) p0, \ |
| 3424 |
p1, p2, p3, p4, p5 |
| 3425 |
#define GMOCK_INTERNAL_LIST_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ |
| 3426 |
p6) p0, p1, p2, p3, p4, p5, p6 |
| 3427 |
#define GMOCK_INTERNAL_LIST_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ |
| 3428 |
p7) p0, p1, p2, p3, p4, p5, p6, p7 |
| 3429 |
#define GMOCK_INTERNAL_LIST_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ |
| 3430 |
p7, p8) p0, p1, p2, p3, p4, p5, p6, p7, p8 |
| 3431 |
#define GMOCK_INTERNAL_LIST_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ |
| 3432 |
p7, p8, p9) p0, p1, p2, p3, p4, p5, p6, p7, p8, p9 |
| 3433 |
|
| 3434 |
|
| 3435 |
#define GMOCK_INTERNAL_LIST_TYPE_AND_0_VALUE_PARAMS() |
| 3436 |
#define GMOCK_INTERNAL_LIST_TYPE_AND_1_VALUE_PARAMS(p0) , p0##_type |
| 3437 |
#define GMOCK_INTERNAL_LIST_TYPE_AND_2_VALUE_PARAMS(p0, p1) , p0##_type, \ |
| 3438 |
p1##_type |
| 3439 |
#define GMOCK_INTERNAL_LIST_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , p0##_type, \ |
| 3440 |
p1##_type, p2##_type |
| 3441 |
#define GMOCK_INTERNAL_LIST_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \ |
| 3442 |
p0##_type, p1##_type, p2##_type, p3##_type |
| 3443 |
#define GMOCK_INTERNAL_LIST_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \ |
| 3444 |
p0##_type, p1##_type, p2##_type, p3##_type, p4##_type |
| 3445 |
#define GMOCK_INTERNAL_LIST_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) , \ |
| 3446 |
p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type |
| 3447 |
#define GMOCK_INTERNAL_LIST_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ |
| 3448 |
p6) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type, \ |
| 3449 |
p6##_type |
| 3450 |
#define GMOCK_INTERNAL_LIST_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ |
| 3451 |
p6, p7) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ |
| 3452 |
p5##_type, p6##_type, p7##_type |
| 3453 |
#define GMOCK_INTERNAL_LIST_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ |
| 3454 |
p6, p7, p8) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ |
| 3455 |
p5##_type, p6##_type, p7##_type, p8##_type |
| 3456 |
#define GMOCK_INTERNAL_LIST_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ |
| 3457 |
p6, p7, p8, p9) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ |
| 3458 |
p5##_type, p6##_type, p7##_type, p8##_type, p9##_type |
| 3459 |
|
| 3460 |
|
| 3461 |
#define GMOCK_INTERNAL_DECL_AND_0_VALUE_PARAMS() |
| 3462 |
#define GMOCK_INTERNAL_DECL_AND_1_VALUE_PARAMS(p0) p0##_type p0 |
| 3463 |
#define GMOCK_INTERNAL_DECL_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0, \ |
| 3464 |
p1##_type p1 |
| 3465 |
#define GMOCK_INTERNAL_DECL_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0, \ |
| 3466 |
p1##_type p1, p2##_type p2 |
| 3467 |
#define GMOCK_INTERNAL_DECL_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0, \ |
| 3468 |
p1##_type p1, p2##_type p2, p3##_type p3 |
| 3469 |
#define GMOCK_INTERNAL_DECL_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \ |
| 3470 |
p4) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4 |
| 3471 |
#define GMOCK_INTERNAL_DECL_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \ |
| 3472 |
p5) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \ |
| 3473 |
p5##_type p5 |
| 3474 |
#define GMOCK_INTERNAL_DECL_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ |
| 3475 |
p6) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \ |
| 3476 |
p5##_type p5, p6##_type p6 |
| 3477 |
#define GMOCK_INTERNAL_DECL_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ |
| 3478 |
p7) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \ |
| 3479 |
p5##_type p5, p6##_type p6, p7##_type p7 |
| 3480 |
#define GMOCK_INTERNAL_DECL_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ |
| 3481 |
p7, p8) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ |
| 3482 |
p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8 |
| 3483 |
#define GMOCK_INTERNAL_DECL_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ |
| 3484 |
p7, p8, p9) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ |
| 3485 |
p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \ |
| 3486 |
p9##_type p9 |
| 3487 |
|
| 3488 |
|
| 3489 |
#define GMOCK_INTERNAL_COUNT_AND_0_VALUE_PARAMS() |
| 3490 |
#define GMOCK_INTERNAL_COUNT_AND_1_VALUE_PARAMS(p0) P |
| 3491 |
#define GMOCK_INTERNAL_COUNT_AND_2_VALUE_PARAMS(p0, p1) P2 |
| 3492 |
#define GMOCK_INTERNAL_COUNT_AND_3_VALUE_PARAMS(p0, p1, p2) P3 |
| 3493 |
#define GMOCK_INTERNAL_COUNT_AND_4_VALUE_PARAMS(p0, p1, p2, p3) P4 |
| 3494 |
#define GMOCK_INTERNAL_COUNT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) P5 |
| 3495 |
#define GMOCK_INTERNAL_COUNT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) P6 |
| 3496 |
#define GMOCK_INTERNAL_COUNT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6) P7 |
| 3497 |
#define GMOCK_INTERNAL_COUNT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ |
| 3498 |
p7) P8 |
| 3499 |
#define GMOCK_INTERNAL_COUNT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ |
| 3500 |
p7, p8) P9 |
| 3501 |
#define GMOCK_INTERNAL_COUNT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ |
| 3502 |
p7, p8, p9) P10 |
| 3503 |
|
| 3504 |
|
| 3505 |
#define GMOCK_ACTION_CLASS_(name, value_params)\ |
| 3506 |
GTEST_CONCAT_TOKEN_(name##Action, GMOCK_INTERNAL_COUNT_##value_params) |
| 3507 |
|
| 3508 |
#define ACTION_TEMPLATE(name, template_params, value_params)\ |
| 3509 |
template <GMOCK_INTERNAL_DECL_##template_params\ |
| 3510 |
GMOCK_INTERNAL_DECL_TYPE_##value_params>\ |
| 3511 |
class GMOCK_ACTION_CLASS_(name, value_params) {\ |
| 3512 |
public:\ |
| 3513 |
GMOCK_ACTION_CLASS_(name, value_params)\ |
| 3514 |
GMOCK_INTERNAL_INIT_##value_params {}\ |
| 3515 |
template <typename F>\ |
| 3516 |
class gmock_Impl : public ::testing::ActionInterface<F> {\ |
| 3517 |
public:\ |
| 3518 |
typedef F function_type;\ |
| 3519 |
typedef typename ::testing::internal::Function<F>::Result return_type;\ |
| 3520 |
typedef typename ::testing::internal::Function<F>::ArgumentTuple\ |
| 3521 |
args_type;\ |
| 3522 |
explicit gmock_Impl GMOCK_INTERNAL_INIT_##value_params {}\ |
| 3523 |
virtual return_type Perform(const args_type& args) {\ |
| 3524 |
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ |
| 3525 |
Perform(this, args);\ |
| 3526 |
}\ |
| 3527 |
template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
| 3528 |
typename arg3_type, typename arg4_type, typename arg5_type, \ |
| 3529 |
typename arg6_type, typename arg7_type, typename arg8_type, \ |
| 3530 |
typename arg9_type>\ |
| 3531 |
return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ |
| 3532 |
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ |
| 3533 |
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ |
| 3534 |
arg9_type arg9) const;\ |
| 3535 |
GMOCK_INTERNAL_DEFN_##value_params\ |
| 3536 |
private:\ |
| 3537 |
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
| 3538 |
};\ |
| 3539 |
template <typename F> operator ::testing::Action<F>() const {\ |
| 3540 |
return ::testing::Action<F>(\ |
| 3541 |
new gmock_Impl<F>(GMOCK_INTERNAL_LIST_##value_params));\ |
| 3542 |
}\ |
| 3543 |
GMOCK_INTERNAL_DEFN_##value_params\ |
| 3544 |
private:\ |
| 3545 |
GTEST_DISALLOW_ASSIGN_(GMOCK_ACTION_CLASS_(name, value_params));\ |
| 3546 |
};\ |
| 3547 |
template <GMOCK_INTERNAL_DECL_##template_params\ |
| 3548 |
GMOCK_INTERNAL_DECL_TYPE_##value_params>\ |
| 3549 |
inline GMOCK_ACTION_CLASS_(name, value_params)<\ |
| 3550 |
GMOCK_INTERNAL_LIST_##template_params\ |
| 3551 |
GMOCK_INTERNAL_LIST_TYPE_##value_params> name(\ |
| 3552 |
GMOCK_INTERNAL_DECL_##value_params) {\ |
| 3553 |
return GMOCK_ACTION_CLASS_(name, value_params)<\ |
| 3554 |
GMOCK_INTERNAL_LIST_##template_params\ |
| 3555 |
GMOCK_INTERNAL_LIST_TYPE_##value_params>(\ |
| 3556 |
GMOCK_INTERNAL_LIST_##value_params);\ |
| 3557 |
}\ |
| 3558 |
template <GMOCK_INTERNAL_DECL_##template_params\ |
| 3559 |
GMOCK_INTERNAL_DECL_TYPE_##value_params>\ |
| 3560 |
template <typename F>\ |
| 3561 |
template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
| 3562 |
typename arg3_type, typename arg4_type, typename arg5_type, \ |
| 3563 |
typename arg6_type, typename arg7_type, typename arg8_type, \ |
| 3564 |
typename arg9_type>\ |
| 3565 |
typename ::testing::internal::Function<F>::Result\ |
| 3566 |
GMOCK_ACTION_CLASS_(name, value_params)<\ |
| 3567 |
GMOCK_INTERNAL_LIST_##template_params\ |
| 3568 |
GMOCK_INTERNAL_LIST_TYPE_##value_params>::gmock_Impl<F>::\ |
| 3569 |
gmock_PerformImpl(\ |
| 3570 |
GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const |
| 3571 |
|
| 3572 |
#define ACTION(name)\ |
| 3573 |
class name##Action {\ |
| 3574 |
public:\ |
| 3575 |
name##Action() {}\ |
| 3576 |
template <typename F>\ |
| 3577 |
class gmock_Impl : public ::testing::ActionInterface<F> {\ |
| 3578 |
public:\ |
| 3579 |
typedef F function_type;\ |
| 3580 |
typedef typename ::testing::internal::Function<F>::Result return_type;\ |
| 3581 |
typedef typename ::testing::internal::Function<F>::ArgumentTuple\ |
| 3582 |
args_type;\ |
| 3583 |
gmock_Impl() {}\ |
| 3584 |
virtual return_type Perform(const args_type& args) {\ |
| 3585 |
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ |
| 3586 |
Perform(this, args);\ |
| 3587 |
}\ |
| 3588 |
template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
| 3589 |
typename arg3_type, typename arg4_type, typename arg5_type, \ |
| 3590 |
typename arg6_type, typename arg7_type, typename arg8_type, \ |
| 3591 |
typename arg9_type>\ |
| 3592 |
return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ |
| 3593 |
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ |
| 3594 |
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ |
| 3595 |
arg9_type arg9) const;\ |
| 3596 |
private:\ |
| 3597 |
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
| 3598 |
};\ |
| 3599 |
template <typename F> operator ::testing::Action<F>() const {\ |
| 3600 |
return ::testing::Action<F>(new gmock_Impl<F>());\ |
| 3601 |
}\ |
| 3602 |
private:\ |
| 3603 |
GTEST_DISALLOW_ASSIGN_(name##Action);\ |
| 3604 |
};\ |
| 3605 |
inline name##Action name() {\ |
| 3606 |
return name##Action();\ |
| 3607 |
}\ |
| 3608 |
template <typename F>\ |
| 3609 |
template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
| 3610 |
typename arg3_type, typename arg4_type, typename arg5_type, \ |
| 3611 |
typename arg6_type, typename arg7_type, typename arg8_type, \ |
| 3612 |
typename arg9_type>\ |
| 3613 |
typename ::testing::internal::Function<F>::Result\ |
| 3614 |
name##Action::gmock_Impl<F>::gmock_PerformImpl(\ |
| 3615 |
GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const |
| 3616 |
|
| 3617 |
#define ACTION_P(name, p0)\ |
| 3618 |
template <typename p0##_type>\ |
| 3619 |
class name##ActionP {\ |
| 3620 |
public:\ |
| 3621 |
name##ActionP(p0##_type gmock_p0) : p0(gmock_p0) {}\ |
| 3622 |
template <typename F>\ |
| 3623 |
class gmock_Impl : public ::testing::ActionInterface<F> {\ |
| 3624 |
public:\ |
| 3625 |
typedef F function_type;\ |
| 3626 |
typedef typename ::testing::internal::Function<F>::Result return_type;\ |
| 3627 |
typedef typename ::testing::internal::Function<F>::ArgumentTuple\ |
| 3628 |
args_type;\ |
| 3629 |
explicit gmock_Impl(p0##_type gmock_p0) : p0(gmock_p0) {}\ |
| 3630 |
virtual return_type Perform(const args_type& args) {\ |
| 3631 |
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ |
| 3632 |
Perform(this, args);\ |
| 3633 |
}\ |
| 3634 |
template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
| 3635 |
typename arg3_type, typename arg4_type, typename arg5_type, \ |
| 3636 |
typename arg6_type, typename arg7_type, typename arg8_type, \ |
| 3637 |
typename arg9_type>\ |
| 3638 |
return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ |
| 3639 |
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ |
| 3640 |
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ |
| 3641 |
arg9_type arg9) const;\ |
| 3642 |
p0##_type p0;\ |
| 3643 |
private:\ |
| 3644 |
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
| 3645 |
};\ |
| 3646 |
template <typename F> operator ::testing::Action<F>() const {\ |
| 3647 |
return ::testing::Action<F>(new gmock_Impl<F>(p0));\ |
| 3648 |
}\ |
| 3649 |
p0##_type p0;\ |
| 3650 |
private:\ |
| 3651 |
GTEST_DISALLOW_ASSIGN_(name##ActionP);\ |
| 3652 |
};\ |
| 3653 |
template <typename p0##_type>\ |
| 3654 |
inline name##ActionP<p0##_type> name(p0##_type p0) {\ |
| 3655 |
return name##ActionP<p0##_type>(p0);\ |
| 3656 |
}\ |
| 3657 |
template <typename p0##_type>\ |
| 3658 |
template <typename F>\ |
| 3659 |
template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
| 3660 |
typename arg3_type, typename arg4_type, typename arg5_type, \ |
| 3661 |
typename arg6_type, typename arg7_type, typename arg8_type, \ |
| 3662 |
typename arg9_type>\ |
| 3663 |
typename ::testing::internal::Function<F>::Result\ |
| 3664 |
name##ActionP<p0##_type>::gmock_Impl<F>::gmock_PerformImpl(\ |
| 3665 |
GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const |
| 3666 |
|
| 3667 |
#define ACTION_P2(name, p0, p1)\ |
| 3668 |
template <typename p0##_type, typename p1##_type>\ |
| 3669 |
class name##ActionP2 {\ |
| 3670 |
public:\ |
| 3671 |
name##ActionP2(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \ |
| 3672 |
p1(gmock_p1) {}\ |
| 3673 |
template <typename F>\ |
| 3674 |
class gmock_Impl : public ::testing::ActionInterface<F> {\ |
| 3675 |
public:\ |
| 3676 |
typedef F function_type;\ |
| 3677 |
typedef typename ::testing::internal::Function<F>::Result return_type;\ |
| 3678 |
typedef typename ::testing::internal::Function<F>::ArgumentTuple\ |
| 3679 |
args_type;\ |
| 3680 |
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \ |
| 3681 |
p1(gmock_p1) {}\ |
| 3682 |
virtual return_type Perform(const args_type& args) {\ |
| 3683 |
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ |
| 3684 |
Perform(this, args);\ |
| 3685 |
}\ |
| 3686 |
template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
| 3687 |
typename arg3_type, typename arg4_type, typename arg5_type, \ |
| 3688 |
typename arg6_type, typename arg7_type, typename arg8_type, \ |
| 3689 |
typename arg9_type>\ |
| 3690 |
return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ |
| 3691 |
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ |
| 3692 |
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ |
| 3693 |
arg9_type arg9) const;\ |
| 3694 |
p0##_type p0;\ |
| 3695 |
p1##_type p1;\ |
| 3696 |
private:\ |
| 3697 |
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
| 3698 |
};\ |
| 3699 |
template <typename F> operator ::testing::Action<F>() const {\ |
| 3700 |
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1));\ |
| 3701 |
}\ |
| 3702 |
p0##_type p0;\ |
| 3703 |
p1##_type p1;\ |
| 3704 |
private:\ |
| 3705 |
GTEST_DISALLOW_ASSIGN_(name##ActionP2);\ |
| 3706 |
};\ |
| 3707 |
template <typename p0##_type, typename p1##_type>\ |
| 3708 |
inline name##ActionP2<p0##_type, p1##_type> name(p0##_type p0, \ |
| 3709 |
p1##_type p1) {\ |
| 3710 |
return name##ActionP2<p0##_type, p1##_type>(p0, p1);\ |
| 3711 |
}\ |
| 3712 |
template <typename p0##_type, typename p1##_type>\ |
| 3713 |
template <typename F>\ |
| 3714 |
template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
| 3715 |
typename arg3_type, typename arg4_type, typename arg5_type, \ |
| 3716 |
typename arg6_type, typename arg7_type, typename arg8_type, \ |
| 3717 |
typename arg9_type>\ |
| 3718 |
typename ::testing::internal::Function<F>::Result\ |
| 3719 |
name##ActionP2<p0##_type, p1##_type>::gmock_Impl<F>::gmock_PerformImpl(\ |
| 3720 |
GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const |
| 3721 |
|
| 3722 |
#define ACTION_P3(name, p0, p1, p2)\ |
| 3723 |
template <typename p0##_type, typename p1##_type, typename p2##_type>\ |
| 3724 |
class name##ActionP3 {\ |
| 3725 |
public:\ |
| 3726 |
name##ActionP3(p0##_type gmock_p0, p1##_type gmock_p1, \ |
| 3727 |
p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\ |
| 3728 |
template <typename F>\ |
| 3729 |
class gmock_Impl : public ::testing::ActionInterface<F> {\ |
| 3730 |
public:\ |
| 3731 |
typedef F function_type;\ |
| 3732 |
typedef typename ::testing::internal::Function<F>::Result return_type;\ |
| 3733 |
typedef typename ::testing::internal::Function<F>::ArgumentTuple\ |
| 3734 |
args_type;\ |
| 3735 |
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, \ |
| 3736 |
p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\ |
| 3737 |
virtual return_type Perform(const args_type& args) {\ |
| 3738 |
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ |
| 3739 |
Perform(this, args);\ |
| 3740 |
}\ |
| 3741 |
template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
| 3742 |
typename arg3_type, typename arg4_type, typename arg5_type, \ |
| 3743 |
typename arg6_type, typename arg7_type, typename arg8_type, \ |
| 3744 |
typename arg9_type>\ |
| 3745 |
return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ |
| 3746 |
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ |
| 3747 |
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ |
| 3748 |
arg9_type arg9) const;\ |
| 3749 |
p0##_type p0;\ |
| 3750 |
p1##_type p1;\ |
| 3751 |
p2##_type p2;\ |
| 3752 |
private:\ |
| 3753 |
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
| 3754 |
};\ |
| 3755 |
template <typename F> operator ::testing::Action<F>() const {\ |
| 3756 |
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2));\ |
| 3757 |
}\ |
| 3758 |
p0##_type p0;\ |
| 3759 |
p1##_type p1;\ |
| 3760 |
p2##_type p2;\ |
| 3761 |
private:\ |
| 3762 |
GTEST_DISALLOW_ASSIGN_(name##ActionP3);\ |
| 3763 |
};\ |
| 3764 |
template <typename p0##_type, typename p1##_type, typename p2##_type>\ |
| 3765 |
inline name##ActionP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \ |
| 3766 |
p1##_type p1, p2##_type p2) {\ |
| 3767 |
return name##ActionP3<p0##_type, p1##_type, p2##_type>(p0, p1, p2);\ |
| 3768 |
}\ |
| 3769 |
template <typename p0##_type, typename p1##_type, typename p2##_type>\ |
| 3770 |
template <typename F>\ |
| 3771 |
template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
| 3772 |
typename arg3_type, typename arg4_type, typename arg5_type, \ |
| 3773 |
typename arg6_type, typename arg7_type, typename arg8_type, \ |
| 3774 |
typename arg9_type>\ |
| 3775 |
typename ::testing::internal::Function<F>::Result\ |
| 3776 |
name##ActionP3<p0##_type, p1##_type, \ |
| 3777 |
p2##_type>::gmock_Impl<F>::gmock_PerformImpl(\ |
| 3778 |
GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const |
| 3779 |
|
| 3780 |
#define ACTION_P4(name, p0, p1, p2, p3)\ |
| 3781 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 3782 |
typename p3##_type>\ |
| 3783 |
class name##ActionP4 {\ |
| 3784 |
public:\ |
| 3785 |
name##ActionP4(p0##_type gmock_p0, p1##_type gmock_p1, \ |
| 3786 |
p2##_type gmock_p2, p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), \ |
| 3787 |
p2(gmock_p2), p3(gmock_p3) {}\ |
| 3788 |
template <typename F>\ |
| 3789 |
class gmock_Impl : public ::testing::ActionInterface<F> {\ |
| 3790 |
public:\ |
| 3791 |
typedef F function_type;\ |
| 3792 |
typedef typename ::testing::internal::Function<F>::Result return_type;\ |
| 3793 |
typedef typename ::testing::internal::Function<F>::ArgumentTuple\ |
| 3794 |
args_type;\ |
| 3795 |
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
| 3796 |
p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
| 3797 |
p3(gmock_p3) {}\ |
| 3798 |
virtual return_type Perform(const args_type& args) {\ |
| 3799 |
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ |
| 3800 |
Perform(this, args);\ |
| 3801 |
}\ |
| 3802 |
template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
| 3803 |
typename arg3_type, typename arg4_type, typename arg5_type, \ |
| 3804 |
typename arg6_type, typename arg7_type, typename arg8_type, \ |
| 3805 |
typename arg9_type>\ |
| 3806 |
return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ |
| 3807 |
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ |
| 3808 |
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ |
| 3809 |
arg9_type arg9) const;\ |
| 3810 |
p0##_type p0;\ |
| 3811 |
p1##_type p1;\ |
| 3812 |
p2##_type p2;\ |
| 3813 |
p3##_type p3;\ |
| 3814 |
private:\ |
| 3815 |
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
| 3816 |
};\ |
| 3817 |
template <typename F> operator ::testing::Action<F>() const {\ |
| 3818 |
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3));\ |
| 3819 |
}\ |
| 3820 |
p0##_type p0;\ |
| 3821 |
p1##_type p1;\ |
| 3822 |
p2##_type p2;\ |
| 3823 |
p3##_type p3;\ |
| 3824 |
private:\ |
| 3825 |
GTEST_DISALLOW_ASSIGN_(name##ActionP4);\ |
| 3826 |
};\ |
| 3827 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 3828 |
typename p3##_type>\ |
| 3829 |
inline name##ActionP4<p0##_type, p1##_type, p2##_type, \ |
| 3830 |
p3##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \ |
| 3831 |
p3##_type p3) {\ |
| 3832 |
return name##ActionP4<p0##_type, p1##_type, p2##_type, p3##_type>(p0, p1, \ |
| 3833 |
p2, p3);\ |
| 3834 |
}\ |
| 3835 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 3836 |
typename p3##_type>\ |
| 3837 |
template <typename F>\ |
| 3838 |
template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
| 3839 |
typename arg3_type, typename arg4_type, typename arg5_type, \ |
| 3840 |
typename arg6_type, typename arg7_type, typename arg8_type, \ |
| 3841 |
typename arg9_type>\ |
| 3842 |
typename ::testing::internal::Function<F>::Result\ |
| 3843 |
name##ActionP4<p0##_type, p1##_type, p2##_type, \ |
| 3844 |
p3##_type>::gmock_Impl<F>::gmock_PerformImpl(\ |
| 3845 |
GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const |
| 3846 |
|
| 3847 |
#define ACTION_P5(name, p0, p1, p2, p3, p4)\ |
| 3848 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 3849 |
typename p3##_type, typename p4##_type>\ |
| 3850 |
class name##ActionP5 {\ |
| 3851 |
public:\ |
| 3852 |
name##ActionP5(p0##_type gmock_p0, p1##_type gmock_p1, \ |
| 3853 |
p2##_type gmock_p2, p3##_type gmock_p3, \ |
| 3854 |
p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
| 3855 |
p3(gmock_p3), p4(gmock_p4) {}\ |
| 3856 |
template <typename F>\ |
| 3857 |
class gmock_Impl : public ::testing::ActionInterface<F> {\ |
| 3858 |
public:\ |
| 3859 |
typedef F function_type;\ |
| 3860 |
typedef typename ::testing::internal::Function<F>::Result return_type;\ |
| 3861 |
typedef typename ::testing::internal::Function<F>::ArgumentTuple\ |
| 3862 |
args_type;\ |
| 3863 |
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
| 3864 |
p3##_type gmock_p3, p4##_type gmock_p4) : p0(gmock_p0), \ |
| 3865 |
p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), p4(gmock_p4) {}\ |
| 3866 |
virtual return_type Perform(const args_type& args) {\ |
| 3867 |
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ |
| 3868 |
Perform(this, args);\ |
| 3869 |
}\ |
| 3870 |
template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
| 3871 |
typename arg3_type, typename arg4_type, typename arg5_type, \ |
| 3872 |
typename arg6_type, typename arg7_type, typename arg8_type, \ |
| 3873 |
typename arg9_type>\ |
| 3874 |
return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ |
| 3875 |
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ |
| 3876 |
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ |
| 3877 |
arg9_type arg9) const;\ |
| 3878 |
p0##_type p0;\ |
| 3879 |
p1##_type p1;\ |
| 3880 |
p2##_type p2;\ |
| 3881 |
p3##_type p3;\ |
| 3882 |
p4##_type p4;\ |
| 3883 |
private:\ |
| 3884 |
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
| 3885 |
};\ |
| 3886 |
template <typename F> operator ::testing::Action<F>() const {\ |
| 3887 |
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4));\ |
| 3888 |
}\ |
| 3889 |
p0##_type p0;\ |
| 3890 |
p1##_type p1;\ |
| 3891 |
p2##_type p2;\ |
| 3892 |
p3##_type p3;\ |
| 3893 |
p4##_type p4;\ |
| 3894 |
private:\ |
| 3895 |
GTEST_DISALLOW_ASSIGN_(name##ActionP5);\ |
| 3896 |
};\ |
| 3897 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 3898 |
typename p3##_type, typename p4##_type>\ |
| 3899 |
inline name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 3900 |
p4##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ |
| 3901 |
p4##_type p4) {\ |
| 3902 |
return name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 3903 |
p4##_type>(p0, p1, p2, p3, p4);\ |
| 3904 |
}\ |
| 3905 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 3906 |
typename p3##_type, typename p4##_type>\ |
| 3907 |
template <typename F>\ |
| 3908 |
template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
| 3909 |
typename arg3_type, typename arg4_type, typename arg5_type, \ |
| 3910 |
typename arg6_type, typename arg7_type, typename arg8_type, \ |
| 3911 |
typename arg9_type>\ |
| 3912 |
typename ::testing::internal::Function<F>::Result\ |
| 3913 |
name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 3914 |
p4##_type>::gmock_Impl<F>::gmock_PerformImpl(\ |
| 3915 |
GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const |
| 3916 |
|
| 3917 |
#define ACTION_P6(name, p0, p1, p2, p3, p4, p5)\ |
| 3918 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 3919 |
typename p3##_type, typename p4##_type, typename p5##_type>\ |
| 3920 |
class name##ActionP6 {\ |
| 3921 |
public:\ |
| 3922 |
name##ActionP6(p0##_type gmock_p0, p1##_type gmock_p1, \ |
| 3923 |
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ |
| 3924 |
p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
| 3925 |
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {}\ |
| 3926 |
template <typename F>\ |
| 3927 |
class gmock_Impl : public ::testing::ActionInterface<F> {\ |
| 3928 |
public:\ |
| 3929 |
typedef F function_type;\ |
| 3930 |
typedef typename ::testing::internal::Function<F>::Result return_type;\ |
| 3931 |
typedef typename ::testing::internal::Function<F>::ArgumentTuple\ |
| 3932 |
args_type;\ |
| 3933 |
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
| 3934 |
p3##_type gmock_p3, p4##_type gmock_p4, \ |
| 3935 |
p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
| 3936 |
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {}\ |
| 3937 |
virtual return_type Perform(const args_type& args) {\ |
| 3938 |
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ |
| 3939 |
Perform(this, args);\ |
| 3940 |
}\ |
| 3941 |
template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
| 3942 |
typename arg3_type, typename arg4_type, typename arg5_type, \ |
| 3943 |
typename arg6_type, typename arg7_type, typename arg8_type, \ |
| 3944 |
typename arg9_type>\ |
| 3945 |
return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ |
| 3946 |
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ |
| 3947 |
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ |
| 3948 |
arg9_type arg9) const;\ |
| 3949 |
p0##_type p0;\ |
| 3950 |
p1##_type p1;\ |
| 3951 |
p2##_type p2;\ |
| 3952 |
p3##_type p3;\ |
| 3953 |
p4##_type p4;\ |
| 3954 |
p5##_type p5;\ |
| 3955 |
private:\ |
| 3956 |
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
| 3957 |
};\ |
| 3958 |
template <typename F> operator ::testing::Action<F>() const {\ |
| 3959 |
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5));\ |
| 3960 |
}\ |
| 3961 |
p0##_type p0;\ |
| 3962 |
p1##_type p1;\ |
| 3963 |
p2##_type p2;\ |
| 3964 |
p3##_type p3;\ |
| 3965 |
p4##_type p4;\ |
| 3966 |
p5##_type p5;\ |
| 3967 |
private:\ |
| 3968 |
GTEST_DISALLOW_ASSIGN_(name##ActionP6);\ |
| 3969 |
};\ |
| 3970 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 3971 |
typename p3##_type, typename p4##_type, typename p5##_type>\ |
| 3972 |
inline name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 3973 |
p4##_type, p5##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \ |
| 3974 |
p3##_type p3, p4##_type p4, p5##_type p5) {\ |
| 3975 |
return name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 3976 |
p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5);\ |
| 3977 |
}\ |
| 3978 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 3979 |
typename p3##_type, typename p4##_type, typename p5##_type>\ |
| 3980 |
template <typename F>\ |
| 3981 |
template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
| 3982 |
typename arg3_type, typename arg4_type, typename arg5_type, \ |
| 3983 |
typename arg6_type, typename arg7_type, typename arg8_type, \ |
| 3984 |
typename arg9_type>\ |
| 3985 |
typename ::testing::internal::Function<F>::Result\ |
| 3986 |
name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ |
| 3987 |
p5##_type>::gmock_Impl<F>::gmock_PerformImpl(\ |
| 3988 |
GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const |
| 3989 |
|
| 3990 |
#define ACTION_P7(name, p0, p1, p2, p3, p4, p5, p6)\ |
| 3991 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 3992 |
typename p3##_type, typename p4##_type, typename p5##_type, \ |
| 3993 |
typename p6##_type>\ |
| 3994 |
class name##ActionP7 {\ |
| 3995 |
public:\ |
| 3996 |
name##ActionP7(p0##_type gmock_p0, p1##_type gmock_p1, \ |
| 3997 |
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ |
| 3998 |
p5##_type gmock_p5, p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), \ |
| 3999 |
p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), \ |
| 4000 |
p6(gmock_p6) {}\ |
| 4001 |
template <typename F>\ |
| 4002 |
class gmock_Impl : public ::testing::ActionInterface<F> {\ |
| 4003 |
public:\ |
| 4004 |
typedef F function_type;\ |
| 4005 |
typedef typename ::testing::internal::Function<F>::Result return_type;\ |
| 4006 |
typedef typename ::testing::internal::Function<F>::ArgumentTuple\ |
| 4007 |
args_type;\ |
| 4008 |
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
| 4009 |
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ |
| 4010 |
p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
| 4011 |
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6) {}\ |
| 4012 |
virtual return_type Perform(const args_type& args) {\ |
| 4013 |
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ |
| 4014 |
Perform(this, args);\ |
| 4015 |
}\ |
| 4016 |
template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
| 4017 |
typename arg3_type, typename arg4_type, typename arg5_type, \ |
| 4018 |
typename arg6_type, typename arg7_type, typename arg8_type, \ |
| 4019 |
typename arg9_type>\ |
| 4020 |
return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ |
| 4021 |
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ |
| 4022 |
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ |
| 4023 |
arg9_type arg9) const;\ |
| 4024 |
p0##_type p0;\ |
| 4025 |
p1##_type p1;\ |
| 4026 |
p2##_type p2;\ |
| 4027 |
p3##_type p3;\ |
| 4028 |
p4##_type p4;\ |
| 4029 |
p5##_type p5;\ |
| 4030 |
p6##_type p6;\ |
| 4031 |
private:\ |
| 4032 |
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
| 4033 |
};\ |
| 4034 |
template <typename F> operator ::testing::Action<F>() const {\ |
| 4035 |
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \ |
| 4036 |
p6));\ |
| 4037 |
}\ |
| 4038 |
p0##_type p0;\ |
| 4039 |
p1##_type p1;\ |
| 4040 |
p2##_type p2;\ |
| 4041 |
p3##_type p3;\ |
| 4042 |
p4##_type p4;\ |
| 4043 |
p5##_type p5;\ |
| 4044 |
p6##_type p6;\ |
| 4045 |
private:\ |
| 4046 |
GTEST_DISALLOW_ASSIGN_(name##ActionP7);\ |
| 4047 |
};\ |
| 4048 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 4049 |
typename p3##_type, typename p4##_type, typename p5##_type, \ |
| 4050 |
typename p6##_type>\ |
| 4051 |
inline name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 4052 |
p4##_type, p5##_type, p6##_type> name(p0##_type p0, p1##_type p1, \ |
| 4053 |
p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \ |
| 4054 |
p6##_type p6) {\ |
| 4055 |
return name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 4056 |
p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, p6);\ |
| 4057 |
}\ |
| 4058 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 4059 |
typename p3##_type, typename p4##_type, typename p5##_type, \ |
| 4060 |
typename p6##_type>\ |
| 4061 |
template <typename F>\ |
| 4062 |
template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
| 4063 |
typename arg3_type, typename arg4_type, typename arg5_type, \ |
| 4064 |
typename arg6_type, typename arg7_type, typename arg8_type, \ |
| 4065 |
typename arg9_type>\ |
| 4066 |
typename ::testing::internal::Function<F>::Result\ |
| 4067 |
name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ |
| 4068 |
p5##_type, p6##_type>::gmock_Impl<F>::gmock_PerformImpl(\ |
| 4069 |
GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const |
| 4070 |
|
| 4071 |
#define ACTION_P8(name, p0, p1, p2, p3, p4, p5, p6, p7)\ |
| 4072 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 4073 |
typename p3##_type, typename p4##_type, typename p5##_type, \ |
| 4074 |
typename p6##_type, typename p7##_type>\ |
| 4075 |
class name##ActionP8 {\ |
| 4076 |
public:\ |
| 4077 |
name##ActionP8(p0##_type gmock_p0, p1##_type gmock_p1, \ |
| 4078 |
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ |
| 4079 |
p5##_type gmock_p5, p6##_type gmock_p6, \ |
| 4080 |
p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
| 4081 |
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ |
| 4082 |
p7(gmock_p7) {}\ |
| 4083 |
template <typename F>\ |
| 4084 |
class gmock_Impl : public ::testing::ActionInterface<F> {\ |
| 4085 |
public:\ |
| 4086 |
typedef F function_type;\ |
| 4087 |
typedef typename ::testing::internal::Function<F>::Result return_type;\ |
| 4088 |
typedef typename ::testing::internal::Function<F>::ArgumentTuple\ |
| 4089 |
args_type;\ |
| 4090 |
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
| 4091 |
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ |
| 4092 |
p6##_type gmock_p6, p7##_type gmock_p7) : p0(gmock_p0), \ |
| 4093 |
p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), \ |
| 4094 |
p5(gmock_p5), p6(gmock_p6), p7(gmock_p7) {}\ |
| 4095 |
virtual return_type Perform(const args_type& args) {\ |
| 4096 |
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ |
| 4097 |
Perform(this, args);\ |
| 4098 |
}\ |
| 4099 |
template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
| 4100 |
typename arg3_type, typename arg4_type, typename arg5_type, \ |
| 4101 |
typename arg6_type, typename arg7_type, typename arg8_type, \ |
| 4102 |
typename arg9_type>\ |
| 4103 |
return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ |
| 4104 |
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ |
| 4105 |
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ |
| 4106 |
arg9_type arg9) const;\ |
| 4107 |
p0##_type p0;\ |
| 4108 |
p1##_type p1;\ |
| 4109 |
p2##_type p2;\ |
| 4110 |
p3##_type p3;\ |
| 4111 |
p4##_type p4;\ |
| 4112 |
p5##_type p5;\ |
| 4113 |
p6##_type p6;\ |
| 4114 |
p7##_type p7;\ |
| 4115 |
private:\ |
| 4116 |
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
| 4117 |
};\ |
| 4118 |
template <typename F> operator ::testing::Action<F>() const {\ |
| 4119 |
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \ |
| 4120 |
p6, p7));\ |
| 4121 |
}\ |
| 4122 |
p0##_type p0;\ |
| 4123 |
p1##_type p1;\ |
| 4124 |
p2##_type p2;\ |
| 4125 |
p3##_type p3;\ |
| 4126 |
p4##_type p4;\ |
| 4127 |
p5##_type p5;\ |
| 4128 |
p6##_type p6;\ |
| 4129 |
p7##_type p7;\ |
| 4130 |
private:\ |
| 4131 |
GTEST_DISALLOW_ASSIGN_(name##ActionP8);\ |
| 4132 |
};\ |
| 4133 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 4134 |
typename p3##_type, typename p4##_type, typename p5##_type, \ |
| 4135 |
typename p6##_type, typename p7##_type>\ |
| 4136 |
inline name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 4137 |
p4##_type, p5##_type, p6##_type, p7##_type> name(p0##_type p0, \ |
| 4138 |
p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \ |
| 4139 |
p6##_type p6, p7##_type p7) {\ |
| 4140 |
return name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 4141 |
p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, p3, p4, p5, \ |
| 4142 |
p6, p7);\ |
| 4143 |
}\ |
| 4144 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 4145 |
typename p3##_type, typename p4##_type, typename p5##_type, \ |
| 4146 |
typename p6##_type, typename p7##_type>\ |
| 4147 |
template <typename F>\ |
| 4148 |
template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
| 4149 |
typename arg3_type, typename arg4_type, typename arg5_type, \ |
| 4150 |
typename arg6_type, typename arg7_type, typename arg8_type, \ |
| 4151 |
typename arg9_type>\ |
| 4152 |
typename ::testing::internal::Function<F>::Result\ |
| 4153 |
name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ |
| 4154 |
p5##_type, p6##_type, \ |
| 4155 |
p7##_type>::gmock_Impl<F>::gmock_PerformImpl(\ |
| 4156 |
GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const |
| 4157 |
|
| 4158 |
#define ACTION_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8)\ |
| 4159 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 4160 |
typename p3##_type, typename p4##_type, typename p5##_type, \ |
| 4161 |
typename p6##_type, typename p7##_type, typename p8##_type>\ |
| 4162 |
class name##ActionP9 {\ |
| 4163 |
public:\ |
| 4164 |
name##ActionP9(p0##_type gmock_p0, p1##_type gmock_p1, \ |
| 4165 |
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ |
| 4166 |
p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \ |
| 4167 |
p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
| 4168 |
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ |
| 4169 |
p8(gmock_p8) {}\ |
| 4170 |
template <typename F>\ |
| 4171 |
class gmock_Impl : public ::testing::ActionInterface<F> {\ |
| 4172 |
public:\ |
| 4173 |
typedef F function_type;\ |
| 4174 |
typedef typename ::testing::internal::Function<F>::Result return_type;\ |
| 4175 |
typedef typename ::testing::internal::Function<F>::ArgumentTuple\ |
| 4176 |
args_type;\ |
| 4177 |
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
| 4178 |
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ |
| 4179 |
p6##_type gmock_p6, p7##_type gmock_p7, \ |
| 4180 |
p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
| 4181 |
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ |
| 4182 |
p7(gmock_p7), p8(gmock_p8) {}\ |
| 4183 |
virtual return_type Perform(const args_type& args) {\ |
| 4184 |
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ |
| 4185 |
Perform(this, args);\ |
| 4186 |
}\ |
| 4187 |
template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
| 4188 |
typename arg3_type, typename arg4_type, typename arg5_type, \ |
| 4189 |
typename arg6_type, typename arg7_type, typename arg8_type, \ |
| 4190 |
typename arg9_type>\ |
| 4191 |
return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ |
| 4192 |
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ |
| 4193 |
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ |
| 4194 |
arg9_type arg9) const;\ |
| 4195 |
p0##_type p0;\ |
| 4196 |
p1##_type p1;\ |
| 4197 |
p2##_type p2;\ |
| 4198 |
p3##_type p3;\ |
| 4199 |
p4##_type p4;\ |
| 4200 |
p5##_type p5;\ |
| 4201 |
p6##_type p6;\ |
| 4202 |
p7##_type p7;\ |
| 4203 |
p8##_type p8;\ |
| 4204 |
private:\ |
| 4205 |
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
| 4206 |
};\ |
| 4207 |
template <typename F> operator ::testing::Action<F>() const {\ |
| 4208 |
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \ |
| 4209 |
p6, p7, p8));\ |
| 4210 |
}\ |
| 4211 |
p0##_type p0;\ |
| 4212 |
p1##_type p1;\ |
| 4213 |
p2##_type p2;\ |
| 4214 |
p3##_type p3;\ |
| 4215 |
p4##_type p4;\ |
| 4216 |
p5##_type p5;\ |
| 4217 |
p6##_type p6;\ |
| 4218 |
p7##_type p7;\ |
| 4219 |
p8##_type p8;\ |
| 4220 |
private:\ |
| 4221 |
GTEST_DISALLOW_ASSIGN_(name##ActionP9);\ |
| 4222 |
};\ |
| 4223 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 4224 |
typename p3##_type, typename p4##_type, typename p5##_type, \ |
| 4225 |
typename p6##_type, typename p7##_type, typename p8##_type>\ |
| 4226 |
inline name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 4227 |
p4##_type, p5##_type, p6##_type, p7##_type, \ |
| 4228 |
p8##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ |
| 4229 |
p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, \ |
| 4230 |
p8##_type p8) {\ |
| 4231 |
return name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 4232 |
p4##_type, p5##_type, p6##_type, p7##_type, p8##_type>(p0, p1, p2, \ |
| 4233 |
p3, p4, p5, p6, p7, p8);\ |
| 4234 |
}\ |
| 4235 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 4236 |
typename p3##_type, typename p4##_type, typename p5##_type, \ |
| 4237 |
typename p6##_type, typename p7##_type, typename p8##_type>\ |
| 4238 |
template <typename F>\ |
| 4239 |
template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
| 4240 |
typename arg3_type, typename arg4_type, typename arg5_type, \ |
| 4241 |
typename arg6_type, typename arg7_type, typename arg8_type, \ |
| 4242 |
typename arg9_type>\ |
| 4243 |
typename ::testing::internal::Function<F>::Result\ |
| 4244 |
name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ |
| 4245 |
p5##_type, p6##_type, p7##_type, \ |
| 4246 |
p8##_type>::gmock_Impl<F>::gmock_PerformImpl(\ |
| 4247 |
GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const |
| 4248 |
|
| 4249 |
#define ACTION_P10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)\ |
| 4250 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 4251 |
typename p3##_type, typename p4##_type, typename p5##_type, \ |
| 4252 |
typename p6##_type, typename p7##_type, typename p8##_type, \ |
| 4253 |
typename p9##_type>\ |
| 4254 |
class name##ActionP10 {\ |
| 4255 |
public:\ |
| 4256 |
name##ActionP10(p0##_type gmock_p0, p1##_type gmock_p1, \ |
| 4257 |
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ |
| 4258 |
p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \ |
| 4259 |
p8##_type gmock_p8, p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), \ |
| 4260 |
p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ |
| 4261 |
p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {}\ |
| 4262 |
template <typename F>\ |
| 4263 |
class gmock_Impl : public ::testing::ActionInterface<F> {\ |
| 4264 |
public:\ |
| 4265 |
typedef F function_type;\ |
| 4266 |
typedef typename ::testing::internal::Function<F>::Result return_type;\ |
| 4267 |
typedef typename ::testing::internal::Function<F>::ArgumentTuple\ |
| 4268 |
args_type;\ |
| 4269 |
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
| 4270 |
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ |
| 4271 |
p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \ |
| 4272 |
p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
| 4273 |
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ |
| 4274 |
p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {}\ |
| 4275 |
virtual return_type Perform(const args_type& args) {\ |
| 4276 |
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ |
| 4277 |
Perform(this, args);\ |
| 4278 |
}\ |
| 4279 |
template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
| 4280 |
typename arg3_type, typename arg4_type, typename arg5_type, \ |
| 4281 |
typename arg6_type, typename arg7_type, typename arg8_type, \ |
| 4282 |
typename arg9_type>\ |
| 4283 |
return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, \ |
| 4284 |
arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ |
| 4285 |
arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ |
| 4286 |
arg9_type arg9) const;\ |
| 4287 |
p0##_type p0;\ |
| 4288 |
p1##_type p1;\ |
| 4289 |
p2##_type p2;\ |
| 4290 |
p3##_type p3;\ |
| 4291 |
p4##_type p4;\ |
| 4292 |
p5##_type p5;\ |
| 4293 |
p6##_type p6;\ |
| 4294 |
p7##_type p7;\ |
| 4295 |
p8##_type p8;\ |
| 4296 |
p9##_type p9;\ |
| 4297 |
private:\ |
| 4298 |
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
| 4299 |
};\ |
| 4300 |
template <typename F> operator ::testing::Action<F>() const {\ |
| 4301 |
return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \ |
| 4302 |
p6, p7, p8, p9));\ |
| 4303 |
}\ |
| 4304 |
p0##_type p0;\ |
| 4305 |
p1##_type p1;\ |
| 4306 |
p2##_type p2;\ |
| 4307 |
p3##_type p3;\ |
| 4308 |
p4##_type p4;\ |
| 4309 |
p5##_type p5;\ |
| 4310 |
p6##_type p6;\ |
| 4311 |
p7##_type p7;\ |
| 4312 |
p8##_type p8;\ |
| 4313 |
p9##_type p9;\ |
| 4314 |
private:\ |
| 4315 |
GTEST_DISALLOW_ASSIGN_(name##ActionP10);\ |
| 4316 |
};\ |
| 4317 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 4318 |
typename p3##_type, typename p4##_type, typename p5##_type, \ |
| 4319 |
typename p6##_type, typename p7##_type, typename p8##_type, \ |
| 4320 |
typename p9##_type>\ |
| 4321 |
inline name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 4322 |
p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \ |
| 4323 |
p9##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ |
| 4324 |
p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \ |
| 4325 |
p9##_type p9) {\ |
| 4326 |
return name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 4327 |
p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, p9##_type>(p0, \ |
| 4328 |
p1, p2, p3, p4, p5, p6, p7, p8, p9);\ |
| 4329 |
}\ |
| 4330 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 4331 |
typename p3##_type, typename p4##_type, typename p5##_type, \ |
| 4332 |
typename p6##_type, typename p7##_type, typename p8##_type, \ |
| 4333 |
typename p9##_type>\ |
| 4334 |
template <typename F>\ |
| 4335 |
template <typename arg0_type, typename arg1_type, typename arg2_type, \ |
| 4336 |
typename arg3_type, typename arg4_type, typename arg5_type, \ |
| 4337 |
typename arg6_type, typename arg7_type, typename arg8_type, \ |
| 4338 |
typename arg9_type>\ |
| 4339 |
typename ::testing::internal::Function<F>::Result\ |
| 4340 |
name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ |
| 4341 |
p5##_type, p6##_type, p7##_type, p8##_type, \ |
| 4342 |
p9##_type>::gmock_Impl<F>::gmock_PerformImpl(\ |
| 4343 |
GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const |
| 4344 |
|
| 4345 |
namespace testing { |
| 4346 |
|
| 4347 |
|
| 4348 |
|
| 4349 |
|
| 4350 |
|
| 4351 |
|
| 4352 |
#ifdef _MSC_VER |
| 4353 |
# pragma warning(push) |
| 4354 |
# pragma warning(disable:4100) |
| 4355 |
#endif |
| 4356 |
|
| 4357 |
|
| 4358 |
|
| 4359 |
|
| 4360 |
|
| 4361 |
|
| 4362 |
|
| 4363 |
|
| 4364 |
|
| 4365 |
|
| 4366 |
|
| 4367 |
|
| 4368 |
|
| 4369 |
|
| 4370 |
|
| 4371 |
|
| 4372 |
|
| 4373 |
|
| 4374 |
|
| 4375 |
|
| 4376 |
|
| 4377 |
|
| 4378 |
|
| 4379 |
|
| 4380 |
|
| 4381 |
|
| 4382 |
|
| 4383 |
|
| 4384 |
|
| 4385 |
|
| 4386 |
|
| 4387 |
ACTION_TEMPLATE(InvokeArgument, |
| 4388 |
HAS_1_TEMPLATE_PARAMS(int, k), |
| 4389 |
AND_0_VALUE_PARAMS()) { |
| 4390 |
return internal::CallableHelper<return_type>::Call( |
| 4391 |
::std::tr1::get<k>(args)); |
| 4392 |
} |
| 4393 |
|
| 4394 |
ACTION_TEMPLATE(InvokeArgument, |
| 4395 |
HAS_1_TEMPLATE_PARAMS(int, k), |
| 4396 |
AND_1_VALUE_PARAMS(p0)) { |
| 4397 |
return internal::CallableHelper<return_type>::Call( |
| 4398 |
::std::tr1::get<k>(args), p0); |
| 4399 |
} |
| 4400 |
|
| 4401 |
ACTION_TEMPLATE(InvokeArgument, |
| 4402 |
HAS_1_TEMPLATE_PARAMS(int, k), |
| 4403 |
AND_2_VALUE_PARAMS(p0, p1)) { |
| 4404 |
return internal::CallableHelper<return_type>::Call( |
| 4405 |
::std::tr1::get<k>(args), p0, p1); |
| 4406 |
} |
| 4407 |
|
| 4408 |
ACTION_TEMPLATE(InvokeArgument, |
| 4409 |
HAS_1_TEMPLATE_PARAMS(int, k), |
| 4410 |
AND_3_VALUE_PARAMS(p0, p1, p2)) { |
| 4411 |
return internal::CallableHelper<return_type>::Call( |
| 4412 |
::std::tr1::get<k>(args), p0, p1, p2); |
| 4413 |
} |
| 4414 |
|
| 4415 |
ACTION_TEMPLATE(InvokeArgument, |
| 4416 |
HAS_1_TEMPLATE_PARAMS(int, k), |
| 4417 |
AND_4_VALUE_PARAMS(p0, p1, p2, p3)) { |
| 4418 |
return internal::CallableHelper<return_type>::Call( |
| 4419 |
::std::tr1::get<k>(args), p0, p1, p2, p3); |
| 4420 |
} |
| 4421 |
|
| 4422 |
ACTION_TEMPLATE(InvokeArgument, |
| 4423 |
HAS_1_TEMPLATE_PARAMS(int, k), |
| 4424 |
AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) { |
| 4425 |
return internal::CallableHelper<return_type>::Call( |
| 4426 |
::std::tr1::get<k>(args), p0, p1, p2, p3, p4); |
| 4427 |
} |
| 4428 |
|
| 4429 |
ACTION_TEMPLATE(InvokeArgument, |
| 4430 |
HAS_1_TEMPLATE_PARAMS(int, k), |
| 4431 |
AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) { |
| 4432 |
return internal::CallableHelper<return_type>::Call( |
| 4433 |
::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5); |
| 4434 |
} |
| 4435 |
|
| 4436 |
ACTION_TEMPLATE(InvokeArgument, |
| 4437 |
HAS_1_TEMPLATE_PARAMS(int, k), |
| 4438 |
AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) { |
| 4439 |
return internal::CallableHelper<return_type>::Call( |
| 4440 |
::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5, p6); |
| 4441 |
} |
| 4442 |
|
| 4443 |
ACTION_TEMPLATE(InvokeArgument, |
| 4444 |
HAS_1_TEMPLATE_PARAMS(int, k), |
| 4445 |
AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) { |
| 4446 |
return internal::CallableHelper<return_type>::Call( |
| 4447 |
::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7); |
| 4448 |
} |
| 4449 |
|
| 4450 |
ACTION_TEMPLATE(InvokeArgument, |
| 4451 |
HAS_1_TEMPLATE_PARAMS(int, k), |
| 4452 |
AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) { |
| 4453 |
return internal::CallableHelper<return_type>::Call( |
| 4454 |
::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7, p8); |
| 4455 |
} |
| 4456 |
|
| 4457 |
ACTION_TEMPLATE(InvokeArgument, |
| 4458 |
HAS_1_TEMPLATE_PARAMS(int, k), |
| 4459 |
AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)) { |
| 4460 |
return internal::CallableHelper<return_type>::Call( |
| 4461 |
::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); |
| 4462 |
} |
| 4463 |
|
| 4464 |
|
| 4465 |
|
| 4466 |
|
| 4467 |
|
| 4468 |
|
| 4469 |
ACTION_TEMPLATE(ReturnNew, |
| 4470 |
HAS_1_TEMPLATE_PARAMS(typename, T), |
| 4471 |
AND_0_VALUE_PARAMS()) { |
| 4472 |
return new T(); |
| 4473 |
} |
| 4474 |
|
| 4475 |
ACTION_TEMPLATE(ReturnNew, |
| 4476 |
HAS_1_TEMPLATE_PARAMS(typename, T), |
| 4477 |
AND_1_VALUE_PARAMS(p0)) { |
| 4478 |
return new T(p0); |
| 4479 |
} |
| 4480 |
|
| 4481 |
ACTION_TEMPLATE(ReturnNew, |
| 4482 |
HAS_1_TEMPLATE_PARAMS(typename, T), |
| 4483 |
AND_2_VALUE_PARAMS(p0, p1)) { |
| 4484 |
return new T(p0, p1); |
| 4485 |
} |
| 4486 |
|
| 4487 |
ACTION_TEMPLATE(ReturnNew, |
| 4488 |
HAS_1_TEMPLATE_PARAMS(typename, T), |
| 4489 |
AND_3_VALUE_PARAMS(p0, p1, p2)) { |
| 4490 |
return new T(p0, p1, p2); |
| 4491 |
} |
| 4492 |
|
| 4493 |
ACTION_TEMPLATE(ReturnNew, |
| 4494 |
HAS_1_TEMPLATE_PARAMS(typename, T), |
| 4495 |
AND_4_VALUE_PARAMS(p0, p1, p2, p3)) { |
| 4496 |
return new T(p0, p1, p2, p3); |
| 4497 |
} |
| 4498 |
|
| 4499 |
ACTION_TEMPLATE(ReturnNew, |
| 4500 |
HAS_1_TEMPLATE_PARAMS(typename, T), |
| 4501 |
AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) { |
| 4502 |
return new T(p0, p1, p2, p3, p4); |
| 4503 |
} |
| 4504 |
|
| 4505 |
ACTION_TEMPLATE(ReturnNew, |
| 4506 |
HAS_1_TEMPLATE_PARAMS(typename, T), |
| 4507 |
AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) { |
| 4508 |
return new T(p0, p1, p2, p3, p4, p5); |
| 4509 |
} |
| 4510 |
|
| 4511 |
ACTION_TEMPLATE(ReturnNew, |
| 4512 |
HAS_1_TEMPLATE_PARAMS(typename, T), |
| 4513 |
AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) { |
| 4514 |
return new T(p0, p1, p2, p3, p4, p5, p6); |
| 4515 |
} |
| 4516 |
|
| 4517 |
ACTION_TEMPLATE(ReturnNew, |
| 4518 |
HAS_1_TEMPLATE_PARAMS(typename, T), |
| 4519 |
AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) { |
| 4520 |
return new T(p0, p1, p2, p3, p4, p5, p6, p7); |
| 4521 |
} |
| 4522 |
|
| 4523 |
ACTION_TEMPLATE(ReturnNew, |
| 4524 |
HAS_1_TEMPLATE_PARAMS(typename, T), |
| 4525 |
AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) { |
| 4526 |
return new T(p0, p1, p2, p3, p4, p5, p6, p7, p8); |
| 4527 |
} |
| 4528 |
|
| 4529 |
ACTION_TEMPLATE(ReturnNew, |
| 4530 |
HAS_1_TEMPLATE_PARAMS(typename, T), |
| 4531 |
AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)) { |
| 4532 |
return new T(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); |
| 4533 |
} |
| 4534 |
|
| 4535 |
#ifdef _MSC_VER |
| 4536 |
# pragma warning(pop) |
| 4537 |
#endif |
| 4538 |
|
| 4539 |
} |
| 4540 |
|
| 4541 |
#endif |
| 4542 |
|
| 4543 |
|
| 4544 |
|
| 4545 |
|
| 4546 |
|
| 4547 |
|
| 4548 |
|
| 4549 |
|
| 4550 |
|
| 4551 |
|
| 4552 |
|
| 4553 |
|
| 4554 |
|
| 4555 |
|
| 4556 |
|
| 4557 |
|
| 4558 |
|
| 4559 |
|
| 4560 |
|
| 4561 |
|
| 4562 |
|
| 4563 |
|
| 4564 |
|
| 4565 |
|
| 4566 |
|
| 4567 |
|
| 4568 |
|
| 4569 |
|
| 4570 |
|
| 4571 |
|
| 4572 |
|
| 4573 |
|
| 4574 |
|
| 4575 |
|
| 4576 |
|
| 4577 |
|
| 4578 |
|
| 4579 |
|
| 4580 |
|
| 4581 |
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_ |
| 4582 |
#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_ |
| 4583 |
|
| 4584 |
|
| 4585 |
|
| 4586 |
|
| 4587 |
|
| 4588 |
|
| 4589 |
|
| 4590 |
|
| 4591 |
|
| 4592 |
|
| 4593 |
|
| 4594 |
|
| 4595 |
|
| 4596 |
|
| 4597 |
|
| 4598 |
|
| 4599 |
|
| 4600 |
|
| 4601 |
|
| 4602 |
|
| 4603 |
|
| 4604 |
|
| 4605 |
|
| 4606 |
|
| 4607 |
|
| 4608 |
|
| 4609 |
|
| 4610 |
|
| 4611 |
|
| 4612 |
|
| 4613 |
|
| 4614 |
|
| 4615 |
|
| 4616 |
|
| 4617 |
|
| 4618 |
|
| 4619 |
|
| 4620 |
|
| 4621 |
|
| 4622 |
|
| 4623 |
|
| 4624 |
|
| 4625 |
|
| 4626 |
|
| 4627 |
|
| 4628 |
|
| 4629 |
|
| 4630 |
|
| 4631 |
|
| 4632 |
|
| 4633 |
|
| 4634 |
|
| 4635 |
|
| 4636 |
|
| 4637 |
|
| 4638 |
|
| 4639 |
|
| 4640 |
|
| 4641 |
|
| 4642 |
|
| 4643 |
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_ |
| 4644 |
#define GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_ |
| 4645 |
|
| 4646 |
#include <map> |
| 4647 |
#include <set> |
| 4648 |
#include <sstream> |
| 4649 |
#include <string> |
| 4650 |
#include <vector> |
| 4651 |
|
| 4652 |
#if GTEST_HAS_EXCEPTIONS |
| 4653 |
# include <stdexcept> |
| 4654 |
#endif |
| 4655 |
|
| 4656 |
|
| 4657 |
|
| 4658 |
|
| 4659 |
|
| 4660 |
|
| 4661 |
|
| 4662 |
|
| 4663 |
|
| 4664 |
|
| 4665 |
|
| 4666 |
|
| 4667 |
|
| 4668 |
|
| 4669 |
|
| 4670 |
|
| 4671 |
|
| 4672 |
|
| 4673 |
|
| 4674 |
|
| 4675 |
|
| 4676 |
|
| 4677 |
|
| 4678 |
|
| 4679 |
|
| 4680 |
|
| 4681 |
|
| 4682 |
|
| 4683 |
|
| 4684 |
|
| 4685 |
|
| 4686 |
|
| 4687 |
|
| 4688 |
|
| 4689 |
|
| 4690 |
|
| 4691 |
|
| 4692 |
|
| 4693 |
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_ |
| 4694 |
#define GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_ |
| 4695 |
|
| 4696 |
#include <math.h> |
| 4697 |
#include <algorithm> |
| 4698 |
#include <iterator> |
| 4699 |
#include <limits> |
| 4700 |
#include <ostream> |
| 4701 |
#include <sstream> |
| 4702 |
#include <string> |
| 4703 |
#include <utility> |
| 4704 |
#include <vector> |
| 4705 |
|
| 4706 |
|
| 4707 |
#if GTEST_LANG_CXX11 |
| 4708 |
#include <initializer_list> |
| 4709 |
#endif |
| 4710 |
|
| 4711 |
namespace testing { |
| 4712 |
|
| 4713 |
|
| 4714 |
|
| 4715 |
|
| 4716 |
|
| 4717 |
|
| 4718 |
|
| 4719 |
|
| 4720 |
|
| 4721 |
|
| 4722 |
|
| 4723 |
|
| 4724 |
|
| 4725 |
|
| 4726 |
|
| 4727 |
|
| 4728 |
|
| 4729 |
|
| 4730 |
|
| 4731 |
|
| 4732 |
class MatchResultListener { |
| 4733 |
public: |
| 4734 |
|
| 4735 |
|
| 4736 |
|
| 4737 |
explicit MatchResultListener(::std::ostream* os) : stream_(os) {} |
| 4738 |
virtual ~MatchResultListener() = 0; |
| 4739 |
|
| 4740 |
|
| 4741 |
|
| 4742 |
template <typename T> |
| 4743 |
MatchResultListener& operator<<(const T& x) { |
| 4744 |
if (stream_ != NULL) |
| 4745 |
*stream_ << x; |
| 4746 |
return *this; |
| 4747 |
} |
| 4748 |
|
| 4749 |
|
| 4750 |
::std::ostream* stream() { return stream_; } |
| 4751 |
|
| 4752 |
|
| 4753 |
|
| 4754 |
|
| 4755 |
|
| 4756 |
bool IsInterested() const { return stream_ != NULL; } |
| 4757 |
|
| 4758 |
private: |
| 4759 |
::std::ostream* const stream_; |
| 4760 |
|
| 4761 |
GTEST_DISALLOW_COPY_AND_ASSIGN_(MatchResultListener); |
| 4762 |
}; |
| 4763 |
|
| 4764 |
inline MatchResultListener::~MatchResultListener() { |
| 4765 |
} |
| 4766 |
|
| 4767 |
|
| 4768 |
|
| 4769 |
class MatcherDescriberInterface { |
| 4770 |
public: |
| 4771 |
virtual ~MatcherDescriberInterface() {} |
| 4772 |
|
| 4773 |
|
| 4774 |
|
| 4775 |
|
| 4776 |
|
| 4777 |
|
| 4778 |
virtual void DescribeTo(::std::ostream* os) const = 0; |
| 4779 |
|
| 4780 |
|
| 4781 |
|
| 4782 |
|
| 4783 |
|
| 4784 |
|
| 4785 |
|
| 4786 |
virtual void DescribeNegationTo(::std::ostream* os) const { |
| 4787 |
*os << "not ("; |
| 4788 |
DescribeTo(os); |
| 4789 |
*os << ")"; |
| 4790 |
} |
| 4791 |
}; |
| 4792 |
|
| 4793 |
|
| 4794 |
template <typename T> |
| 4795 |
class MatcherInterface : public MatcherDescriberInterface { |
| 4796 |
public: |
| 4797 |
|
| 4798 |
|
| 4799 |
|
| 4800 |
|
| 4801 |
|
| 4802 |
|
| 4803 |
|
| 4804 |
|
| 4805 |
|
| 4806 |
|
| 4807 |
|
| 4808 |
|
| 4809 |
|
| 4810 |
|
| 4811 |
|
| 4812 |
|
| 4813 |
|
| 4814 |
|
| 4815 |
|
| 4816 |
|
| 4817 |
|
| 4818 |
|
| 4819 |
|
| 4820 |
|
| 4821 |
|
| 4822 |
|
| 4823 |
|
| 4824 |
|
| 4825 |
|
| 4826 |
|
| 4827 |
|
| 4828 |
virtual bool MatchAndExplain(T x, MatchResultListener* listener) const = 0; |
| 4829 |
|
| 4830 |
|
| 4831 |
|
| 4832 |
|
| 4833 |
}; |
| 4834 |
|
| 4835 |
|
| 4836 |
class StringMatchResultListener : public MatchResultListener { |
| 4837 |
public: |
| 4838 |
StringMatchResultListener() : MatchResultListener(&ss_) {} |
| 4839 |
|
| 4840 |
|
| 4841 |
internal::string str() const { return ss_.str(); } |
| 4842 |
|
| 4843 |
|
| 4844 |
void Clear() { ss_.str(""); } |
| 4845 |
|
| 4846 |
private: |
| 4847 |
::std::stringstream ss_; |
| 4848 |
|
| 4849 |
GTEST_DISALLOW_COPY_AND_ASSIGN_(StringMatchResultListener); |
| 4850 |
}; |
| 4851 |
|
| 4852 |
namespace internal { |
| 4853 |
|
| 4854 |
|
| 4855 |
class DummyMatchResultListener : public MatchResultListener { |
| 4856 |
public: |
| 4857 |
DummyMatchResultListener() : MatchResultListener(NULL) {} |
| 4858 |
|
| 4859 |
private: |
| 4860 |
GTEST_DISALLOW_COPY_AND_ASSIGN_(DummyMatchResultListener); |
| 4861 |
}; |
| 4862 |
|
| 4863 |
|
| 4864 |
|
| 4865 |
|
| 4866 |
class StreamMatchResultListener : public MatchResultListener { |
| 4867 |
public: |
| 4868 |
explicit StreamMatchResultListener(::std::ostream* os) |
| 4869 |
: MatchResultListener(os) {} |
| 4870 |
|
| 4871 |
private: |
| 4872 |
GTEST_DISALLOW_COPY_AND_ASSIGN_(StreamMatchResultListener); |
| 4873 |
}; |
| 4874 |
|
| 4875 |
|
| 4876 |
|
| 4877 |
|
| 4878 |
template <typename T> |
| 4879 |
class MatcherBase { |
| 4880 |
public: |
| 4881 |
|
| 4882 |
|
| 4883 |
bool MatchAndExplain(T x, MatchResultListener* listener) const { |
| 4884 |
return impl_->MatchAndExplain(x, listener); |
| 4885 |
} |
| 4886 |
|
| 4887 |
|
| 4888 |
bool Matches(T x) const { |
| 4889 |
DummyMatchResultListener dummy; |
| 4890 |
return MatchAndExplain(x, &dummy); |
| 4891 |
} |
| 4892 |
|
| 4893 |
|
| 4894 |
void DescribeTo(::std::ostream* os) const { impl_->DescribeTo(os); } |
| 4895 |
|
| 4896 |
|
| 4897 |
void DescribeNegationTo(::std::ostream* os) const { |
| 4898 |
impl_->DescribeNegationTo(os); |
| 4899 |
} |
| 4900 |
|
| 4901 |
|
| 4902 |
void ExplainMatchResultTo(T x, ::std::ostream* os) const { |
| 4903 |
StreamMatchResultListener listener(os); |
| 4904 |
MatchAndExplain(x, &listener); |
| 4905 |
} |
| 4906 |
|
| 4907 |
|
| 4908 |
|
| 4909 |
|
| 4910 |
const MatcherDescriberInterface* GetDescriber() const { |
| 4911 |
return impl_.get(); |
| 4912 |
} |
| 4913 |
|
| 4914 |
protected: |
| 4915 |
MatcherBase() {} |
| 4916 |
|
| 4917 |
|
| 4918 |
explicit MatcherBase(const MatcherInterface<T>* impl) |
| 4919 |
: impl_(impl) {} |
| 4920 |
|
| 4921 |
virtual ~MatcherBase() {} |
| 4922 |
|
| 4923 |
private: |
| 4924 |
|
| 4925 |
|
| 4926 |
|
| 4927 |
|
| 4928 |
|
| 4929 |
|
| 4930 |
|
| 4931 |
|
| 4932 |
|
| 4933 |
|
| 4934 |
|
| 4935 |
::testing::internal::linked_ptr<const MatcherInterface<T> > impl_; |
| 4936 |
}; |
| 4937 |
|
| 4938 |
} |
| 4939 |
|
| 4940 |
|
| 4941 |
|
| 4942 |
|
| 4943 |
|
| 4944 |
|
| 4945 |
template <typename T> |
| 4946 |
class Matcher : public internal::MatcherBase<T> { |
| 4947 |
public: |
| 4948 |
|
| 4949 |
|
| 4950 |
|
| 4951 |
Matcher() {} |
| 4952 |
|
| 4953 |
|
| 4954 |
explicit Matcher(const MatcherInterface<T>* impl) |
| 4955 |
: internal::MatcherBase<T>(impl) {} |
| 4956 |
|
| 4957 |
|
| 4958 |
|
| 4959 |
Matcher(T value); |
| 4960 |
}; |
| 4961 |
|
| 4962 |
|
| 4963 |
|
| 4964 |
|
| 4965 |
template <> |
| 4966 |
class GTEST_API_ Matcher<const internal::string&> |
| 4967 |
: public internal::MatcherBase<const internal::string&> { |
| 4968 |
public: |
| 4969 |
Matcher() {} |
| 4970 |
|
| 4971 |
explicit Matcher(const MatcherInterface<const internal::string&>* impl) |
| 4972 |
: internal::MatcherBase<const internal::string&>(impl) {} |
| 4973 |
|
| 4974 |
|
| 4975 |
|
| 4976 |
Matcher(const internal::string& s); |
| 4977 |
|
| 4978 |
|
| 4979 |
Matcher(const char* s); |
| 4980 |
}; |
| 4981 |
|
| 4982 |
template <> |
| 4983 |
class GTEST_API_ Matcher<internal::string> |
| 4984 |
: public internal::MatcherBase<internal::string> { |
| 4985 |
public: |
| 4986 |
Matcher() {} |
| 4987 |
|
| 4988 |
explicit Matcher(const MatcherInterface<internal::string>* impl) |
| 4989 |
: internal::MatcherBase<internal::string>(impl) {} |
| 4990 |
|
| 4991 |
|
| 4992 |
|
| 4993 |
Matcher(const internal::string& s); |
| 4994 |
|
| 4995 |
|
| 4996 |
Matcher(const char* s); |
| 4997 |
}; |
| 4998 |
|
| 4999 |
#if GTEST_HAS_STRING_PIECE_ |
| 5000 |
|
| 5001 |
|
| 5002 |
|
| 5003 |
template <> |
| 5004 |
class GTEST_API_ Matcher<const StringPiece&> |
| 5005 |
: public internal::MatcherBase<const StringPiece&> { |
| 5006 |
public: |
| 5007 |
Matcher() {} |
| 5008 |
|
| 5009 |
explicit Matcher(const MatcherInterface<const StringPiece&>* impl) |
| 5010 |
: internal::MatcherBase<const StringPiece&>(impl) {} |
| 5011 |
|
| 5012 |
|
| 5013 |
|
| 5014 |
Matcher(const internal::string& s); |
| 5015 |
|
| 5016 |
|
| 5017 |
Matcher(const char* s); |
| 5018 |
|
| 5019 |
|
| 5020 |
Matcher(StringPiece s); |
| 5021 |
}; |
| 5022 |
|
| 5023 |
template <> |
| 5024 |
class GTEST_API_ Matcher<StringPiece> |
| 5025 |
: public internal::MatcherBase<StringPiece> { |
| 5026 |
public: |
| 5027 |
Matcher() {} |
| 5028 |
|
| 5029 |
explicit Matcher(const MatcherInterface<StringPiece>* impl) |
| 5030 |
: internal::MatcherBase<StringPiece>(impl) {} |
| 5031 |
|
| 5032 |
|
| 5033 |
|
| 5034 |
Matcher(const internal::string& s); |
| 5035 |
|
| 5036 |
|
| 5037 |
Matcher(const char* s); |
| 5038 |
|
| 5039 |
|
| 5040 |
Matcher(StringPiece s); |
| 5041 |
}; |
| 5042 |
#endif |
| 5043 |
|
| 5044 |
|
| 5045 |
|
| 5046 |
|
| 5047 |
|
| 5048 |
|
| 5049 |
|
| 5050 |
|
| 5051 |
|
| 5052 |
|
| 5053 |
|
| 5054 |
|
| 5055 |
|
| 5056 |
template <class Impl> |
| 5057 |
class PolymorphicMatcher { |
| 5058 |
public: |
| 5059 |
explicit PolymorphicMatcher(const Impl& an_impl) : impl_(an_impl) {} |
| 5060 |
|
| 5061 |
|
| 5062 |
|
| 5063 |
Impl& mutable_impl() { return impl_; } |
| 5064 |
|
| 5065 |
|
| 5066 |
|
| 5067 |
const Impl& impl() const { return impl_; } |
| 5068 |
|
| 5069 |
template <typename T> |
| 5070 |
operator Matcher<T>() const { |
| 5071 |
return Matcher<T>(new MonomorphicImpl<T>(impl_)); |
| 5072 |
} |
| 5073 |
|
| 5074 |
private: |
| 5075 |
template <typename T> |
| 5076 |
class MonomorphicImpl : public MatcherInterface<T> { |
| 5077 |
public: |
| 5078 |
explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {} |
| 5079 |
|
| 5080 |
virtual void DescribeTo(::std::ostream* os) const { |
| 5081 |
impl_.DescribeTo(os); |
| 5082 |
} |
| 5083 |
|
| 5084 |
virtual void DescribeNegationTo(::std::ostream* os) const { |
| 5085 |
impl_.DescribeNegationTo(os); |
| 5086 |
} |
| 5087 |
|
| 5088 |
virtual bool MatchAndExplain(T x, MatchResultListener* listener) const { |
| 5089 |
return impl_.MatchAndExplain(x, listener); |
| 5090 |
} |
| 5091 |
|
| 5092 |
private: |
| 5093 |
const Impl impl_; |
| 5094 |
|
| 5095 |
GTEST_DISALLOW_ASSIGN_(MonomorphicImpl); |
| 5096 |
}; |
| 5097 |
|
| 5098 |
Impl impl_; |
| 5099 |
|
| 5100 |
GTEST_DISALLOW_ASSIGN_(PolymorphicMatcher); |
| 5101 |
}; |
| 5102 |
|
| 5103 |
|
| 5104 |
|
| 5105 |
|
| 5106 |
|
| 5107 |
|
| 5108 |
|
| 5109 |
|
| 5110 |
template <typename T> |
| 5111 |
inline Matcher<T> MakeMatcher(const MatcherInterface<T>* impl) { |
| 5112 |
return Matcher<T>(impl); |
| 5113 |
} |
| 5114 |
|
| 5115 |
|
| 5116 |
|
| 5117 |
|
| 5118 |
|
| 5119 |
|
| 5120 |
|
| 5121 |
|
| 5122 |
template <class Impl> |
| 5123 |
inline PolymorphicMatcher<Impl> MakePolymorphicMatcher(const Impl& impl) { |
| 5124 |
return PolymorphicMatcher<Impl>(impl); |
| 5125 |
} |
| 5126 |
|
| 5127 |
|
| 5128 |
|
| 5129 |
namespace internal { |
| 5130 |
|
| 5131 |
|
| 5132 |
|
| 5133 |
|
| 5134 |
|
| 5135 |
|
| 5136 |
|
| 5137 |
|
| 5138 |
|
| 5139 |
|
| 5140 |
|
| 5141 |
template <typename T, typename M> |
| 5142 |
class MatcherCastImpl { |
| 5143 |
public: |
| 5144 |
static Matcher<T> Cast(M polymorphic_matcher_or_value) { |
| 5145 |
|
| 5146 |
|
| 5147 |
|
| 5148 |
|
| 5149 |
|
| 5150 |
|
| 5151 |
|
| 5152 |
|
| 5153 |
|
| 5154 |
|
| 5155 |
|
| 5156 |
|
| 5157 |
|
| 5158 |
return CastImpl( |
| 5159 |
polymorphic_matcher_or_value, |
| 5160 |
BooleanConstant< |
| 5161 |
internal::ImplicitlyConvertible<M, Matcher<T> >::value>()); |
| 5162 |
} |
| 5163 |
|
| 5164 |
private: |
| 5165 |
static Matcher<T> CastImpl(M value, BooleanConstant<false>) { |
| 5166 |
|
| 5167 |
|
| 5168 |
|
| 5169 |
return Matcher<T>(ImplicitCast_<T>(value)); |
| 5170 |
} |
| 5171 |
|
| 5172 |
static Matcher<T> CastImpl(M polymorphic_matcher_or_value, |
| 5173 |
BooleanConstant<true>) { |
| 5174 |
|
| 5175 |
|
| 5176 |
|
| 5177 |
|
| 5178 |
|
| 5179 |
|
| 5180 |
|
| 5181 |
|
| 5182 |
return polymorphic_matcher_or_value; |
| 5183 |
} |
| 5184 |
}; |
| 5185 |
|
| 5186 |
|
| 5187 |
|
| 5188 |
|
| 5189 |
template <typename T, typename U> |
| 5190 |
class MatcherCastImpl<T, Matcher<U> > { |
| 5191 |
public: |
| 5192 |
static Matcher<T> Cast(const Matcher<U>& source_matcher) { |
| 5193 |
return Matcher<T>(new Impl(source_matcher)); |
| 5194 |
} |
| 5195 |
|
| 5196 |
private: |
| 5197 |
class Impl : public MatcherInterface<T> { |
| 5198 |
public: |
| 5199 |
explicit Impl(const Matcher<U>& source_matcher) |
| 5200 |
: source_matcher_(source_matcher) {} |
| 5201 |
|
| 5202 |
|
| 5203 |
virtual bool MatchAndExplain(T x, MatchResultListener* listener) const { |
| 5204 |
return source_matcher_.MatchAndExplain(static_cast<U>(x), listener); |
| 5205 |
} |
| 5206 |
|
| 5207 |
virtual void DescribeTo(::std::ostream* os) const { |
| 5208 |
source_matcher_.DescribeTo(os); |
| 5209 |
} |
| 5210 |
|
| 5211 |
virtual void DescribeNegationTo(::std::ostream* os) const { |
| 5212 |
source_matcher_.DescribeNegationTo(os); |
| 5213 |
} |
| 5214 |
|
| 5215 |
private: |
| 5216 |
const Matcher<U> source_matcher_; |
| 5217 |
|
| 5218 |
GTEST_DISALLOW_ASSIGN_(Impl); |
| 5219 |
}; |
| 5220 |
}; |
| 5221 |
|
| 5222 |
|
| 5223 |
|
| 5224 |
template <typename T> |
| 5225 |
class MatcherCastImpl<T, Matcher<T> > { |
| 5226 |
public: |
| 5227 |
static Matcher<T> Cast(const Matcher<T>& matcher) { return matcher; } |
| 5228 |
}; |
| 5229 |
|
| 5230 |
} |
| 5231 |
|
| 5232 |
|
| 5233 |
|
| 5234 |
|
| 5235 |
|
| 5236 |
template <typename T, typename M> |
| 5237 |
inline Matcher<T> MatcherCast(M matcher) { |
| 5238 |
return internal::MatcherCastImpl<T, M>::Cast(matcher); |
| 5239 |
} |
| 5240 |
|
| 5241 |
|
| 5242 |
|
| 5243 |
|
| 5244 |
|
| 5245 |
|
| 5246 |
|
| 5247 |
|
| 5248 |
template <typename T> |
| 5249 |
class SafeMatcherCastImpl { |
| 5250 |
public: |
| 5251 |
|
| 5252 |
|
| 5253 |
template <typename M> |
| 5254 |
static inline Matcher<T> Cast(M polymorphic_matcher_or_value) { |
| 5255 |
return internal::MatcherCastImpl<T, M>::Cast(polymorphic_matcher_or_value); |
| 5256 |
} |
| 5257 |
|
| 5258 |
|
| 5259 |
|
| 5260 |
|
| 5261 |
|
| 5262 |
|
| 5263 |
|
| 5264 |
|
| 5265 |
|
| 5266 |
|
| 5267 |
template <typename U> |
| 5268 |
static inline Matcher<T> Cast(const Matcher<U>& matcher) { |
| 5269 |
|
| 5270 |
GTEST_COMPILE_ASSERT_((internal::ImplicitlyConvertible<T, U>::value), |
| 5271 |
T_must_be_implicitly_convertible_to_U); |
| 5272 |
|
| 5273 |
|
| 5274 |
GTEST_COMPILE_ASSERT_( |
| 5275 |
internal::is_reference<T>::value || !internal::is_reference<U>::value, |
| 5276 |
cannot_convert_non_referentce_arg_to_reference); |
| 5277 |
|
| 5278 |
|
| 5279 |
typedef GTEST_REMOVE_REFERENCE_AND_CONST_(T) RawT; |
| 5280 |
typedef GTEST_REMOVE_REFERENCE_AND_CONST_(U) RawU; |
| 5281 |
const bool kTIsOther = GMOCK_KIND_OF_(RawT) == internal::kOther; |
| 5282 |
const bool kUIsOther = GMOCK_KIND_OF_(RawU) == internal::kOther; |
| 5283 |
GTEST_COMPILE_ASSERT_( |
| 5284 |
kTIsOther || kUIsOther || |
| 5285 |
(internal::LosslessArithmeticConvertible<RawT, RawU>::value), |
| 5286 |
conversion_of_arithmetic_types_must_be_lossless); |
| 5287 |
return MatcherCast<T>(matcher); |
| 5288 |
} |
| 5289 |
}; |
| 5290 |
|
| 5291 |
template <typename T, typename M> |
| 5292 |
inline Matcher<T> SafeMatcherCast(const M& polymorphic_matcher) { |
| 5293 |
return SafeMatcherCastImpl<T>::Cast(polymorphic_matcher); |
| 5294 |
} |
| 5295 |
|
| 5296 |
|
| 5297 |
template <typename T> |
| 5298 |
Matcher<T> A(); |
| 5299 |
|
| 5300 |
|
| 5301 |
|
| 5302 |
namespace internal { |
| 5303 |
|
| 5304 |
|
| 5305 |
inline void PrintIfNotEmpty(const internal::string& explanation, |
| 5306 |
::std::ostream* os) { |
| 5307 |
if (explanation != "" && os != NULL) { |
| 5308 |
*os << ", " << explanation; |
| 5309 |
} |
| 5310 |
} |
| 5311 |
|
| 5312 |
|
| 5313 |
|
| 5314 |
|
| 5315 |
inline bool IsReadableTypeName(const string& type_name) { |
| 5316 |
|
| 5317 |
|
| 5318 |
return (type_name.length() <= 20 || |
| 5319 |
type_name.find_first_of("<(") == string::npos); |
| 5320 |
} |
| 5321 |
|
| 5322 |
|
| 5323 |
|
| 5324 |
|
| 5325 |
|
| 5326 |
|
| 5327 |
template <typename Value, typename T> |
| 5328 |
bool MatchPrintAndExplain(Value& value, const Matcher<T>& matcher, |
| 5329 |
MatchResultListener* listener) { |
| 5330 |
if (!listener->IsInterested()) { |
| 5331 |
|
| 5332 |
|
| 5333 |
return matcher.Matches(value); |
| 5334 |
} |
| 5335 |
|
| 5336 |
StringMatchResultListener inner_listener; |
| 5337 |
const bool match = matcher.MatchAndExplain(value, &inner_listener); |
| 5338 |
|
| 5339 |
UniversalPrint(value, listener->stream()); |
| 5340 |
#if GTEST_HAS_RTTI |
| 5341 |
const string& type_name = GetTypeName<Value>(); |
| 5342 |
if (IsReadableTypeName(type_name)) |
| 5343 |
*listener->stream() << " (of type " << type_name << ")"; |
| 5344 |
#endif |
| 5345 |
PrintIfNotEmpty(inner_listener.str(), listener->stream()); |
| 5346 |
|
| 5347 |
return match; |
| 5348 |
} |
| 5349 |
|
| 5350 |
|
| 5351 |
|
| 5352 |
template <size_t N> |
| 5353 |
class TuplePrefix { |
| 5354 |
public: |
| 5355 |
|
| 5356 |
|
| 5357 |
|
| 5358 |
template <typename MatcherTuple, typename ValueTuple> |
| 5359 |
static bool Matches(const MatcherTuple& matcher_tuple, |
| 5360 |
const ValueTuple& value_tuple) { |
| 5361 |
using ::std::tr1::get; |
| 5362 |
return TuplePrefix<N - 1>::Matches(matcher_tuple, value_tuple) |
| 5363 |
&& get<N - 1>(matcher_tuple).Matches(get<N - 1>(value_tuple)); |
| 5364 |
} |
| 5365 |
|
| 5366 |
|
| 5367 |
|
| 5368 |
|
| 5369 |
|
| 5370 |
template <typename MatcherTuple, typename ValueTuple> |
| 5371 |
static void ExplainMatchFailuresTo(const MatcherTuple& matchers, |
| 5372 |
const ValueTuple& values, |
| 5373 |
::std::ostream* os) { |
| 5374 |
using ::std::tr1::tuple_element; |
| 5375 |
using ::std::tr1::get; |
| 5376 |
|
| 5377 |
|
| 5378 |
TuplePrefix<N - 1>::ExplainMatchFailuresTo(matchers, values, os); |
| 5379 |
|
| 5380 |
|
| 5381 |
|
| 5382 |
typename tuple_element<N - 1, MatcherTuple>::type matcher = |
| 5383 |
get<N - 1>(matchers); |
| 5384 |
typedef typename tuple_element<N - 1, ValueTuple>::type Value; |
| 5385 |
Value value = get<N - 1>(values); |
| 5386 |
StringMatchResultListener listener; |
| 5387 |
if (!matcher.MatchAndExplain(value, &listener)) { |
| 5388 |
|
| 5389 |
|
| 5390 |
*os << " Expected arg #" << N - 1 << ": "; |
| 5391 |
get<N - 1>(matchers).DescribeTo(os); |
| 5392 |
*os << "\n Actual: "; |
| 5393 |
|
| 5394 |
|
| 5395 |
|
| 5396 |
|
| 5397 |
|
| 5398 |
internal::UniversalPrint(value, os); |
| 5399 |
PrintIfNotEmpty(listener.str(), os); |
| 5400 |
*os << "\n"; |
| 5401 |
} |
| 5402 |
} |
| 5403 |
}; |
| 5404 |
|
| 5405 |
|
| 5406 |
template <> |
| 5407 |
class TuplePrefix<0> { |
| 5408 |
public: |
| 5409 |
template <typename MatcherTuple, typename ValueTuple> |
| 5410 |
static bool Matches(const MatcherTuple& , |
| 5411 |
const ValueTuple& ) { |
| 5412 |
return true; |
| 5413 |
} |
| 5414 |
|
| 5415 |
template <typename MatcherTuple, typename ValueTuple> |
| 5416 |
static void ExplainMatchFailuresTo(const MatcherTuple& , |
| 5417 |
const ValueTuple& , |
| 5418 |
::std::ostream* ) {} |
| 5419 |
}; |
| 5420 |
|
| 5421 |
|
| 5422 |
|
| 5423 |
|
| 5424 |
|
| 5425 |
|
| 5426 |
template <typename MatcherTuple, typename ValueTuple> |
| 5427 |
bool TupleMatches(const MatcherTuple& matcher_tuple, |
| 5428 |
const ValueTuple& value_tuple) { |
| 5429 |
using ::std::tr1::tuple_size; |
| 5430 |
|
| 5431 |
|
| 5432 |
GTEST_COMPILE_ASSERT_(tuple_size<MatcherTuple>::value == |
| 5433 |
tuple_size<ValueTuple>::value, |
| 5434 |
matcher_and_value_have_different_numbers_of_fields); |
| 5435 |
return TuplePrefix<tuple_size<ValueTuple>::value>:: |
| 5436 |
Matches(matcher_tuple, value_tuple); |
| 5437 |
} |
| 5438 |
|
| 5439 |
|
| 5440 |
|
| 5441 |
template <typename MatcherTuple, typename ValueTuple> |
| 5442 |
void ExplainMatchFailureTupleTo(const MatcherTuple& matchers, |
| 5443 |
const ValueTuple& values, |
| 5444 |
::std::ostream* os) { |
| 5445 |
using ::std::tr1::tuple_size; |
| 5446 |
TuplePrefix<tuple_size<MatcherTuple>::value>::ExplainMatchFailuresTo( |
| 5447 |
matchers, values, os); |
| 5448 |
} |
| 5449 |
|
| 5450 |
|
| 5451 |
|
| 5452 |
|
| 5453 |
|
| 5454 |
template <typename Tuple, typename Func, typename OutIter> |
| 5455 |
class TransformTupleValuesHelper { |
| 5456 |
private: |
| 5457 |
typedef typename ::std::tr1::tuple_size<Tuple> TupleSize; |
| 5458 |
|
| 5459 |
public: |
| 5460 |
|
| 5461 |
|
| 5462 |
static OutIter Run(Func f, const Tuple& t, OutIter out) { |
| 5463 |
return IterateOverTuple<Tuple, TupleSize::value>()(f, t, out); |
| 5464 |
} |
| 5465 |
|
| 5466 |
private: |
| 5467 |
template <typename Tup, size_t kRemainingSize> |
| 5468 |
struct IterateOverTuple { |
| 5469 |
OutIter operator() (Func f, const Tup& t, OutIter out) const { |
| 5470 |
*out++ = f(::std::tr1::get<TupleSize::value - kRemainingSize>(t)); |
| 5471 |
return IterateOverTuple<Tup, kRemainingSize - 1>()(f, t, out); |
| 5472 |
} |
| 5473 |
}; |
| 5474 |
template <typename Tup> |
| 5475 |
struct IterateOverTuple<Tup, 0> { |
| 5476 |
OutIter operator() (Func , const Tup& , OutIter out) const { |
| 5477 |
return out; |
| 5478 |
} |
| 5479 |
}; |
| 5480 |
}; |
| 5481 |
|
| 5482 |
|
| 5483 |
|
| 5484 |
|
| 5485 |
template <typename Tuple, typename Func, typename OutIter> |
| 5486 |
OutIter TransformTupleValues(Func f, const Tuple& t, OutIter out) { |
| 5487 |
return TransformTupleValuesHelper<Tuple, Func, OutIter>::Run(f, t, out); |
| 5488 |
} |
| 5489 |
|
| 5490 |
|
| 5491 |
template <typename T> |
| 5492 |
class AnyMatcherImpl : public MatcherInterface<T> { |
| 5493 |
public: |
| 5494 |
virtual bool MatchAndExplain( |
| 5495 |
T , MatchResultListener* ) const { return true; } |
| 5496 |
virtual void DescribeTo(::std::ostream* os) const { *os << "is anything"; } |
| 5497 |
virtual void DescribeNegationTo(::std::ostream* os) const { |
| 5498 |
|
| 5499 |
|
| 5500 |
|
| 5501 |
*os << "never matches"; |
| 5502 |
} |
| 5503 |
}; |
| 5504 |
|
| 5505 |
|
| 5506 |
|
| 5507 |
|
| 5508 |
|
| 5509 |
class AnythingMatcher { |
| 5510 |
public: |
| 5511 |
template <typename T> |
| 5512 |
operator Matcher<T>() const { return A<T>(); } |
| 5513 |
}; |
| 5514 |
|
| 5515 |
|
| 5516 |
|
| 5517 |
|
| 5518 |
|
| 5519 |
|
| 5520 |
|
| 5521 |
|
| 5522 |
|
| 5523 |
|
| 5524 |
|
| 5525 |
|
| 5526 |
|
| 5527 |
|
| 5528 |
#define GMOCK_IMPLEMENT_COMPARISON_MATCHER_( \ |
| 5529 |
name, op, relation, negated_relation) \ |
| 5530 |
template <typename Rhs> class name##Matcher { \ |
| 5531 |
public: \ |
| 5532 |
explicit name##Matcher(const Rhs& rhs) : rhs_(rhs) {} \ |
| 5533 |
template <typename Lhs> \ |
| 5534 |
operator Matcher<Lhs>() const { \ |
| 5535 |
return MakeMatcher(new Impl<Lhs>(rhs_)); \ |
| 5536 |
} \ |
| 5537 |
private: \ |
| 5538 |
template <typename Lhs> \ |
| 5539 |
class Impl : public MatcherInterface<Lhs> { \ |
| 5540 |
public: \ |
| 5541 |
explicit Impl(const Rhs& rhs) : rhs_(rhs) {} \ |
| 5542 |
virtual bool MatchAndExplain(\ |
| 5543 |
Lhs lhs, MatchResultListener* ) const { \ |
| 5544 |
return lhs op rhs_; \ |
| 5545 |
} \ |
| 5546 |
virtual void DescribeTo(::std::ostream* os) const { \ |
| 5547 |
*os << relation " "; \ |
| 5548 |
UniversalPrint(rhs_, os); \ |
| 5549 |
} \ |
| 5550 |
virtual void DescribeNegationTo(::std::ostream* os) const { \ |
| 5551 |
*os << negated_relation " "; \ |
| 5552 |
UniversalPrint(rhs_, os); \ |
| 5553 |
} \ |
| 5554 |
private: \ |
| 5555 |
Rhs rhs_; \ |
| 5556 |
GTEST_DISALLOW_ASSIGN_(Impl); \ |
| 5557 |
}; \ |
| 5558 |
Rhs rhs_; \ |
| 5559 |
GTEST_DISALLOW_ASSIGN_(name##Matcher); \ |
| 5560 |
} |
| 5561 |
|
| 5562 |
|
| 5563 |
|
| 5564 |
GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Eq, ==, "is equal to", "isn't equal to"); |
| 5565 |
GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Ge, >=, "is >=", "isn't >="); |
| 5566 |
GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Gt, >, "is >", "isn't >"); |
| 5567 |
GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Le, <=, "is <=", "isn't <="); |
| 5568 |
GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Lt, <, "is <", "isn't <"); |
| 5569 |
GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Ne, !=, "isn't equal to", "is equal to"); |
| 5570 |
|
| 5571 |
#undef GMOCK_IMPLEMENT_COMPARISON_MATCHER_ |
| 5572 |
|
| 5573 |
|
| 5574 |
|
| 5575 |
class IsNullMatcher { |
| 5576 |
public: |
| 5577 |
template <typename Pointer> |
| 5578 |
bool MatchAndExplain(const Pointer& p, |
| 5579 |
MatchResultListener* ) const { |
| 5580 |
return GetRawPointer(p) == NULL; |
| 5581 |
} |
| 5582 |
|
| 5583 |
void DescribeTo(::std::ostream* os) const { *os << "is NULL"; } |
| 5584 |
void DescribeNegationTo(::std::ostream* os) const { |
| 5585 |
*os << "isn't NULL"; |
| 5586 |
} |
| 5587 |
}; |
| 5588 |
|
| 5589 |
|
| 5590 |
|
| 5591 |
class NotNullMatcher { |
| 5592 |
public: |
| 5593 |
template <typename Pointer> |
| 5594 |
bool MatchAndExplain(const Pointer& p, |
| 5595 |
MatchResultListener* ) const { |
| 5596 |
return GetRawPointer(p) != NULL; |
| 5597 |
} |
| 5598 |
|
| 5599 |
void DescribeTo(::std::ostream* os) const { *os << "isn't NULL"; } |
| 5600 |
void DescribeNegationTo(::std::ostream* os) const { |
| 5601 |
*os << "is NULL"; |
| 5602 |
} |
| 5603 |
}; |
| 5604 |
|
| 5605 |
|
| 5606 |
|
| 5607 |
|
| 5608 |
|
| 5609 |
|
| 5610 |
|
| 5611 |
|
| 5612 |
|
| 5613 |
|
| 5614 |
|
| 5615 |
|
| 5616 |
|
| 5617 |
|
| 5618 |
template <typename T> |
| 5619 |
class RefMatcher; |
| 5620 |
|
| 5621 |
template <typename T> |
| 5622 |
class RefMatcher<T&> { |
| 5623 |
|
| 5624 |
|
| 5625 |
|
| 5626 |
|
| 5627 |
|
| 5628 |
public: |
| 5629 |
|
| 5630 |
|
| 5631 |
|
| 5632 |
explicit RefMatcher(T& x) : object_(x) {} |
| 5633 |
|
| 5634 |
template <typename Super> |
| 5635 |
operator Matcher<Super&>() const { |
| 5636 |
|
| 5637 |
|
| 5638 |
|
| 5639 |
|
| 5640 |
|
| 5641 |
return MakeMatcher(new Impl<Super>(object_)); |
| 5642 |
} |
| 5643 |
|
| 5644 |
private: |
| 5645 |
template <typename Super> |
| 5646 |
class Impl : public MatcherInterface<Super&> { |
| 5647 |
public: |
| 5648 |
explicit Impl(Super& x) : object_(x) {} |
| 5649 |
|
| 5650 |
|
| 5651 |
|
| 5652 |
virtual bool MatchAndExplain( |
| 5653 |
Super& x, MatchResultListener* listener) const { |
| 5654 |
*listener << "which is located @" << static_cast<const void*>(&x); |
| 5655 |
return &x == &object_; |
| 5656 |
} |
| 5657 |
|
| 5658 |
virtual void DescribeTo(::std::ostream* os) const { |
| 5659 |
*os << "references the variable "; |
| 5660 |
UniversalPrinter<Super&>::Print(object_, os); |
| 5661 |
} |
| 5662 |
|
| 5663 |
virtual void DescribeNegationTo(::std::ostream* os) const { |
| 5664 |
*os << "does not reference the variable "; |
| 5665 |
UniversalPrinter<Super&>::Print(object_, os); |
| 5666 |
} |
| 5667 |
|
| 5668 |
private: |
| 5669 |
const Super& object_; |
| 5670 |
|
| 5671 |
GTEST_DISALLOW_ASSIGN_(Impl); |
| 5672 |
}; |
| 5673 |
|
| 5674 |
T& object_; |
| 5675 |
|
| 5676 |
GTEST_DISALLOW_ASSIGN_(RefMatcher); |
| 5677 |
}; |
| 5678 |
|
| 5679 |
|
| 5680 |
inline bool CaseInsensitiveCStringEquals(const char* lhs, const char* rhs) { |
| 5681 |
return String::CaseInsensitiveCStringEquals(lhs, rhs); |
| 5682 |
} |
| 5683 |
|
| 5684 |
inline bool CaseInsensitiveCStringEquals(const wchar_t* lhs, |
| 5685 |
const wchar_t* rhs) { |
| 5686 |
return String::CaseInsensitiveWideCStringEquals(lhs, rhs); |
| 5687 |
} |
| 5688 |
|
| 5689 |
|
| 5690 |
|
| 5691 |
template <typename StringType> |
| 5692 |
bool CaseInsensitiveStringEquals(const StringType& s1, |
| 5693 |
const StringType& s2) { |
| 5694 |
|
| 5695 |
if (!CaseInsensitiveCStringEquals(s1.c_str(), s2.c_str())) { |
| 5696 |
return false; |
| 5697 |
} |
| 5698 |
|
| 5699 |
|
| 5700 |
const typename StringType::value_type nul = 0; |
| 5701 |
const size_t i1 = s1.find(nul), i2 = s2.find(nul); |
| 5702 |
|
| 5703 |
|
| 5704 |
if (i1 == StringType::npos || i2 == StringType::npos) { |
| 5705 |
return i1 == i2; |
| 5706 |
} |
| 5707 |
|
| 5708 |
|
| 5709 |
return CaseInsensitiveStringEquals(s1.substr(i1 + 1), s2.substr(i2 + 1)); |
| 5710 |
} |
| 5711 |
|
| 5712 |
|
| 5713 |
|
| 5714 |
|
| 5715 |
template <typename StringType> |
| 5716 |
class StrEqualityMatcher { |
| 5717 |
public: |
| 5718 |
StrEqualityMatcher(const StringType& str, bool expect_eq, |
| 5719 |
bool case_sensitive) |
| 5720 |
: string_(str), expect_eq_(expect_eq), case_sensitive_(case_sensitive) {} |
| 5721 |
|
| 5722 |
|
| 5723 |
|
| 5724 |
|
| 5725 |
|
| 5726 |
|
| 5727 |
template <typename CharType> |
| 5728 |
bool MatchAndExplain(CharType* s, MatchResultListener* listener) const { |
| 5729 |
if (s == NULL) { |
| 5730 |
return !expect_eq_; |
| 5731 |
} |
| 5732 |
return MatchAndExplain(StringType(s), listener); |
| 5733 |
} |
| 5734 |
|
| 5735 |
|
| 5736 |
|
| 5737 |
|
| 5738 |
|
| 5739 |
template <typename MatcheeStringType> |
| 5740 |
bool MatchAndExplain(const MatcheeStringType& s, |
| 5741 |
MatchResultListener* ) const { |
| 5742 |
const StringType& s2(s); |
| 5743 |
const bool eq = case_sensitive_ ? s2 == string_ : |
| 5744 |
CaseInsensitiveStringEquals(s2, string_); |
| 5745 |
return expect_eq_ == eq; |
| 5746 |
} |
| 5747 |
|
| 5748 |
void DescribeTo(::std::ostream* os) const { |
| 5749 |
DescribeToHelper(expect_eq_, os); |
| 5750 |
} |
| 5751 |
|
| 5752 |
void DescribeNegationTo(::std::ostream* os) const { |
| 5753 |
DescribeToHelper(!expect_eq_, os); |
| 5754 |
} |
| 5755 |
|
| 5756 |
private: |
| 5757 |
void DescribeToHelper(bool expect_eq, ::std::ostream* os) const { |
| 5758 |
*os << (expect_eq ? "is " : "isn't "); |
| 5759 |
*os << "equal to "; |
| 5760 |
if (!case_sensitive_) { |
| 5761 |
*os << "(ignoring case) "; |
| 5762 |
} |
| 5763 |
UniversalPrint(string_, os); |
| 5764 |
} |
| 5765 |
|
| 5766 |
const StringType string_; |
| 5767 |
const bool expect_eq_; |
| 5768 |
const bool case_sensitive_; |
| 5769 |
|
| 5770 |
GTEST_DISALLOW_ASSIGN_(StrEqualityMatcher); |
| 5771 |
}; |
| 5772 |
|
| 5773 |
|
| 5774 |
|
| 5775 |
|
| 5776 |
template <typename StringType> |
| 5777 |
class HasSubstrMatcher { |
| 5778 |
public: |
| 5779 |
explicit HasSubstrMatcher(const StringType& substring) |
| 5780 |
: substring_(substring) {} |
| 5781 |
|
| 5782 |
|
| 5783 |
|
| 5784 |
|
| 5785 |
|
| 5786 |
|
| 5787 |
template <typename CharType> |
| 5788 |
bool MatchAndExplain(CharType* s, MatchResultListener* listener) const { |
| 5789 |
return s != NULL && MatchAndExplain(StringType(s), listener); |
| 5790 |
} |
| 5791 |
|
| 5792 |
|
| 5793 |
|
| 5794 |
|
| 5795 |
|
| 5796 |
template <typename MatcheeStringType> |
| 5797 |
bool MatchAndExplain(const MatcheeStringType& s, |
| 5798 |
MatchResultListener* ) const { |
| 5799 |
const StringType& s2(s); |
| 5800 |
return s2.find(substring_) != StringType::npos; |
| 5801 |
} |
| 5802 |
|
| 5803 |
|
| 5804 |
void DescribeTo(::std::ostream* os) const { |
| 5805 |
*os << "has substring "; |
| 5806 |
UniversalPrint(substring_, os); |
| 5807 |
} |
| 5808 |
|
| 5809 |
void DescribeNegationTo(::std::ostream* os) const { |
| 5810 |
*os << "has no substring "; |
| 5811 |
UniversalPrint(substring_, os); |
| 5812 |
} |
| 5813 |
|
| 5814 |
private: |
| 5815 |
const StringType substring_; |
| 5816 |
|
| 5817 |
GTEST_DISALLOW_ASSIGN_(HasSubstrMatcher); |
| 5818 |
}; |
| 5819 |
|
| 5820 |
|
| 5821 |
|
| 5822 |
|
| 5823 |
template <typename StringType> |
| 5824 |
class StartsWithMatcher { |
| 5825 |
public: |
| 5826 |
explicit StartsWithMatcher(const StringType& prefix) : prefix_(prefix) { |
| 5827 |
} |
| 5828 |
|
| 5829 |
|
| 5830 |
|
| 5831 |
|
| 5832 |
|
| 5833 |
|
| 5834 |
template <typename CharType> |
| 5835 |
bool MatchAndExplain(CharType* s, MatchResultListener* listener) const { |
| 5836 |
return s != NULL && MatchAndExplain(StringType(s), listener); |
| 5837 |
} |
| 5838 |
|
| 5839 |
|
| 5840 |
|
| 5841 |
|
| 5842 |
|
| 5843 |
template <typename MatcheeStringType> |
| 5844 |
bool MatchAndExplain(const MatcheeStringType& s, |
| 5845 |
MatchResultListener* ) const { |
| 5846 |
const StringType& s2(s); |
| 5847 |
return s2.length() >= prefix_.length() && |
| 5848 |
s2.substr(0, prefix_.length()) == prefix_; |
| 5849 |
} |
| 5850 |
|
| 5851 |
void DescribeTo(::std::ostream* os) const { |
| 5852 |
*os << "starts with "; |
| 5853 |
UniversalPrint(prefix_, os); |
| 5854 |
} |
| 5855 |
|
| 5856 |
void DescribeNegationTo(::std::ostream* os) const { |
| 5857 |
*os << "doesn't start with "; |
| 5858 |
UniversalPrint(prefix_, os); |
| 5859 |
} |
| 5860 |
|
| 5861 |
private: |
| 5862 |
const StringType prefix_; |
| 5863 |
|
| 5864 |
GTEST_DISALLOW_ASSIGN_(StartsWithMatcher); |
| 5865 |
}; |
| 5866 |
|
| 5867 |
|
| 5868 |
|
| 5869 |
|
| 5870 |
template <typename StringType> |
| 5871 |
class EndsWithMatcher { |
| 5872 |
public: |
| 5873 |
explicit EndsWithMatcher(const StringType& suffix) : suffix_(suffix) {} |
| 5874 |
|
| 5875 |
|
| 5876 |
|
| 5877 |
|
| 5878 |
|
| 5879 |
|
| 5880 |
template <typename CharType> |
| 5881 |
bool MatchAndExplain(CharType* s, MatchResultListener* listener) const { |
| 5882 |
return s != NULL && MatchAndExplain(StringType(s), listener); |
| 5883 |
} |
| 5884 |
|
| 5885 |
|
| 5886 |
|
| 5887 |
|
| 5888 |
|
| 5889 |
template <typename MatcheeStringType> |
| 5890 |
bool MatchAndExplain(const MatcheeStringType& s, |
| 5891 |
MatchResultListener* ) const { |
| 5892 |
const StringType& s2(s); |
| 5893 |
return s2.length() >= suffix_.length() && |
| 5894 |
s2.substr(s2.length() - suffix_.length()) == suffix_; |
| 5895 |
} |
| 5896 |
|
| 5897 |
void DescribeTo(::std::ostream* os) const { |
| 5898 |
*os << "ends with "; |
| 5899 |
UniversalPrint(suffix_, os); |
| 5900 |
} |
| 5901 |
|
| 5902 |
void DescribeNegationTo(::std::ostream* os) const { |
| 5903 |
*os << "doesn't end with "; |
| 5904 |
UniversalPrint(suffix_, os); |
| 5905 |
} |
| 5906 |
|
| 5907 |
private: |
| 5908 |
const StringType suffix_; |
| 5909 |
|
| 5910 |
GTEST_DISALLOW_ASSIGN_(EndsWithMatcher); |
| 5911 |
}; |
| 5912 |
|
| 5913 |
|
| 5914 |
|
| 5915 |
|
| 5916 |
class MatchesRegexMatcher { |
| 5917 |
public: |
| 5918 |
MatchesRegexMatcher(const RE* regex, bool full_match) |
| 5919 |
: regex_(regex), full_match_(full_match) {} |
| 5920 |
|
| 5921 |
|
| 5922 |
|
| 5923 |
|
| 5924 |
|
| 5925 |
|
| 5926 |
template <typename CharType> |
| 5927 |
bool MatchAndExplain(CharType* s, MatchResultListener* listener) const { |
| 5928 |
return s != NULL && MatchAndExplain(internal::string(s), listener); |
| 5929 |
} |
| 5930 |
|
| 5931 |
|
| 5932 |
|
| 5933 |
|
| 5934 |
|
| 5935 |
template <class MatcheeStringType> |
| 5936 |
bool MatchAndExplain(const MatcheeStringType& s, |
| 5937 |
MatchResultListener* ) const { |
| 5938 |
const internal::string& s2(s); |
| 5939 |
return full_match_ ? RE::FullMatch(s2, *regex_) : |
| 5940 |
RE::PartialMatch(s2, *regex_); |
| 5941 |
} |
| 5942 |
|
| 5943 |
void DescribeTo(::std::ostream* os) const { |
| 5944 |
*os << (full_match_ ? "matches" : "contains") |
| 5945 |
<< " regular expression "; |
| 5946 |
UniversalPrinter<internal::string>::Print(regex_->pattern(), os); |
| 5947 |
} |
| 5948 |
|
| 5949 |
void DescribeNegationTo(::std::ostream* os) const { |
| 5950 |
*os << "doesn't " << (full_match_ ? "match" : "contain") |
| 5951 |
<< " regular expression "; |
| 5952 |
UniversalPrinter<internal::string>::Print(regex_->pattern(), os); |
| 5953 |
} |
| 5954 |
|
| 5955 |
private: |
| 5956 |
const internal::linked_ptr<const RE> regex_; |
| 5957 |
const bool full_match_; |
| 5958 |
|
| 5959 |
GTEST_DISALLOW_ASSIGN_(MatchesRegexMatcher); |
| 5960 |
}; |
| 5961 |
|
| 5962 |
|
| 5963 |
|
| 5964 |
|
| 5965 |
|
| 5966 |
|
| 5967 |
|
| 5968 |
|
| 5969 |
|
| 5970 |
|
| 5971 |
|
| 5972 |
|
| 5973 |
#define GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(name, op, relation) \ |
| 5974 |
class name##2Matcher { \ |
| 5975 |
public: \ |
| 5976 |
template <typename T1, typename T2> \ |
| 5977 |
operator Matcher< ::std::tr1::tuple<T1, T2> >() const { \ |
| 5978 |
return MakeMatcher(new Impl< ::std::tr1::tuple<T1, T2> >); \ |
| 5979 |
} \ |
| 5980 |
template <typename T1, typename T2> \ |
| 5981 |
operator Matcher<const ::std::tr1::tuple<T1, T2>&>() const { \ |
| 5982 |
return MakeMatcher(new Impl<const ::std::tr1::tuple<T1, T2>&>); \ |
| 5983 |
} \ |
| 5984 |
private: \ |
| 5985 |
template <typename Tuple> \ |
| 5986 |
class Impl : public MatcherInterface<Tuple> { \ |
| 5987 |
public: \ |
| 5988 |
virtual bool MatchAndExplain( \ |
| 5989 |
Tuple args, \ |
| 5990 |
MatchResultListener* ) const { \ |
| 5991 |
return ::std::tr1::get<0>(args) op ::std::tr1::get<1>(args); \ |
| 5992 |
} \ |
| 5993 |
virtual void DescribeTo(::std::ostream* os) const { \ |
| 5994 |
*os << "are " relation; \ |
| 5995 |
} \ |
| 5996 |
virtual void DescribeNegationTo(::std::ostream* os) const { \ |
| 5997 |
*os << "aren't " relation; \ |
| 5998 |
} \ |
| 5999 |
}; \ |
| 6000 |
} |
| 6001 |
|
| 6002 |
|
| 6003 |
GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(Eq, ==, "an equal pair"); |
| 6004 |
GMOCK_IMPLEMENT_COMPARISON2_MATCHER_( |
| 6005 |
Ge, >=, "a pair where the first >= the second"); |
| 6006 |
GMOCK_IMPLEMENT_COMPARISON2_MATCHER_( |
| 6007 |
Gt, >, "a pair where the first > the second"); |
| 6008 |
GMOCK_IMPLEMENT_COMPARISON2_MATCHER_( |
| 6009 |
Le, <=, "a pair where the first <= the second"); |
| 6010 |
GMOCK_IMPLEMENT_COMPARISON2_MATCHER_( |
| 6011 |
Lt, <, "a pair where the first < the second"); |
| 6012 |
GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(Ne, !=, "an unequal pair"); |
| 6013 |
|
| 6014 |
#undef GMOCK_IMPLEMENT_COMPARISON2_MATCHER_ |
| 6015 |
|
| 6016 |
|
| 6017 |
|
| 6018 |
|
| 6019 |
|
| 6020 |
template <typename T> |
| 6021 |
class NotMatcherImpl : public MatcherInterface<T> { |
| 6022 |
public: |
| 6023 |
explicit NotMatcherImpl(const Matcher<T>& matcher) |
| 6024 |
: matcher_(matcher) {} |
| 6025 |
|
| 6026 |
virtual bool MatchAndExplain(T x, MatchResultListener* listener) const { |
| 6027 |
return !matcher_.MatchAndExplain(x, listener); |
| 6028 |
} |
| 6029 |
|
| 6030 |
virtual void DescribeTo(::std::ostream* os) const { |
| 6031 |
matcher_.DescribeNegationTo(os); |
| 6032 |
} |
| 6033 |
|
| 6034 |
virtual void DescribeNegationTo(::std::ostream* os) const { |
| 6035 |
matcher_.DescribeTo(os); |
| 6036 |
} |
| 6037 |
|
| 6038 |
private: |
| 6039 |
const Matcher<T> matcher_; |
| 6040 |
|
| 6041 |
GTEST_DISALLOW_ASSIGN_(NotMatcherImpl); |
| 6042 |
}; |
| 6043 |
|
| 6044 |
|
| 6045 |
|
| 6046 |
template <typename InnerMatcher> |
| 6047 |
class NotMatcher { |
| 6048 |
public: |
| 6049 |
explicit NotMatcher(InnerMatcher matcher) : matcher_(matcher) {} |
| 6050 |
|
| 6051 |
|
| 6052 |
|
| 6053 |
template <typename T> |
| 6054 |
operator Matcher<T>() const { |
| 6055 |
return Matcher<T>(new NotMatcherImpl<T>(SafeMatcherCast<T>(matcher_))); |
| 6056 |
} |
| 6057 |
|
| 6058 |
private: |
| 6059 |
InnerMatcher matcher_; |
| 6060 |
|
| 6061 |
GTEST_DISALLOW_ASSIGN_(NotMatcher); |
| 6062 |
}; |
| 6063 |
|
| 6064 |
|
| 6065 |
|
| 6066 |
|
| 6067 |
|
| 6068 |
template <typename T> |
| 6069 |
class BothOfMatcherImpl : public MatcherInterface<T> { |
| 6070 |
public: |
| 6071 |
BothOfMatcherImpl(const Matcher<T>& matcher1, const Matcher<T>& matcher2) |
| 6072 |
: matcher1_(matcher1), matcher2_(matcher2) {} |
| 6073 |
|
| 6074 |
virtual void DescribeTo(::std::ostream* os) const { |
| 6075 |
*os << "("; |
| 6076 |
matcher1_.DescribeTo(os); |
| 6077 |
*os << ") and ("; |
| 6078 |
matcher2_.DescribeTo(os); |
| 6079 |
*os << ")"; |
| 6080 |
} |
| 6081 |
|
| 6082 |
virtual void DescribeNegationTo(::std::ostream* os) const { |
| 6083 |
*os << "("; |
| 6084 |
matcher1_.DescribeNegationTo(os); |
| 6085 |
*os << ") or ("; |
| 6086 |
matcher2_.DescribeNegationTo(os); |
| 6087 |
*os << ")"; |
| 6088 |
} |
| 6089 |
|
| 6090 |
virtual bool MatchAndExplain(T x, MatchResultListener* listener) const { |
| 6091 |
|
| 6092 |
|
| 6093 |
StringMatchResultListener listener1; |
| 6094 |
if (!matcher1_.MatchAndExplain(x, &listener1)) { |
| 6095 |
*listener << listener1.str(); |
| 6096 |
return false; |
| 6097 |
} |
| 6098 |
|
| 6099 |
StringMatchResultListener listener2; |
| 6100 |
if (!matcher2_.MatchAndExplain(x, &listener2)) { |
| 6101 |
*listener << listener2.str(); |
| 6102 |
return false; |
| 6103 |
} |
| 6104 |
|
| 6105 |
|
| 6106 |
const internal::string s1 = listener1.str(); |
| 6107 |
const internal::string s2 = listener2.str(); |
| 6108 |
|
| 6109 |
if (s1 == "") { |
| 6110 |
*listener << s2; |
| 6111 |
} else { |
| 6112 |
*listener << s1; |
| 6113 |
if (s2 != "") { |
| 6114 |
*listener << ", and " << s2; |
| 6115 |
} |
| 6116 |
} |
| 6117 |
return true; |
| 6118 |
} |
| 6119 |
|
| 6120 |
private: |
| 6121 |
const Matcher<T> matcher1_; |
| 6122 |
const Matcher<T> matcher2_; |
| 6123 |
|
| 6124 |
GTEST_DISALLOW_ASSIGN_(BothOfMatcherImpl); |
| 6125 |
}; |
| 6126 |
|
| 6127 |
#if GTEST_LANG_CXX11 |
| 6128 |
|
| 6129 |
|
| 6130 |
|
| 6131 |
|
| 6132 |
|
| 6133 |
|
| 6134 |
|
| 6135 |
template <int kSize, typename Head, typename... Tail> |
| 6136 |
struct MatcherList { |
| 6137 |
typedef MatcherList<kSize - 1, Tail...> MatcherListTail; |
| 6138 |
typedef ::std::pair<Head, typename MatcherListTail::ListType> ListType; |
| 6139 |
|
| 6140 |
|
| 6141 |
|
| 6142 |
|
| 6143 |
|
| 6144 |
static ListType BuildList(const Head& matcher, const Tail&... tail) { |
| 6145 |
return ListType(matcher, MatcherListTail::BuildList(tail...)); |
| 6146 |
} |
| 6147 |
|
| 6148 |
|
| 6149 |
|
| 6150 |
|
| 6151 |
|
| 6152 |
template <typename T, template <typename > class CombiningMatcher> |
| 6153 |
static Matcher<T> CreateMatcher(const ListType& matchers) { |
| 6154 |
return Matcher<T>(new CombiningMatcher<T>( |
| 6155 |
SafeMatcherCast<T>(matchers.first), |
| 6156 |
MatcherListTail::template CreateMatcher<T, CombiningMatcher>( |
| 6157 |
matchers.second))); |
| 6158 |
} |
| 6159 |
}; |
| 6160 |
|
| 6161 |
|
| 6162 |
|
| 6163 |
template <typename Matcher1, typename Matcher2> |
| 6164 |
struct MatcherList<2, Matcher1, Matcher2> { |
| 6165 |
typedef ::std::pair<Matcher1, Matcher2> ListType; |
| 6166 |
|
| 6167 |
static ListType BuildList(const Matcher1& matcher1, |
| 6168 |
const Matcher2& matcher2) { |
| 6169 |
return ::std::pair<Matcher1, Matcher2>(matcher1, matcher2); |
| 6170 |
} |
| 6171 |
|
| 6172 |
template <typename T, template <typename > class CombiningMatcher> |
| 6173 |
static Matcher<T> CreateMatcher(const ListType& matchers) { |
| 6174 |
return Matcher<T>(new CombiningMatcher<T>( |
| 6175 |
SafeMatcherCast<T>(matchers.first), |
| 6176 |
SafeMatcherCast<T>(matchers.second))); |
| 6177 |
} |
| 6178 |
}; |
| 6179 |
|
| 6180 |
|
| 6181 |
|
| 6182 |
|
| 6183 |
|
| 6184 |
template <template <typename T> class CombiningMatcher, typename... Args> |
| 6185 |
class VariadicMatcher { |
| 6186 |
public: |
| 6187 |
VariadicMatcher(const Args&... matchers) |
| 6188 |
: matchers_(MatcherListType::BuildList(matchers...)) {} |
| 6189 |
|
| 6190 |
|
| 6191 |
|
| 6192 |
|
| 6193 |
template <typename T> |
| 6194 |
operator Matcher<T>() const { |
| 6195 |
return MatcherListType::template CreateMatcher<T, CombiningMatcher>( |
| 6196 |
matchers_); |
| 6197 |
} |
| 6198 |
|
| 6199 |
private: |
| 6200 |
typedef MatcherList<sizeof...(Args), Args...> MatcherListType; |
| 6201 |
|
| 6202 |
const typename MatcherListType::ListType matchers_; |
| 6203 |
|
| 6204 |
GTEST_DISALLOW_ASSIGN_(VariadicMatcher); |
| 6205 |
}; |
| 6206 |
|
| 6207 |
template <typename... Args> |
| 6208 |
using AllOfMatcher = VariadicMatcher<BothOfMatcherImpl, Args...>; |
| 6209 |
|
| 6210 |
#endif |
| 6211 |
|
| 6212 |
|
| 6213 |
|
| 6214 |
template <typename Matcher1, typename Matcher2> |
| 6215 |
class BothOfMatcher { |
| 6216 |
public: |
| 6217 |
BothOfMatcher(Matcher1 matcher1, Matcher2 matcher2) |
| 6218 |
: matcher1_(matcher1), matcher2_(matcher2) {} |
| 6219 |
|
| 6220 |
|
| 6221 |
|
| 6222 |
|
| 6223 |
template <typename T> |
| 6224 |
operator Matcher<T>() const { |
| 6225 |
return Matcher<T>(new BothOfMatcherImpl<T>(SafeMatcherCast<T>(matcher1_), |
| 6226 |
SafeMatcherCast<T>(matcher2_))); |
| 6227 |
} |
| 6228 |
|
| 6229 |
private: |
| 6230 |
Matcher1 matcher1_; |
| 6231 |
Matcher2 matcher2_; |
| 6232 |
|
| 6233 |
GTEST_DISALLOW_ASSIGN_(BothOfMatcher); |
| 6234 |
}; |
| 6235 |
|
| 6236 |
|
| 6237 |
|
| 6238 |
|
| 6239 |
|
| 6240 |
template <typename T> |
| 6241 |
class EitherOfMatcherImpl : public MatcherInterface<T> { |
| 6242 |
public: |
| 6243 |
EitherOfMatcherImpl(const Matcher<T>& matcher1, const Matcher<T>& matcher2) |
| 6244 |
: matcher1_(matcher1), matcher2_(matcher2) {} |
| 6245 |
|
| 6246 |
virtual void DescribeTo(::std::ostream* os) const { |
| 6247 |
*os << "("; |
| 6248 |
matcher1_.DescribeTo(os); |
| 6249 |
*os << ") or ("; |
| 6250 |
matcher2_.DescribeTo(os); |
| 6251 |
*os << ")"; |
| 6252 |
} |
| 6253 |
|
| 6254 |
virtual void DescribeNegationTo(::std::ostream* os) const { |
| 6255 |
*os << "("; |
| 6256 |
matcher1_.DescribeNegationTo(os); |
| 6257 |
*os << ") and ("; |
| 6258 |
matcher2_.DescribeNegationTo(os); |
| 6259 |
*os << ")"; |
| 6260 |
} |
| 6261 |
|
| 6262 |
virtual bool MatchAndExplain(T x, MatchResultListener* listener) const { |
| 6263 |
|
| 6264 |
|
| 6265 |
StringMatchResultListener listener1; |
| 6266 |
if (matcher1_.MatchAndExplain(x, &listener1)) { |
| 6267 |
*listener << listener1.str(); |
| 6268 |
return true; |
| 6269 |
} |
| 6270 |
|
| 6271 |
StringMatchResultListener listener2; |
| 6272 |
if (matcher2_.MatchAndExplain(x, &listener2)) { |
| 6273 |
*listener << listener2.str(); |
| 6274 |
return true; |
| 6275 |
} |
| 6276 |
|
| 6277 |
|
| 6278 |
const internal::string s1 = listener1.str(); |
| 6279 |
const internal::string s2 = listener2.str(); |
| 6280 |
|
| 6281 |
if (s1 == "") { |
| 6282 |
*listener << s2; |
| 6283 |
} else { |
| 6284 |
*listener << s1; |
| 6285 |
if (s2 != "") { |
| 6286 |
*listener << ", and " << s2; |
| 6287 |
} |
| 6288 |
} |
| 6289 |
return false; |
| 6290 |
} |
| 6291 |
|
| 6292 |
private: |
| 6293 |
const Matcher<T> matcher1_; |
| 6294 |
const Matcher<T> matcher2_; |
| 6295 |
|
| 6296 |
GTEST_DISALLOW_ASSIGN_(EitherOfMatcherImpl); |
| 6297 |
}; |
| 6298 |
|
| 6299 |
#if GTEST_LANG_CXX11 |
| 6300 |
|
| 6301 |
template <typename... Args> |
| 6302 |
using AnyOfMatcher = VariadicMatcher<EitherOfMatcherImpl, Args...>; |
| 6303 |
|
| 6304 |
#endif |
| 6305 |
|
| 6306 |
|
| 6307 |
|
| 6308 |
|
| 6309 |
template <typename Matcher1, typename Matcher2> |
| 6310 |
class EitherOfMatcher { |
| 6311 |
public: |
| 6312 |
EitherOfMatcher(Matcher1 matcher1, Matcher2 matcher2) |
| 6313 |
: matcher1_(matcher1), matcher2_(matcher2) {} |
| 6314 |
|
| 6315 |
|
| 6316 |
|
| 6317 |
|
| 6318 |
template <typename T> |
| 6319 |
operator Matcher<T>() const { |
| 6320 |
return Matcher<T>(new EitherOfMatcherImpl<T>( |
| 6321 |
SafeMatcherCast<T>(matcher1_), SafeMatcherCast<T>(matcher2_))); |
| 6322 |
} |
| 6323 |
|
| 6324 |
private: |
| 6325 |
Matcher1 matcher1_; |
| 6326 |
Matcher2 matcher2_; |
| 6327 |
|
| 6328 |
GTEST_DISALLOW_ASSIGN_(EitherOfMatcher); |
| 6329 |
}; |
| 6330 |
|
| 6331 |
|
| 6332 |
|
| 6333 |
template <typename Predicate> |
| 6334 |
class TrulyMatcher { |
| 6335 |
public: |
| 6336 |
explicit TrulyMatcher(Predicate pred) : predicate_(pred) {} |
| 6337 |
|
| 6338 |
|
| 6339 |
|
| 6340 |
|
| 6341 |
|
| 6342 |
template <typename T> |
| 6343 |
bool MatchAndExplain(T& x, |
| 6344 |
MatchResultListener* ) const { |
| 6345 |
|
| 6346 |
|
| 6347 |
|
| 6348 |
|
| 6349 |
|
| 6350 |
|
| 6351 |
if (predicate_(x)) |
| 6352 |
return true; |
| 6353 |
return false; |
| 6354 |
} |
| 6355 |
|
| 6356 |
void DescribeTo(::std::ostream* os) const { |
| 6357 |
*os << "satisfies the given predicate"; |
| 6358 |
} |
| 6359 |
|
| 6360 |
void DescribeNegationTo(::std::ostream* os) const { |
| 6361 |
*os << "doesn't satisfy the given predicate"; |
| 6362 |
} |
| 6363 |
|
| 6364 |
private: |
| 6365 |
Predicate predicate_; |
| 6366 |
|
| 6367 |
GTEST_DISALLOW_ASSIGN_(TrulyMatcher); |
| 6368 |
}; |
| 6369 |
|
| 6370 |
|
| 6371 |
|
| 6372 |
template <typename M> |
| 6373 |
class MatcherAsPredicate { |
| 6374 |
public: |
| 6375 |
explicit MatcherAsPredicate(M matcher) : matcher_(matcher) {} |
| 6376 |
|
| 6377 |
|
| 6378 |
|
| 6379 |
|
| 6380 |
|
| 6381 |
|
| 6382 |
|
| 6383 |
template <typename T> |
| 6384 |
bool operator()(const T& x) const { |
| 6385 |
|
| 6386 |
|
| 6387 |
|
| 6388 |
|
| 6389 |
|
| 6390 |
|
| 6391 |
|
| 6392 |
|
| 6393 |
|
| 6394 |
|
| 6395 |
|
| 6396 |
|
| 6397 |
|
| 6398 |
|
| 6399 |
return MatcherCast<const T&>(matcher_).Matches(x); |
| 6400 |
} |
| 6401 |
|
| 6402 |
private: |
| 6403 |
M matcher_; |
| 6404 |
|
| 6405 |
GTEST_DISALLOW_ASSIGN_(MatcherAsPredicate); |
| 6406 |
}; |
| 6407 |
|
| 6408 |
|
| 6409 |
|
| 6410 |
template <typename M> |
| 6411 |
class PredicateFormatterFromMatcher { |
| 6412 |
public: |
| 6413 |
explicit PredicateFormatterFromMatcher(const M& m) : matcher_(m) {} |
| 6414 |
|
| 6415 |
|
| 6416 |
|
| 6417 |
|
| 6418 |
template <typename T> |
| 6419 |
AssertionResult operator()(const char* value_text, const T& x) const { |
| 6420 |
|
| 6421 |
|
| 6422 |
|
| 6423 |
|
| 6424 |
|
| 6425 |
|
| 6426 |
|
| 6427 |
|
| 6428 |
|
| 6429 |
|
| 6430 |
|
| 6431 |
const Matcher<const T&> matcher = SafeMatcherCast<const T&>(matcher_); |
| 6432 |
StringMatchResultListener listener; |
| 6433 |
if (MatchPrintAndExplain(x, matcher, &listener)) |
| 6434 |
return AssertionSuccess(); |
| 6435 |
|
| 6436 |
::std::stringstream ss; |
| 6437 |
ss << "Value of: " << value_text << "\n" |
| 6438 |
<< "Expected: "; |
| 6439 |
matcher.DescribeTo(&ss); |
| 6440 |
ss << "\n Actual: " << listener.str(); |
| 6441 |
return AssertionFailure() << ss.str(); |
| 6442 |
} |
| 6443 |
|
| 6444 |
private: |
| 6445 |
const M matcher_; |
| 6446 |
|
| 6447 |
GTEST_DISALLOW_ASSIGN_(PredicateFormatterFromMatcher); |
| 6448 |
}; |
| 6449 |
|
| 6450 |
|
| 6451 |
|
| 6452 |
|
| 6453 |
template <typename M> |
| 6454 |
inline PredicateFormatterFromMatcher<M> |
| 6455 |
MakePredicateFormatterFromMatcher(const M& matcher) { |
| 6456 |
return PredicateFormatterFromMatcher<M>(matcher); |
| 6457 |
} |
| 6458 |
|
| 6459 |
|
| 6460 |
|
| 6461 |
|
| 6462 |
|
| 6463 |
template <typename FloatType> |
| 6464 |
class FloatingEqMatcher { |
| 6465 |
public: |
| 6466 |
|
| 6467 |
|
| 6468 |
|
| 6469 |
|
| 6470 |
|
| 6471 |
|
| 6472 |
FloatingEqMatcher(FloatType rhs, bool nan_eq_nan) : |
| 6473 |
rhs_(rhs), nan_eq_nan_(nan_eq_nan), max_abs_error_(-1) { |
| 6474 |
} |
| 6475 |
|
| 6476 |
|
| 6477 |
|
| 6478 |
|
| 6479 |
FloatingEqMatcher(FloatType rhs, bool nan_eq_nan, FloatType max_abs_error) : |
| 6480 |
rhs_(rhs), nan_eq_nan_(nan_eq_nan), max_abs_error_(max_abs_error) { |
| 6481 |
GTEST_CHECK_(max_abs_error >= 0) |
| 6482 |
<< ", where max_abs_error is" << max_abs_error; |
| 6483 |
} |
| 6484 |
|
| 6485 |
|
| 6486 |
template <typename T> |
| 6487 |
class Impl : public MatcherInterface<T> { |
| 6488 |
public: |
| 6489 |
Impl(FloatType rhs, bool nan_eq_nan, FloatType max_abs_error) : |
| 6490 |
rhs_(rhs), nan_eq_nan_(nan_eq_nan), max_abs_error_(max_abs_error) {} |
| 6491 |
|
| 6492 |
virtual bool MatchAndExplain(T value, |
| 6493 |
MatchResultListener* ) const { |
| 6494 |
const FloatingPoint<FloatType> lhs(value), rhs(rhs_); |
| 6495 |
|
| 6496 |
|
| 6497 |
if (lhs.is_nan() || rhs.is_nan()) { |
| 6498 |
if (lhs.is_nan() && rhs.is_nan()) { |
| 6499 |
return nan_eq_nan_; |
| 6500 |
} |
| 6501 |
|
| 6502 |
return false; |
| 6503 |
} |
| 6504 |
if (HasMaxAbsError()) { |
| 6505 |
|
| 6506 |
|
| 6507 |
|
| 6508 |
|
| 6509 |
return value == rhs_ || fabs(value - rhs_) <= max_abs_error_; |
| 6510 |
} else { |
| 6511 |
return lhs.AlmostEquals(rhs); |
| 6512 |
} |
| 6513 |
} |
| 6514 |
|
| 6515 |
virtual void DescribeTo(::std::ostream* os) const { |
| 6516 |
|
| 6517 |
|
| 6518 |
|
| 6519 |
const ::std::streamsize old_precision = os->precision( |
| 6520 |
::std::numeric_limits<FloatType>::digits10 + 2); |
| 6521 |
if (FloatingPoint<FloatType>(rhs_).is_nan()) { |
| 6522 |
if (nan_eq_nan_) { |
| 6523 |
*os << "is NaN"; |
| 6524 |
} else { |
| 6525 |
*os << "never matches"; |
| 6526 |
} |
| 6527 |
} else { |
| 6528 |
*os << "is approximately " << rhs_; |
| 6529 |
if (HasMaxAbsError()) { |
| 6530 |
*os << " (absolute error <= " << max_abs_error_ << ")"; |
| 6531 |
} |
| 6532 |
} |
| 6533 |
os->precision(old_precision); |
| 6534 |
} |
| 6535 |
|
| 6536 |
virtual void DescribeNegationTo(::std::ostream* os) const { |
| 6537 |
|
| 6538 |
const ::std::streamsize old_precision = os->precision( |
| 6539 |
::std::numeric_limits<FloatType>::digits10 + 2); |
| 6540 |
if (FloatingPoint<FloatType>(rhs_).is_nan()) { |
| 6541 |
if (nan_eq_nan_) { |
| 6542 |
*os << "isn't NaN"; |
| 6543 |
} else { |
| 6544 |
*os << "is anything"; |
| 6545 |
} |
| 6546 |
} else { |
| 6547 |
*os << "isn't approximately " << rhs_; |
| 6548 |
if (HasMaxAbsError()) { |
| 6549 |
*os << " (absolute error > " << max_abs_error_ << ")"; |
| 6550 |
} |
| 6551 |
} |
| 6552 |
|
| 6553 |
os->precision(old_precision); |
| 6554 |
} |
| 6555 |
|
| 6556 |
private: |
| 6557 |
bool HasMaxAbsError() const { |
| 6558 |
return max_abs_error_ >= 0; |
| 6559 |
} |
| 6560 |
|
| 6561 |
const FloatType rhs_; |
| 6562 |
const bool nan_eq_nan_; |
| 6563 |
|
| 6564 |
const FloatType max_abs_error_; |
| 6565 |
|
| 6566 |
GTEST_DISALLOW_ASSIGN_(Impl); |
| 6567 |
}; |
| 6568 |
|
| 6569 |
|
| 6570 |
|
| 6571 |
|
| 6572 |
|
| 6573 |
|
| 6574 |
|
| 6575 |
operator Matcher<FloatType>() const { |
| 6576 |
return MakeMatcher(new Impl<FloatType>(rhs_, nan_eq_nan_, max_abs_error_)); |
| 6577 |
} |
| 6578 |
|
| 6579 |
operator Matcher<const FloatType&>() const { |
| 6580 |
return MakeMatcher( |
| 6581 |
new Impl<const FloatType&>(rhs_, nan_eq_nan_, max_abs_error_)); |
| 6582 |
} |
| 6583 |
|
| 6584 |
operator Matcher<FloatType&>() const { |
| 6585 |
return MakeMatcher(new Impl<FloatType&>(rhs_, nan_eq_nan_, max_abs_error_)); |
| 6586 |
} |
| 6587 |
|
| 6588 |
private: |
| 6589 |
const FloatType rhs_; |
| 6590 |
const bool nan_eq_nan_; |
| 6591 |
|
| 6592 |
const FloatType max_abs_error_; |
| 6593 |
|
| 6594 |
GTEST_DISALLOW_ASSIGN_(FloatingEqMatcher); |
| 6595 |
}; |
| 6596 |
|
| 6597 |
|
| 6598 |
|
| 6599 |
template <typename InnerMatcher> |
| 6600 |
class PointeeMatcher { |
| 6601 |
public: |
| 6602 |
explicit PointeeMatcher(const InnerMatcher& matcher) : matcher_(matcher) {} |
| 6603 |
|
| 6604 |
|
| 6605 |
|
| 6606 |
|
| 6607 |
|
| 6608 |
|
| 6609 |
|
| 6610 |
|
| 6611 |
|
| 6612 |
template <typename Pointer> |
| 6613 |
operator Matcher<Pointer>() const { |
| 6614 |
return MakeMatcher(new Impl<Pointer>(matcher_)); |
| 6615 |
} |
| 6616 |
|
| 6617 |
private: |
| 6618 |
|
| 6619 |
template <typename Pointer> |
| 6620 |
class Impl : public MatcherInterface<Pointer> { |
| 6621 |
public: |
| 6622 |
typedef typename PointeeOf<GTEST_REMOVE_CONST_( |
| 6623 |
GTEST_REMOVE_REFERENCE_(Pointer))>::type Pointee; |
| 6624 |
|
| 6625 |
explicit Impl(const InnerMatcher& matcher) |
| 6626 |
: matcher_(MatcherCast<const Pointee&>(matcher)) {} |
| 6627 |
|
| 6628 |
virtual void DescribeTo(::std::ostream* os) const { |
| 6629 |
*os << "points to a value that "; |
| 6630 |
matcher_.DescribeTo(os); |
| 6631 |
} |
| 6632 |
|
| 6633 |
virtual void DescribeNegationTo(::std::ostream* os) const { |
| 6634 |
*os << "does not point to a value that "; |
| 6635 |
matcher_.DescribeTo(os); |
| 6636 |
} |
| 6637 |
|
| 6638 |
virtual bool MatchAndExplain(Pointer pointer, |
| 6639 |
MatchResultListener* listener) const { |
| 6640 |
if (GetRawPointer(pointer) == NULL) |
| 6641 |
return false; |
| 6642 |
|
| 6643 |
*listener << "which points to "; |
| 6644 |
return MatchPrintAndExplain(*pointer, matcher_, listener); |
| 6645 |
} |
| 6646 |
|
| 6647 |
private: |
| 6648 |
const Matcher<const Pointee&> matcher_; |
| 6649 |
|
| 6650 |
GTEST_DISALLOW_ASSIGN_(Impl); |
| 6651 |
}; |
| 6652 |
|
| 6653 |
const InnerMatcher matcher_; |
| 6654 |
|
| 6655 |
GTEST_DISALLOW_ASSIGN_(PointeeMatcher); |
| 6656 |
}; |
| 6657 |
|
| 6658 |
|
| 6659 |
|
| 6660 |
template <typename Class, typename FieldType> |
| 6661 |
class FieldMatcher { |
| 6662 |
public: |
| 6663 |
FieldMatcher(FieldType Class::*field, |
| 6664 |
const Matcher<const FieldType&>& matcher) |
| 6665 |
: field_(field), matcher_(matcher) {} |
| 6666 |
|
| 6667 |
void DescribeTo(::std::ostream* os) const { |
| 6668 |
*os << "is an object whose given field "; |
| 6669 |
matcher_.DescribeTo(os); |
| 6670 |
} |
| 6671 |
|
| 6672 |
void DescribeNegationTo(::std::ostream* os) const { |
| 6673 |
*os << "is an object whose given field "; |
| 6674 |
matcher_.DescribeNegationTo(os); |
| 6675 |
} |
| 6676 |
|
| 6677 |
template <typename T> |
| 6678 |
bool MatchAndExplain(const T& value, MatchResultListener* listener) const { |
| 6679 |
return MatchAndExplainImpl( |
| 6680 |
typename ::testing::internal:: |
| 6681 |
is_pointer<GTEST_REMOVE_CONST_(T)>::type(), |
| 6682 |
value, listener); |
| 6683 |
} |
| 6684 |
|
| 6685 |
private: |
| 6686 |
|
| 6687 |
|
| 6688 |
|
| 6689 |
bool MatchAndExplainImpl(false_type , const Class& obj, |
| 6690 |
MatchResultListener* listener) const { |
| 6691 |
*listener << "whose given field is "; |
| 6692 |
return MatchPrintAndExplain(obj.*field_, matcher_, listener); |
| 6693 |
} |
| 6694 |
|
| 6695 |
bool MatchAndExplainImpl(true_type , const Class* p, |
| 6696 |
MatchResultListener* listener) const { |
| 6697 |
if (p == NULL) |
| 6698 |
return false; |
| 6699 |
|
| 6700 |
*listener << "which points to an object "; |
| 6701 |
|
| 6702 |
|
| 6703 |
|
| 6704 |
return MatchAndExplainImpl(false_type(), *p, listener); |
| 6705 |
} |
| 6706 |
|
| 6707 |
const FieldType Class::*field_; |
| 6708 |
const Matcher<const FieldType&> matcher_; |
| 6709 |
|
| 6710 |
GTEST_DISALLOW_ASSIGN_(FieldMatcher); |
| 6711 |
}; |
| 6712 |
|
| 6713 |
|
| 6714 |
|
| 6715 |
template <typename Class, typename PropertyType> |
| 6716 |
class PropertyMatcher { |
| 6717 |
public: |
| 6718 |
|
| 6719 |
|
| 6720 |
|
| 6721 |
|
| 6722 |
typedef GTEST_REFERENCE_TO_CONST_(PropertyType) RefToConstProperty; |
| 6723 |
|
| 6724 |
PropertyMatcher(PropertyType (Class::*property)() const, |
| 6725 |
const Matcher<RefToConstProperty>& matcher) |
| 6726 |
: property_(property), matcher_(matcher) {} |
| 6727 |
|
| 6728 |
void DescribeTo(::std::ostream* os) const { |
| 6729 |
*os << "is an object whose given property "; |
| 6730 |
matcher_.DescribeTo(os); |
| 6731 |
} |
| 6732 |
|
| 6733 |
void DescribeNegationTo(::std::ostream* os) const { |
| 6734 |
*os << "is an object whose given property "; |
| 6735 |
matcher_.DescribeNegationTo(os); |
| 6736 |
} |
| 6737 |
|
| 6738 |
template <typename T> |
| 6739 |
bool MatchAndExplain(const T&value, MatchResultListener* listener) const { |
| 6740 |
return MatchAndExplainImpl( |
| 6741 |
typename ::testing::internal:: |
| 6742 |
is_pointer<GTEST_REMOVE_CONST_(T)>::type(), |
| 6743 |
value, listener); |
| 6744 |
} |
| 6745 |
|
| 6746 |
private: |
| 6747 |
|
| 6748 |
|
| 6749 |
|
| 6750 |
bool MatchAndExplainImpl(false_type , const Class& obj, |
| 6751 |
MatchResultListener* listener) const { |
| 6752 |
*listener << "whose given property is "; |
| 6753 |
|
| 6754 |
|
| 6755 |
RefToConstProperty result = (obj.*property_)(); |
| 6756 |
return MatchPrintAndExplain(result, matcher_, listener); |
| 6757 |
} |
| 6758 |
|
| 6759 |
bool MatchAndExplainImpl(true_type , const Class* p, |
| 6760 |
MatchResultListener* listener) const { |
| 6761 |
if (p == NULL) |
| 6762 |
return false; |
| 6763 |
|
| 6764 |
*listener << "which points to an object "; |
| 6765 |
|
| 6766 |
|
| 6767 |
|
| 6768 |
return MatchAndExplainImpl(false_type(), *p, listener); |
| 6769 |
} |
| 6770 |
|
| 6771 |
PropertyType (Class::*property_)() const; |
| 6772 |
const Matcher<RefToConstProperty> matcher_; |
| 6773 |
|
| 6774 |
GTEST_DISALLOW_ASSIGN_(PropertyMatcher); |
| 6775 |
}; |
| 6776 |
|
| 6777 |
|
| 6778 |
|
| 6779 |
|
| 6780 |
|
| 6781 |
template <typename Functor> |
| 6782 |
struct CallableTraits { |
| 6783 |
typedef typename Functor::result_type ResultType; |
| 6784 |
typedef Functor StorageType; |
| 6785 |
|
| 6786 |
static void CheckIsValid(Functor ) {} |
| 6787 |
template <typename T> |
| 6788 |
static ResultType Invoke(Functor f, T arg) { return f(arg); } |
| 6789 |
}; |
| 6790 |
|
| 6791 |
|
| 6792 |
template <typename ArgType, typename ResType> |
| 6793 |
struct CallableTraits<ResType(*)(ArgType)> { |
| 6794 |
typedef ResType ResultType; |
| 6795 |
typedef ResType(*StorageType)(ArgType); |
| 6796 |
|
| 6797 |
static void CheckIsValid(ResType(*f)(ArgType)) { |
| 6798 |
GTEST_CHECK_(f != NULL) |
| 6799 |
<< "NULL function pointer is passed into ResultOf()."; |
| 6800 |
} |
| 6801 |
template <typename T> |
| 6802 |
static ResType Invoke(ResType(*f)(ArgType), T arg) { |
| 6803 |
return (*f)(arg); |
| 6804 |
} |
| 6805 |
}; |
| 6806 |
|
| 6807 |
|
| 6808 |
|
| 6809 |
template <typename Callable> |
| 6810 |
class ResultOfMatcher { |
| 6811 |
public: |
| 6812 |
typedef typename CallableTraits<Callable>::ResultType ResultType; |
| 6813 |
|
| 6814 |
ResultOfMatcher(Callable callable, const Matcher<ResultType>& matcher) |
| 6815 |
: callable_(callable), matcher_(matcher) { |
| 6816 |
CallableTraits<Callable>::CheckIsValid(callable_); |
| 6817 |
} |
| 6818 |
|
| 6819 |
template <typename T> |
| 6820 |
operator Matcher<T>() const { |
| 6821 |
return Matcher<T>(new Impl<T>(callable_, matcher_)); |
| 6822 |
} |
| 6823 |
|
| 6824 |
private: |
| 6825 |
typedef typename CallableTraits<Callable>::StorageType CallableStorageType; |
| 6826 |
|
| 6827 |
template <typename T> |
| 6828 |
class Impl : public MatcherInterface<T> { |
| 6829 |
public: |
| 6830 |
Impl(CallableStorageType callable, const Matcher<ResultType>& matcher) |
| 6831 |
: callable_(callable), matcher_(matcher) {} |
| 6832 |
|
| 6833 |
virtual void DescribeTo(::std::ostream* os) const { |
| 6834 |
*os << "is mapped by the given callable to a value that "; |
| 6835 |
matcher_.DescribeTo(os); |
| 6836 |
} |
| 6837 |
|
| 6838 |
virtual void DescribeNegationTo(::std::ostream* os) const { |
| 6839 |
*os << "is mapped by the given callable to a value that "; |
| 6840 |
matcher_.DescribeNegationTo(os); |
| 6841 |
} |
| 6842 |
|
| 6843 |
virtual bool MatchAndExplain(T obj, MatchResultListener* listener) const { |
| 6844 |
*listener << "which is mapped by the given callable to "; |
| 6845 |
|
| 6846 |
|
| 6847 |
ResultType result = |
| 6848 |
CallableTraits<Callable>::template Invoke<T>(callable_, obj); |
| 6849 |
return MatchPrintAndExplain(result, matcher_, listener); |
| 6850 |
} |
| 6851 |
|
| 6852 |
private: |
| 6853 |
|
| 6854 |
|
| 6855 |
|
| 6856 |
|
| 6857 |
|
| 6858 |
mutable CallableStorageType callable_; |
| 6859 |
const Matcher<ResultType> matcher_; |
| 6860 |
|
| 6861 |
GTEST_DISALLOW_ASSIGN_(Impl); |
| 6862 |
}; |
| 6863 |
|
| 6864 |
const CallableStorageType callable_; |
| 6865 |
const Matcher<ResultType> matcher_; |
| 6866 |
|
| 6867 |
GTEST_DISALLOW_ASSIGN_(ResultOfMatcher); |
| 6868 |
}; |
| 6869 |
|
| 6870 |
|
| 6871 |
template <typename SizeMatcher> |
| 6872 |
class SizeIsMatcher { |
| 6873 |
public: |
| 6874 |
explicit SizeIsMatcher(const SizeMatcher& size_matcher) |
| 6875 |
: size_matcher_(size_matcher) { |
| 6876 |
} |
| 6877 |
|
| 6878 |
template <typename Container> |
| 6879 |
operator Matcher<Container>() const { |
| 6880 |
return MakeMatcher(new Impl<Container>(size_matcher_)); |
| 6881 |
} |
| 6882 |
|
| 6883 |
template <typename Container> |
| 6884 |
class Impl : public MatcherInterface<Container> { |
| 6885 |
public: |
| 6886 |
typedef internal::StlContainerView< |
| 6887 |
GTEST_REMOVE_REFERENCE_AND_CONST_(Container)> ContainerView; |
| 6888 |
typedef typename ContainerView::type::size_type SizeType; |
| 6889 |
explicit Impl(const SizeMatcher& size_matcher) |
| 6890 |
: size_matcher_(MatcherCast<SizeType>(size_matcher)) {} |
| 6891 |
|
| 6892 |
virtual void DescribeTo(::std::ostream* os) const { |
| 6893 |
*os << "size "; |
| 6894 |
size_matcher_.DescribeTo(os); |
| 6895 |
} |
| 6896 |
virtual void DescribeNegationTo(::std::ostream* os) const { |
| 6897 |
*os << "size "; |
| 6898 |
size_matcher_.DescribeNegationTo(os); |
| 6899 |
} |
| 6900 |
|
| 6901 |
virtual bool MatchAndExplain(Container container, |
| 6902 |
MatchResultListener* listener) const { |
| 6903 |
SizeType size = container.size(); |
| 6904 |
StringMatchResultListener size_listener; |
| 6905 |
const bool result = size_matcher_.MatchAndExplain(size, &size_listener); |
| 6906 |
*listener |
| 6907 |
<< "whose size " << size << (result ? " matches" : " doesn't match"); |
| 6908 |
PrintIfNotEmpty(size_listener.str(), listener->stream()); |
| 6909 |
return result; |
| 6910 |
} |
| 6911 |
|
| 6912 |
private: |
| 6913 |
const Matcher<SizeType> size_matcher_; |
| 6914 |
GTEST_DISALLOW_ASSIGN_(Impl); |
| 6915 |
}; |
| 6916 |
|
| 6917 |
private: |
| 6918 |
const SizeMatcher size_matcher_; |
| 6919 |
GTEST_DISALLOW_ASSIGN_(SizeIsMatcher); |
| 6920 |
}; |
| 6921 |
|
| 6922 |
|
| 6923 |
|
| 6924 |
|
| 6925 |
|
| 6926 |
|
| 6927 |
|
| 6928 |
|
| 6929 |
|
| 6930 |
|
| 6931 |
|
| 6932 |
template <typename Container> |
| 6933 |
class ContainerEqMatcher { |
| 6934 |
public: |
| 6935 |
typedef internal::StlContainerView<Container> View; |
| 6936 |
typedef typename View::type StlContainer; |
| 6937 |
typedef typename View::const_reference StlContainerReference; |
| 6938 |
|
| 6939 |
|
| 6940 |
|
| 6941 |
explicit ContainerEqMatcher(const Container& rhs) : rhs_(View::Copy(rhs)) { |
| 6942 |
|
| 6943 |
|
| 6944 |
(void)testing::StaticAssertTypeEq<Container, |
| 6945 |
GTEST_REMOVE_REFERENCE_AND_CONST_(Container)>(); |
| 6946 |
} |
| 6947 |
|
| 6948 |
void DescribeTo(::std::ostream* os) const { |
| 6949 |
*os << "equals "; |
| 6950 |
UniversalPrint(rhs_, os); |
| 6951 |
} |
| 6952 |
void DescribeNegationTo(::std::ostream* os) const { |
| 6953 |
*os << "does not equal "; |
| 6954 |
UniversalPrint(rhs_, os); |
| 6955 |
} |
| 6956 |
|
| 6957 |
template <typename LhsContainer> |
| 6958 |
bool MatchAndExplain(const LhsContainer& lhs, |
| 6959 |
MatchResultListener* listener) const { |
| 6960 |
|
| 6961 |
|
| 6962 |
typedef internal::StlContainerView<GTEST_REMOVE_CONST_(LhsContainer)> |
| 6963 |
LhsView; |
| 6964 |
typedef typename LhsView::type LhsStlContainer; |
| 6965 |
StlContainerReference lhs_stl_container = LhsView::ConstReference(lhs); |
| 6966 |
if (lhs_stl_container == rhs_) |
| 6967 |
return true; |
| 6968 |
|
| 6969 |
::std::ostream* const os = listener->stream(); |
| 6970 |
if (os != NULL) { |
| 6971 |
|
| 6972 |
bool printed_header = false; |
| 6973 |
for (typename LhsStlContainer::const_iterator it = |
| 6974 |
lhs_stl_container.begin(); |
| 6975 |
it != lhs_stl_container.end(); ++it) { |
| 6976 |
if (internal::ArrayAwareFind(rhs_.begin(), rhs_.end(), *it) == |
| 6977 |
rhs_.end()) { |
| 6978 |
if (printed_header) { |
| 6979 |
*os << ", "; |
| 6980 |
} else { |
| 6981 |
*os << "which has these unexpected elements: "; |
| 6982 |
printed_header = true; |
| 6983 |
} |
| 6984 |
UniversalPrint(*it, os); |
| 6985 |
} |
| 6986 |
} |
| 6987 |
|
| 6988 |
|
| 6989 |
bool printed_header2 = false; |
| 6990 |
for (typename StlContainer::const_iterator it = rhs_.begin(); |
| 6991 |
it != rhs_.end(); ++it) { |
| 6992 |
if (internal::ArrayAwareFind( |
| 6993 |
lhs_stl_container.begin(), lhs_stl_container.end(), *it) == |
| 6994 |
lhs_stl_container.end()) { |
| 6995 |
if (printed_header2) { |
| 6996 |
*os << ", "; |
| 6997 |
} else { |
| 6998 |
*os << (printed_header ? ",\nand" : "which") |
| 6999 |
<< " doesn't have these expected elements: "; |
| 7000 |
printed_header2 = true; |
| 7001 |
} |
| 7002 |
UniversalPrint(*it, os); |
| 7003 |
} |
| 7004 |
} |
| 7005 |
} |
| 7006 |
|
| 7007 |
return false; |
| 7008 |
} |
| 7009 |
|
| 7010 |
private: |
| 7011 |
const StlContainer rhs_; |
| 7012 |
|
| 7013 |
GTEST_DISALLOW_ASSIGN_(ContainerEqMatcher); |
| 7014 |
}; |
| 7015 |
|
| 7016 |
|
| 7017 |
struct LessComparator { |
| 7018 |
template <typename T, typename U> |
| 7019 |
bool operator()(const T& lhs, const U& rhs) const { return lhs < rhs; } |
| 7020 |
}; |
| 7021 |
|
| 7022 |
|
| 7023 |
template <typename Comparator, typename ContainerMatcher> |
| 7024 |
class WhenSortedByMatcher { |
| 7025 |
public: |
| 7026 |
WhenSortedByMatcher(const Comparator& comparator, |
| 7027 |
const ContainerMatcher& matcher) |
| 7028 |
: comparator_(comparator), matcher_(matcher) {} |
| 7029 |
|
| 7030 |
template <typename LhsContainer> |
| 7031 |
operator Matcher<LhsContainer>() const { |
| 7032 |
return MakeMatcher(new Impl<LhsContainer>(comparator_, matcher_)); |
| 7033 |
} |
| 7034 |
|
| 7035 |
template <typename LhsContainer> |
| 7036 |
class Impl : public MatcherInterface<LhsContainer> { |
| 7037 |
public: |
| 7038 |
typedef internal::StlContainerView< |
| 7039 |
GTEST_REMOVE_REFERENCE_AND_CONST_(LhsContainer)> LhsView; |
| 7040 |
typedef typename LhsView::type LhsStlContainer; |
| 7041 |
typedef typename LhsView::const_reference LhsStlContainerReference; |
| 7042 |
|
| 7043 |
|
| 7044 |
typedef typename RemoveConstFromKey< |
| 7045 |
typename LhsStlContainer::value_type>::type LhsValue; |
| 7046 |
|
| 7047 |
Impl(const Comparator& comparator, const ContainerMatcher& matcher) |
| 7048 |
: comparator_(comparator), matcher_(matcher) {} |
| 7049 |
|
| 7050 |
virtual void DescribeTo(::std::ostream* os) const { |
| 7051 |
*os << "(when sorted) "; |
| 7052 |
matcher_.DescribeTo(os); |
| 7053 |
} |
| 7054 |
|
| 7055 |
virtual void DescribeNegationTo(::std::ostream* os) const { |
| 7056 |
*os << "(when sorted) "; |
| 7057 |
matcher_.DescribeNegationTo(os); |
| 7058 |
} |
| 7059 |
|
| 7060 |
virtual bool MatchAndExplain(LhsContainer lhs, |
| 7061 |
MatchResultListener* listener) const { |
| 7062 |
LhsStlContainerReference lhs_stl_container = LhsView::ConstReference(lhs); |
| 7063 |
::std::vector<LhsValue> sorted_container(lhs_stl_container.begin(), |
| 7064 |
lhs_stl_container.end()); |
| 7065 |
::std::sort( |
| 7066 |
sorted_container.begin(), sorted_container.end(), comparator_); |
| 7067 |
|
| 7068 |
if (!listener->IsInterested()) { |
| 7069 |
|
| 7070 |
|
| 7071 |
return matcher_.Matches(sorted_container); |
| 7072 |
} |
| 7073 |
|
| 7074 |
*listener << "which is "; |
| 7075 |
UniversalPrint(sorted_container, listener->stream()); |
| 7076 |
*listener << " when sorted"; |
| 7077 |
|
| 7078 |
StringMatchResultListener inner_listener; |
| 7079 |
const bool match = matcher_.MatchAndExplain(sorted_container, |
| 7080 |
&inner_listener); |
| 7081 |
PrintIfNotEmpty(inner_listener.str(), listener->stream()); |
| 7082 |
return match; |
| 7083 |
} |
| 7084 |
|
| 7085 |
private: |
| 7086 |
const Comparator comparator_; |
| 7087 |
const Matcher<const ::std::vector<LhsValue>&> matcher_; |
| 7088 |
|
| 7089 |
GTEST_DISALLOW_COPY_AND_ASSIGN_(Impl); |
| 7090 |
}; |
| 7091 |
|
| 7092 |
private: |
| 7093 |
const Comparator comparator_; |
| 7094 |
const ContainerMatcher matcher_; |
| 7095 |
|
| 7096 |
GTEST_DISALLOW_ASSIGN_(WhenSortedByMatcher); |
| 7097 |
}; |
| 7098 |
|
| 7099 |
|
| 7100 |
|
| 7101 |
|
| 7102 |
|
| 7103 |
template <typename TupleMatcher, typename RhsContainer> |
| 7104 |
class PointwiseMatcher { |
| 7105 |
public: |
| 7106 |
typedef internal::StlContainerView<RhsContainer> RhsView; |
| 7107 |
typedef typename RhsView::type RhsStlContainer; |
| 7108 |
typedef typename RhsStlContainer::value_type RhsValue; |
| 7109 |
|
| 7110 |
|
| 7111 |
|
| 7112 |
PointwiseMatcher(const TupleMatcher& tuple_matcher, const RhsContainer& rhs) |
| 7113 |
: tuple_matcher_(tuple_matcher), rhs_(RhsView::Copy(rhs)) { |
| 7114 |
|
| 7115 |
|
| 7116 |
(void)testing::StaticAssertTypeEq<RhsContainer, |
| 7117 |
GTEST_REMOVE_REFERENCE_AND_CONST_(RhsContainer)>(); |
| 7118 |
} |
| 7119 |
|
| 7120 |
template <typename LhsContainer> |
| 7121 |
operator Matcher<LhsContainer>() const { |
| 7122 |
return MakeMatcher(new Impl<LhsContainer>(tuple_matcher_, rhs_)); |
| 7123 |
} |
| 7124 |
|
| 7125 |
template <typename LhsContainer> |
| 7126 |
class Impl : public MatcherInterface<LhsContainer> { |
| 7127 |
public: |
| 7128 |
typedef internal::StlContainerView< |
| 7129 |
GTEST_REMOVE_REFERENCE_AND_CONST_(LhsContainer)> LhsView; |
| 7130 |
typedef typename LhsView::type LhsStlContainer; |
| 7131 |
typedef typename LhsView::const_reference LhsStlContainerReference; |
| 7132 |
typedef typename LhsStlContainer::value_type LhsValue; |
| 7133 |
|
| 7134 |
|
| 7135 |
|
| 7136 |
|
| 7137 |
typedef ::std::tr1::tuple<const LhsValue&, const RhsValue&> InnerMatcherArg; |
| 7138 |
|
| 7139 |
Impl(const TupleMatcher& tuple_matcher, const RhsStlContainer& rhs) |
| 7140 |
|
| 7141 |
: mono_tuple_matcher_(SafeMatcherCast<InnerMatcherArg>(tuple_matcher)), |
| 7142 |
rhs_(rhs) {} |
| 7143 |
|
| 7144 |
virtual void DescribeTo(::std::ostream* os) const { |
| 7145 |
*os << "contains " << rhs_.size() |
| 7146 |
<< " values, where each value and its corresponding value in "; |
| 7147 |
UniversalPrinter<RhsStlContainer>::Print(rhs_, os); |
| 7148 |
*os << " "; |
| 7149 |
mono_tuple_matcher_.DescribeTo(os); |
| 7150 |
} |
| 7151 |
virtual void DescribeNegationTo(::std::ostream* os) const { |
| 7152 |
*os << "doesn't contain exactly " << rhs_.size() |
| 7153 |
<< " values, or contains a value x at some index i" |
| 7154 |
<< " where x and the i-th value of "; |
| 7155 |
UniversalPrint(rhs_, os); |
| 7156 |
*os << " "; |
| 7157 |
mono_tuple_matcher_.DescribeNegationTo(os); |
| 7158 |
} |
| 7159 |
|
| 7160 |
virtual bool MatchAndExplain(LhsContainer lhs, |
| 7161 |
MatchResultListener* listener) const { |
| 7162 |
LhsStlContainerReference lhs_stl_container = LhsView::ConstReference(lhs); |
| 7163 |
const size_t actual_size = lhs_stl_container.size(); |
| 7164 |
if (actual_size != rhs_.size()) { |
| 7165 |
*listener << "which contains " << actual_size << " values"; |
| 7166 |
return false; |
| 7167 |
} |
| 7168 |
|
| 7169 |
typename LhsStlContainer::const_iterator left = lhs_stl_container.begin(); |
| 7170 |
typename RhsStlContainer::const_iterator right = rhs_.begin(); |
| 7171 |
for (size_t i = 0; i != actual_size; ++i, ++left, ++right) { |
| 7172 |
const InnerMatcherArg value_pair(*left, *right); |
| 7173 |
|
| 7174 |
if (listener->IsInterested()) { |
| 7175 |
StringMatchResultListener inner_listener; |
| 7176 |
if (!mono_tuple_matcher_.MatchAndExplain( |
| 7177 |
value_pair, &inner_listener)) { |
| 7178 |
*listener << "where the value pair ("; |
| 7179 |
UniversalPrint(*left, listener->stream()); |
| 7180 |
*listener << ", "; |
| 7181 |
UniversalPrint(*right, listener->stream()); |
| 7182 |
*listener << ") at index #" << i << " don't match"; |
| 7183 |
PrintIfNotEmpty(inner_listener.str(), listener->stream()); |
| 7184 |
return false; |
| 7185 |
} |
| 7186 |
} else { |
| 7187 |
if (!mono_tuple_matcher_.Matches(value_pair)) |
| 7188 |
return false; |
| 7189 |
} |
| 7190 |
} |
| 7191 |
|
| 7192 |
return true; |
| 7193 |
} |
| 7194 |
|
| 7195 |
private: |
| 7196 |
const Matcher<InnerMatcherArg> mono_tuple_matcher_; |
| 7197 |
const RhsStlContainer rhs_; |
| 7198 |
|
| 7199 |
GTEST_DISALLOW_ASSIGN_(Impl); |
| 7200 |
}; |
| 7201 |
|
| 7202 |
private: |
| 7203 |
const TupleMatcher tuple_matcher_; |
| 7204 |
const RhsStlContainer rhs_; |
| 7205 |
|
| 7206 |
GTEST_DISALLOW_ASSIGN_(PointwiseMatcher); |
| 7207 |
}; |
| 7208 |
|
| 7209 |
|
| 7210 |
template <typename Container> |
| 7211 |
class QuantifierMatcherImpl : public MatcherInterface<Container> { |
| 7212 |
public: |
| 7213 |
typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer; |
| 7214 |
typedef StlContainerView<RawContainer> View; |
| 7215 |
typedef typename View::type StlContainer; |
| 7216 |
typedef typename View::const_reference StlContainerReference; |
| 7217 |
typedef typename StlContainer::value_type Element; |
| 7218 |
|
| 7219 |
template <typename InnerMatcher> |
| 7220 |
explicit QuantifierMatcherImpl(InnerMatcher inner_matcher) |
| 7221 |
: inner_matcher_( |
| 7222 |
testing::SafeMatcherCast<const Element&>(inner_matcher)) {} |
| 7223 |
|
| 7224 |
|
| 7225 |
|
| 7226 |
|
| 7227 |
bool MatchAndExplainImpl(bool all_elements_should_match, |
| 7228 |
Container container, |
| 7229 |
MatchResultListener* listener) const { |
| 7230 |
StlContainerReference stl_container = View::ConstReference(container); |
| 7231 |
size_t i = 0; |
| 7232 |
for (typename StlContainer::const_iterator it = stl_container.begin(); |
| 7233 |
it != stl_container.end(); ++it, ++i) { |
| 7234 |
StringMatchResultListener inner_listener; |
| 7235 |
const bool matches = inner_matcher_.MatchAndExplain(*it, &inner_listener); |
| 7236 |
|
| 7237 |
if (matches != all_elements_should_match) { |
| 7238 |
*listener << "whose element #" << i |
| 7239 |
<< (matches ? " matches" : " doesn't match"); |
| 7240 |
PrintIfNotEmpty(inner_listener.str(), listener->stream()); |
| 7241 |
return !all_elements_should_match; |
| 7242 |
} |
| 7243 |
} |
| 7244 |
return all_elements_should_match; |
| 7245 |
} |
| 7246 |
|
| 7247 |
protected: |
| 7248 |
const Matcher<const Element&> inner_matcher_; |
| 7249 |
|
| 7250 |
GTEST_DISALLOW_ASSIGN_(QuantifierMatcherImpl); |
| 7251 |
}; |
| 7252 |
|
| 7253 |
|
| 7254 |
|
| 7255 |
template <typename Container> |
| 7256 |
class ContainsMatcherImpl : public QuantifierMatcherImpl<Container> { |
| 7257 |
public: |
| 7258 |
template <typename InnerMatcher> |
| 7259 |
explicit ContainsMatcherImpl(InnerMatcher inner_matcher) |
| 7260 |
: QuantifierMatcherImpl<Container>(inner_matcher) {} |
| 7261 |
|
| 7262 |
|
| 7263 |
virtual void DescribeTo(::std::ostream* os) const { |
| 7264 |
*os << "contains at least one element that "; |
| 7265 |
this->inner_matcher_.DescribeTo(os); |
| 7266 |
} |
| 7267 |
|
| 7268 |
virtual void DescribeNegationTo(::std::ostream* os) const { |
| 7269 |
*os << "doesn't contain any element that "; |
| 7270 |
this->inner_matcher_.DescribeTo(os); |
| 7271 |
} |
| 7272 |
|
| 7273 |
virtual bool MatchAndExplain(Container container, |
| 7274 |
MatchResultListener* listener) const { |
| 7275 |
return this->MatchAndExplainImpl(false, container, listener); |
| 7276 |
} |
| 7277 |
|
| 7278 |
private: |
| 7279 |
GTEST_DISALLOW_ASSIGN_(ContainsMatcherImpl); |
| 7280 |
}; |
| 7281 |
|
| 7282 |
|
| 7283 |
|
| 7284 |
template <typename Container> |
| 7285 |
class EachMatcherImpl : public QuantifierMatcherImpl<Container> { |
| 7286 |
public: |
| 7287 |
template <typename InnerMatcher> |
| 7288 |
explicit EachMatcherImpl(InnerMatcher inner_matcher) |
| 7289 |
: QuantifierMatcherImpl<Container>(inner_matcher) {} |
| 7290 |
|
| 7291 |
|
| 7292 |
virtual void DescribeTo(::std::ostream* os) const { |
| 7293 |
*os << "only contains elements that "; |
| 7294 |
this->inner_matcher_.DescribeTo(os); |
| 7295 |
} |
| 7296 |
|
| 7297 |
virtual void DescribeNegationTo(::std::ostream* os) const { |
| 7298 |
*os << "contains some element that "; |
| 7299 |
this->inner_matcher_.DescribeNegationTo(os); |
| 7300 |
} |
| 7301 |
|
| 7302 |
virtual bool MatchAndExplain(Container container, |
| 7303 |
MatchResultListener* listener) const { |
| 7304 |
return this->MatchAndExplainImpl(true, container, listener); |
| 7305 |
} |
| 7306 |
|
| 7307 |
private: |
| 7308 |
GTEST_DISALLOW_ASSIGN_(EachMatcherImpl); |
| 7309 |
}; |
| 7310 |
|
| 7311 |
|
| 7312 |
template <typename M> |
| 7313 |
class ContainsMatcher { |
| 7314 |
public: |
| 7315 |
explicit ContainsMatcher(M m) : inner_matcher_(m) {} |
| 7316 |
|
| 7317 |
template <typename Container> |
| 7318 |
operator Matcher<Container>() const { |
| 7319 |
return MakeMatcher(new ContainsMatcherImpl<Container>(inner_matcher_)); |
| 7320 |
} |
| 7321 |
|
| 7322 |
private: |
| 7323 |
const M inner_matcher_; |
| 7324 |
|
| 7325 |
GTEST_DISALLOW_ASSIGN_(ContainsMatcher); |
| 7326 |
}; |
| 7327 |
|
| 7328 |
|
| 7329 |
template <typename M> |
| 7330 |
class EachMatcher { |
| 7331 |
public: |
| 7332 |
explicit EachMatcher(M m) : inner_matcher_(m) {} |
| 7333 |
|
| 7334 |
template <typename Container> |
| 7335 |
operator Matcher<Container>() const { |
| 7336 |
return MakeMatcher(new EachMatcherImpl<Container>(inner_matcher_)); |
| 7337 |
} |
| 7338 |
|
| 7339 |
private: |
| 7340 |
const M inner_matcher_; |
| 7341 |
|
| 7342 |
GTEST_DISALLOW_ASSIGN_(EachMatcher); |
| 7343 |
}; |
| 7344 |
|
| 7345 |
|
| 7346 |
|
| 7347 |
|
| 7348 |
|
| 7349 |
template <typename PairType> |
| 7350 |
class KeyMatcherImpl : public MatcherInterface<PairType> { |
| 7351 |
public: |
| 7352 |
typedef GTEST_REMOVE_REFERENCE_AND_CONST_(PairType) RawPairType; |
| 7353 |
typedef typename RawPairType::first_type KeyType; |
| 7354 |
|
| 7355 |
template <typename InnerMatcher> |
| 7356 |
explicit KeyMatcherImpl(InnerMatcher inner_matcher) |
| 7357 |
: inner_matcher_( |
| 7358 |
testing::SafeMatcherCast<const KeyType&>(inner_matcher)) { |
| 7359 |
} |
| 7360 |
|
| 7361 |
|
| 7362 |
virtual bool MatchAndExplain(PairType key_value, |
| 7363 |
MatchResultListener* listener) const { |
| 7364 |
StringMatchResultListener inner_listener; |
| 7365 |
const bool match = inner_matcher_.MatchAndExplain(key_value.first, |
| 7366 |
&inner_listener); |
| 7367 |
const internal::string explanation = inner_listener.str(); |
| 7368 |
if (explanation != "") { |
| 7369 |
*listener << "whose first field is a value " << explanation; |
| 7370 |
} |
| 7371 |
return match; |
| 7372 |
} |
| 7373 |
|
| 7374 |
|
| 7375 |
virtual void DescribeTo(::std::ostream* os) const { |
| 7376 |
*os << "has a key that "; |
| 7377 |
inner_matcher_.DescribeTo(os); |
| 7378 |
} |
| 7379 |
|
| 7380 |
|
| 7381 |
virtual void DescribeNegationTo(::std::ostream* os) const { |
| 7382 |
*os << "doesn't have a key that "; |
| 7383 |
inner_matcher_.DescribeTo(os); |
| 7384 |
} |
| 7385 |
|
| 7386 |
private: |
| 7387 |
const Matcher<const KeyType&> inner_matcher_; |
| 7388 |
|
| 7389 |
GTEST_DISALLOW_ASSIGN_(KeyMatcherImpl); |
| 7390 |
}; |
| 7391 |
|
| 7392 |
|
| 7393 |
template <typename M> |
| 7394 |
class KeyMatcher { |
| 7395 |
public: |
| 7396 |
explicit KeyMatcher(M m) : matcher_for_key_(m) {} |
| 7397 |
|
| 7398 |
template <typename PairType> |
| 7399 |
operator Matcher<PairType>() const { |
| 7400 |
return MakeMatcher(new KeyMatcherImpl<PairType>(matcher_for_key_)); |
| 7401 |
} |
| 7402 |
|
| 7403 |
private: |
| 7404 |
const M matcher_for_key_; |
| 7405 |
|
| 7406 |
GTEST_DISALLOW_ASSIGN_(KeyMatcher); |
| 7407 |
}; |
| 7408 |
|
| 7409 |
|
| 7410 |
|
| 7411 |
template <typename PairType> |
| 7412 |
class PairMatcherImpl : public MatcherInterface<PairType> { |
| 7413 |
public: |
| 7414 |
typedef GTEST_REMOVE_REFERENCE_AND_CONST_(PairType) RawPairType; |
| 7415 |
typedef typename RawPairType::first_type FirstType; |
| 7416 |
typedef typename RawPairType::second_type SecondType; |
| 7417 |
|
| 7418 |
template <typename FirstMatcher, typename SecondMatcher> |
| 7419 |
PairMatcherImpl(FirstMatcher first_matcher, SecondMatcher second_matcher) |
| 7420 |
: first_matcher_( |
| 7421 |
testing::SafeMatcherCast<const FirstType&>(first_matcher)), |
| 7422 |
second_matcher_( |
| 7423 |
testing::SafeMatcherCast<const SecondType&>(second_matcher)) { |
| 7424 |
} |
| 7425 |
|
| 7426 |
|
| 7427 |
virtual void DescribeTo(::std::ostream* os) const { |
| 7428 |
*os << "has a first field that "; |
| 7429 |
first_matcher_.DescribeTo(os); |
| 7430 |
*os << ", and has a second field that "; |
| 7431 |
second_matcher_.DescribeTo(os); |
| 7432 |
} |
| 7433 |
|
| 7434 |
|
| 7435 |
virtual void DescribeNegationTo(::std::ostream* os) const { |
| 7436 |
*os << "has a first field that "; |
| 7437 |
first_matcher_.DescribeNegationTo(os); |
| 7438 |
*os << ", or has a second field that "; |
| 7439 |
second_matcher_.DescribeNegationTo(os); |
| 7440 |
} |
| 7441 |
|
| 7442 |
|
| 7443 |
|
| 7444 |
virtual bool MatchAndExplain(PairType a_pair, |
| 7445 |
MatchResultListener* listener) const { |
| 7446 |
if (!listener->IsInterested()) { |
| 7447 |
|
| 7448 |
|
| 7449 |
return first_matcher_.Matches(a_pair.first) && |
| 7450 |
second_matcher_.Matches(a_pair.second); |
| 7451 |
} |
| 7452 |
StringMatchResultListener first_inner_listener; |
| 7453 |
if (!first_matcher_.MatchAndExplain(a_pair.first, |
| 7454 |
&first_inner_listener)) { |
| 7455 |
*listener << "whose first field does not match"; |
| 7456 |
PrintIfNotEmpty(first_inner_listener.str(), listener->stream()); |
| 7457 |
return false; |
| 7458 |
} |
| 7459 |
StringMatchResultListener second_inner_listener; |
| 7460 |
if (!second_matcher_.MatchAndExplain(a_pair.second, |
| 7461 |
&second_inner_listener)) { |
| 7462 |
*listener << "whose second field does not match"; |
| 7463 |
PrintIfNotEmpty(second_inner_listener.str(), listener->stream()); |
| 7464 |
return false; |
| 7465 |
} |
| 7466 |
ExplainSuccess(first_inner_listener.str(), second_inner_listener.str(), |
| 7467 |
listener); |
| 7468 |
return true; |
| 7469 |
} |
| 7470 |
|
| 7471 |
private: |
| 7472 |
void ExplainSuccess(const internal::string& first_explanation, |
| 7473 |
const internal::string& second_explanation, |
| 7474 |
MatchResultListener* listener) const { |
| 7475 |
*listener << "whose both fields match"; |
| 7476 |
if (first_explanation != "") { |
| 7477 |
*listener << ", where the first field is a value " << first_explanation; |
| 7478 |
} |
| 7479 |
if (second_explanation != "") { |
| 7480 |
*listener << ", "; |
| 7481 |
if (first_explanation != "") { |
| 7482 |
*listener << "and "; |
| 7483 |
} else { |
| 7484 |
*listener << "where "; |
| 7485 |
} |
| 7486 |
*listener << "the second field is a value " << second_explanation; |
| 7487 |
} |
| 7488 |
} |
| 7489 |
|
| 7490 |
const Matcher<const FirstType&> first_matcher_; |
| 7491 |
const Matcher<const SecondType&> second_matcher_; |
| 7492 |
|
| 7493 |
GTEST_DISALLOW_ASSIGN_(PairMatcherImpl); |
| 7494 |
}; |
| 7495 |
|
| 7496 |
|
| 7497 |
template <typename FirstMatcher, typename SecondMatcher> |
| 7498 |
class PairMatcher { |
| 7499 |
public: |
| 7500 |
PairMatcher(FirstMatcher first_matcher, SecondMatcher second_matcher) |
| 7501 |
: first_matcher_(first_matcher), second_matcher_(second_matcher) {} |
| 7502 |
|
| 7503 |
template <typename PairType> |
| 7504 |
operator Matcher<PairType> () const { |
| 7505 |
return MakeMatcher( |
| 7506 |
new PairMatcherImpl<PairType>( |
| 7507 |
first_matcher_, second_matcher_)); |
| 7508 |
} |
| 7509 |
|
| 7510 |
private: |
| 7511 |
const FirstMatcher first_matcher_; |
| 7512 |
const SecondMatcher second_matcher_; |
| 7513 |
|
| 7514 |
GTEST_DISALLOW_ASSIGN_(PairMatcher); |
| 7515 |
}; |
| 7516 |
|
| 7517 |
|
| 7518 |
template <typename Container> |
| 7519 |
class ElementsAreMatcherImpl : public MatcherInterface<Container> { |
| 7520 |
public: |
| 7521 |
typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer; |
| 7522 |
typedef internal::StlContainerView<RawContainer> View; |
| 7523 |
typedef typename View::type StlContainer; |
| 7524 |
typedef typename View::const_reference StlContainerReference; |
| 7525 |
typedef typename StlContainer::value_type Element; |
| 7526 |
|
| 7527 |
|
| 7528 |
|
| 7529 |
template <typename InputIter> |
| 7530 |
ElementsAreMatcherImpl(InputIter first, InputIter last) { |
| 7531 |
while (first != last) { |
| 7532 |
matchers_.push_back(MatcherCast<const Element&>(*first++)); |
| 7533 |
} |
| 7534 |
} |
| 7535 |
|
| 7536 |
|
| 7537 |
virtual void DescribeTo(::std::ostream* os) const { |
| 7538 |
if (count() == 0) { |
| 7539 |
*os << "is empty"; |
| 7540 |
} else if (count() == 1) { |
| 7541 |
*os << "has 1 element that "; |
| 7542 |
matchers_[0].DescribeTo(os); |
| 7543 |
} else { |
| 7544 |
*os << "has " << Elements(count()) << " where\n"; |
| 7545 |
for (size_t i = 0; i != count(); ++i) { |
| 7546 |
*os << "element #" << i << " "; |
| 7547 |
matchers_[i].DescribeTo(os); |
| 7548 |
if (i + 1 < count()) { |
| 7549 |
*os << ",\n"; |
| 7550 |
} |
| 7551 |
} |
| 7552 |
} |
| 7553 |
} |
| 7554 |
|
| 7555 |
|
| 7556 |
virtual void DescribeNegationTo(::std::ostream* os) const { |
| 7557 |
if (count() == 0) { |
| 7558 |
*os << "isn't empty"; |
| 7559 |
return; |
| 7560 |
} |
| 7561 |
|
| 7562 |
*os << "doesn't have " << Elements(count()) << ", or\n"; |
| 7563 |
for (size_t i = 0; i != count(); ++i) { |
| 7564 |
*os << "element #" << i << " "; |
| 7565 |
matchers_[i].DescribeNegationTo(os); |
| 7566 |
if (i + 1 < count()) { |
| 7567 |
*os << ", or\n"; |
| 7568 |
} |
| 7569 |
} |
| 7570 |
} |
| 7571 |
|
| 7572 |
virtual bool MatchAndExplain(Container container, |
| 7573 |
MatchResultListener* listener) const { |
| 7574 |
|
| 7575 |
|
| 7576 |
|
| 7577 |
const bool listener_interested = listener->IsInterested(); |
| 7578 |
|
| 7579 |
|
| 7580 |
::std::vector<internal::string> explanations(count()); |
| 7581 |
StlContainerReference stl_container = View::ConstReference(container); |
| 7582 |
typename StlContainer::const_iterator it = stl_container.begin(); |
| 7583 |
size_t exam_pos = 0; |
| 7584 |
bool mismatch_found = false; |
| 7585 |
|
| 7586 |
|
| 7587 |
|
| 7588 |
|
| 7589 |
for (; it != stl_container.end() && exam_pos != count(); ++it, ++exam_pos) { |
| 7590 |
bool match; |
| 7591 |
if (listener_interested) { |
| 7592 |
StringMatchResultListener s; |
| 7593 |
match = matchers_[exam_pos].MatchAndExplain(*it, &s); |
| 7594 |
explanations[exam_pos] = s.str(); |
| 7595 |
} else { |
| 7596 |
match = matchers_[exam_pos].Matches(*it); |
| 7597 |
} |
| 7598 |
|
| 7599 |
if (!match) { |
| 7600 |
mismatch_found = true; |
| 7601 |
break; |
| 7602 |
} |
| 7603 |
} |
| 7604 |
|
| 7605 |
|
| 7606 |
|
| 7607 |
|
| 7608 |
|
| 7609 |
size_t actual_count = exam_pos; |
| 7610 |
for (; it != stl_container.end(); ++it) { |
| 7611 |
++actual_count; |
| 7612 |
} |
| 7613 |
|
| 7614 |
if (actual_count != count()) { |
| 7615 |
|
| 7616 |
|
| 7617 |
|
| 7618 |
|
| 7619 |
if (listener_interested && (actual_count != 0)) { |
| 7620 |
*listener << "which has " << Elements(actual_count); |
| 7621 |
} |
| 7622 |
return false; |
| 7623 |
} |
| 7624 |
|
| 7625 |
if (mismatch_found) { |
| 7626 |
|
| 7627 |
if (listener_interested) { |
| 7628 |
*listener << "whose element #" << exam_pos << " doesn't match"; |
| 7629 |
PrintIfNotEmpty(explanations[exam_pos], listener->stream()); |
| 7630 |
} |
| 7631 |
return false; |
| 7632 |
} |
| 7633 |
|
| 7634 |
|
| 7635 |
|
| 7636 |
if (listener_interested) { |
| 7637 |
bool reason_printed = false; |
| 7638 |
for (size_t i = 0; i != count(); ++i) { |
| 7639 |
const internal::string& s = explanations[i]; |
| 7640 |
if (!s.empty()) { |
| 7641 |
if (reason_printed) { |
| 7642 |
*listener << ",\nand "; |
| 7643 |
} |
| 7644 |
*listener << "whose element #" << i << " matches, " << s; |
| 7645 |
reason_printed = true; |
| 7646 |
} |
| 7647 |
} |
| 7648 |
} |
| 7649 |
return true; |
| 7650 |
} |
| 7651 |
|
| 7652 |
private: |
| 7653 |
static Message Elements(size_t count) { |
| 7654 |
return Message() << count << (count == 1 ? " element" : " elements"); |
| 7655 |
} |
| 7656 |
|
| 7657 |
size_t count() const { return matchers_.size(); } |
| 7658 |
|
| 7659 |
::std::vector<Matcher<const Element&> > matchers_; |
| 7660 |
|
| 7661 |
GTEST_DISALLOW_ASSIGN_(ElementsAreMatcherImpl); |
| 7662 |
}; |
| 7663 |
|
| 7664 |
|
| 7665 |
|
| 7666 |
|
| 7667 |
|
| 7668 |
class GTEST_API_ MatchMatrix { |
| 7669 |
public: |
| 7670 |
MatchMatrix(size_t num_elements, size_t num_matchers) |
| 7671 |
: num_elements_(num_elements), |
| 7672 |
num_matchers_(num_matchers), |
| 7673 |
matched_(num_elements_* num_matchers_, 0) { |
| 7674 |
} |
| 7675 |
|
| 7676 |
size_t LhsSize() const { return num_elements_; } |
| 7677 |
size_t RhsSize() const { return num_matchers_; } |
| 7678 |
bool HasEdge(size_t ilhs, size_t irhs) const { |
| 7679 |
return matched_[SpaceIndex(ilhs, irhs)] == 1; |
| 7680 |
} |
| 7681 |
void SetEdge(size_t ilhs, size_t irhs, bool b) { |
| 7682 |
matched_[SpaceIndex(ilhs, irhs)] = b ? 1 : 0; |
| 7683 |
} |
| 7684 |
|
| 7685 |
|
| 7686 |
|
| 7687 |
|
| 7688 |
bool NextGraph(); |
| 7689 |
|
| 7690 |
void Randomize(); |
| 7691 |
|
| 7692 |
string DebugString() const; |
| 7693 |
|
| 7694 |
private: |
| 7695 |
size_t SpaceIndex(size_t ilhs, size_t irhs) const { |
| 7696 |
return ilhs * num_matchers_ + irhs; |
| 7697 |
} |
| 7698 |
|
| 7699 |
size_t num_elements_; |
| 7700 |
size_t num_matchers_; |
| 7701 |
|
| 7702 |
|
| 7703 |
|
| 7704 |
|
| 7705 |
::std::vector<char> matched_; |
| 7706 |
}; |
| 7707 |
|
| 7708 |
typedef ::std::pair<size_t, size_t> ElementMatcherPair; |
| 7709 |
typedef ::std::vector<ElementMatcherPair> ElementMatcherPairs; |
| 7710 |
|
| 7711 |
|
| 7712 |
|
| 7713 |
GTEST_API_ ElementMatcherPairs |
| 7714 |
FindMaxBipartiteMatching(const MatchMatrix& g); |
| 7715 |
|
| 7716 |
GTEST_API_ bool FindPairing(const MatchMatrix& matrix, |
| 7717 |
MatchResultListener* listener); |
| 7718 |
|
| 7719 |
|
| 7720 |
|
| 7721 |
|
| 7722 |
class GTEST_API_ UnorderedElementsAreMatcherImplBase { |
| 7723 |
protected: |
| 7724 |
|
| 7725 |
|
| 7726 |
|
| 7727 |
typedef ::std::vector<const MatcherDescriberInterface*> MatcherDescriberVec; |
| 7728 |
|
| 7729 |
|
| 7730 |
void DescribeToImpl(::std::ostream* os) const; |
| 7731 |
|
| 7732 |
|
| 7733 |
void DescribeNegationToImpl(::std::ostream* os) const; |
| 7734 |
|
| 7735 |
bool VerifyAllElementsAndMatchersAreMatched( |
| 7736 |
const ::std::vector<string>& element_printouts, |
| 7737 |
const MatchMatrix& matrix, |
| 7738 |
MatchResultListener* listener) const; |
| 7739 |
|
| 7740 |
MatcherDescriberVec& matcher_describers() { |
| 7741 |
return matcher_describers_; |
| 7742 |
} |
| 7743 |
|
| 7744 |
static Message Elements(size_t n) { |
| 7745 |
return Message() << n << " element" << (n == 1 ? "" : "s"); |
| 7746 |
} |
| 7747 |
|
| 7748 |
private: |
| 7749 |
MatcherDescriberVec matcher_describers_; |
| 7750 |
|
| 7751 |
GTEST_DISALLOW_ASSIGN_(UnorderedElementsAreMatcherImplBase); |
| 7752 |
}; |
| 7753 |
|
| 7754 |
|
| 7755 |
template <typename Container> |
| 7756 |
class UnorderedElementsAreMatcherImpl |
| 7757 |
: public MatcherInterface<Container>, |
| 7758 |
public UnorderedElementsAreMatcherImplBase { |
| 7759 |
public: |
| 7760 |
typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer; |
| 7761 |
typedef internal::StlContainerView<RawContainer> View; |
| 7762 |
typedef typename View::type StlContainer; |
| 7763 |
typedef typename View::const_reference StlContainerReference; |
| 7764 |
typedef typename StlContainer::const_iterator StlContainerConstIterator; |
| 7765 |
typedef typename StlContainer::value_type Element; |
| 7766 |
|
| 7767 |
|
| 7768 |
|
| 7769 |
template <typename InputIter> |
| 7770 |
UnorderedElementsAreMatcherImpl(InputIter first, InputIter last) { |
| 7771 |
for (; first != last; ++first) { |
| 7772 |
matchers_.push_back(MatcherCast<const Element&>(*first)); |
| 7773 |
matcher_describers().push_back(matchers_.back().GetDescriber()); |
| 7774 |
} |
| 7775 |
} |
| 7776 |
|
| 7777 |
|
| 7778 |
virtual void DescribeTo(::std::ostream* os) const { |
| 7779 |
return UnorderedElementsAreMatcherImplBase::DescribeToImpl(os); |
| 7780 |
} |
| 7781 |
|
| 7782 |
|
| 7783 |
virtual void DescribeNegationTo(::std::ostream* os) const { |
| 7784 |
return UnorderedElementsAreMatcherImplBase::DescribeNegationToImpl(os); |
| 7785 |
} |
| 7786 |
|
| 7787 |
virtual bool MatchAndExplain(Container container, |
| 7788 |
MatchResultListener* listener) const { |
| 7789 |
StlContainerReference stl_container = View::ConstReference(container); |
| 7790 |
::std::vector<string> element_printouts; |
| 7791 |
MatchMatrix matrix = AnalyzeElements(stl_container.begin(), |
| 7792 |
stl_container.end(), |
| 7793 |
&element_printouts, |
| 7794 |
listener); |
| 7795 |
|
| 7796 |
const size_t actual_count = matrix.LhsSize(); |
| 7797 |
if (actual_count == 0 && matchers_.empty()) { |
| 7798 |
return true; |
| 7799 |
} |
| 7800 |
if (actual_count != matchers_.size()) { |
| 7801 |
|
| 7802 |
|
| 7803 |
|
| 7804 |
|
| 7805 |
if (actual_count != 0 && listener->IsInterested()) { |
| 7806 |
*listener << "which has " << Elements(actual_count); |
| 7807 |
} |
| 7808 |
return false; |
| 7809 |
} |
| 7810 |
|
| 7811 |
return VerifyAllElementsAndMatchersAreMatched(element_printouts, |
| 7812 |
matrix, listener) && |
| 7813 |
FindPairing(matrix, listener); |
| 7814 |
} |
| 7815 |
|
| 7816 |
private: |
| 7817 |
typedef ::std::vector<Matcher<const Element&> > MatcherVec; |
| 7818 |
|
| 7819 |
template <typename ElementIter> |
| 7820 |
MatchMatrix AnalyzeElements(ElementIter elem_first, ElementIter elem_last, |
| 7821 |
::std::vector<string>* element_printouts, |
| 7822 |
MatchResultListener* listener) const { |
| 7823 |
element_printouts->clear(); |
| 7824 |
::std::vector<char> did_match; |
| 7825 |
size_t num_elements = 0; |
| 7826 |
for (; elem_first != elem_last; ++num_elements, ++elem_first) { |
| 7827 |
if (listener->IsInterested()) { |
| 7828 |
element_printouts->push_back(PrintToString(*elem_first)); |
| 7829 |
} |
| 7830 |
for (size_t irhs = 0; irhs != matchers_.size(); ++irhs) { |
| 7831 |
did_match.push_back(Matches(matchers_[irhs])(*elem_first)); |
| 7832 |
} |
| 7833 |
} |
| 7834 |
|
| 7835 |
MatchMatrix matrix(num_elements, matchers_.size()); |
| 7836 |
::std::vector<char>::const_iterator did_match_iter = did_match.begin(); |
| 7837 |
for (size_t ilhs = 0; ilhs != num_elements; ++ilhs) { |
| 7838 |
for (size_t irhs = 0; irhs != matchers_.size(); ++irhs) { |
| 7839 |
matrix.SetEdge(ilhs, irhs, *did_match_iter++ != 0); |
| 7840 |
} |
| 7841 |
} |
| 7842 |
return matrix; |
| 7843 |
} |
| 7844 |
|
| 7845 |
MatcherVec matchers_; |
| 7846 |
|
| 7847 |
GTEST_DISALLOW_ASSIGN_(UnorderedElementsAreMatcherImpl); |
| 7848 |
}; |
| 7849 |
|
| 7850 |
|
| 7851 |
|
| 7852 |
template <typename Target> |
| 7853 |
struct CastAndAppendTransform { |
| 7854 |
template <typename Arg> |
| 7855 |
Matcher<Target> operator()(const Arg& a) const { |
| 7856 |
return MatcherCast<Target>(a); |
| 7857 |
} |
| 7858 |
}; |
| 7859 |
|
| 7860 |
|
| 7861 |
template <typename MatcherTuple> |
| 7862 |
class UnorderedElementsAreMatcher { |
| 7863 |
public: |
| 7864 |
explicit UnorderedElementsAreMatcher(const MatcherTuple& args) |
| 7865 |
: matchers_(args) {} |
| 7866 |
|
| 7867 |
template <typename Container> |
| 7868 |
operator Matcher<Container>() const { |
| 7869 |
typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer; |
| 7870 |
typedef typename internal::StlContainerView<RawContainer>::type View; |
| 7871 |
typedef typename View::value_type Element; |
| 7872 |
typedef ::std::vector<Matcher<const Element&> > MatcherVec; |
| 7873 |
MatcherVec matchers; |
| 7874 |
matchers.reserve(::std::tr1::tuple_size<MatcherTuple>::value); |
| 7875 |
TransformTupleValues(CastAndAppendTransform<const Element&>(), matchers_, |
| 7876 |
::std::back_inserter(matchers)); |
| 7877 |
return MakeMatcher(new UnorderedElementsAreMatcherImpl<Container>( |
| 7878 |
matchers.begin(), matchers.end())); |
| 7879 |
} |
| 7880 |
|
| 7881 |
private: |
| 7882 |
const MatcherTuple matchers_; |
| 7883 |
GTEST_DISALLOW_ASSIGN_(UnorderedElementsAreMatcher); |
| 7884 |
}; |
| 7885 |
|
| 7886 |
|
| 7887 |
template <typename MatcherTuple> |
| 7888 |
class ElementsAreMatcher { |
| 7889 |
public: |
| 7890 |
explicit ElementsAreMatcher(const MatcherTuple& args) : matchers_(args) {} |
| 7891 |
|
| 7892 |
template <typename Container> |
| 7893 |
operator Matcher<Container>() const { |
| 7894 |
typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer; |
| 7895 |
typedef typename internal::StlContainerView<RawContainer>::type View; |
| 7896 |
typedef typename View::value_type Element; |
| 7897 |
typedef ::std::vector<Matcher<const Element&> > MatcherVec; |
| 7898 |
MatcherVec matchers; |
| 7899 |
matchers.reserve(::std::tr1::tuple_size<MatcherTuple>::value); |
| 7900 |
TransformTupleValues(CastAndAppendTransform<const Element&>(), matchers_, |
| 7901 |
::std::back_inserter(matchers)); |
| 7902 |
return MakeMatcher(new ElementsAreMatcherImpl<Container>( |
| 7903 |
matchers.begin(), matchers.end())); |
| 7904 |
} |
| 7905 |
|
| 7906 |
private: |
| 7907 |
const MatcherTuple matchers_; |
| 7908 |
GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher); |
| 7909 |
}; |
| 7910 |
|
| 7911 |
|
| 7912 |
template <typename T> |
| 7913 |
class UnorderedElementsAreArrayMatcher { |
| 7914 |
public: |
| 7915 |
UnorderedElementsAreArrayMatcher() {} |
| 7916 |
|
| 7917 |
template <typename Iter> |
| 7918 |
UnorderedElementsAreArrayMatcher(Iter first, Iter last) |
| 7919 |
: matchers_(first, last) {} |
| 7920 |
|
| 7921 |
template <typename Container> |
| 7922 |
operator Matcher<Container>() const { |
| 7923 |
return MakeMatcher( |
| 7924 |
new UnorderedElementsAreMatcherImpl<Container>(matchers_.begin(), |
| 7925 |
matchers_.end())); |
| 7926 |
} |
| 7927 |
|
| 7928 |
private: |
| 7929 |
::std::vector<T> matchers_; |
| 7930 |
|
| 7931 |
GTEST_DISALLOW_ASSIGN_(UnorderedElementsAreArrayMatcher); |
| 7932 |
}; |
| 7933 |
|
| 7934 |
|
| 7935 |
template <typename T> |
| 7936 |
class ElementsAreArrayMatcher { |
| 7937 |
public: |
| 7938 |
template <typename Iter> |
| 7939 |
ElementsAreArrayMatcher(Iter first, Iter last) : matchers_(first, last) {} |
| 7940 |
|
| 7941 |
template <typename Container> |
| 7942 |
operator Matcher<Container>() const { |
| 7943 |
return MakeMatcher(new ElementsAreMatcherImpl<Container>( |
| 7944 |
matchers_.begin(), matchers_.end())); |
| 7945 |
} |
| 7946 |
|
| 7947 |
private: |
| 7948 |
const ::std::vector<T> matchers_; |
| 7949 |
|
| 7950 |
GTEST_DISALLOW_ASSIGN_(ElementsAreArrayMatcher); |
| 7951 |
}; |
| 7952 |
|
| 7953 |
|
| 7954 |
|
| 7955 |
|
| 7956 |
|
| 7957 |
|
| 7958 |
GTEST_API_ string FormatMatcherDescription(bool negation, |
| 7959 |
const char* matcher_name, |
| 7960 |
const Strings& param_values); |
| 7961 |
|
| 7962 |
} |
| 7963 |
|
| 7964 |
|
| 7965 |
|
| 7966 |
|
| 7967 |
|
| 7968 |
|
| 7969 |
|
| 7970 |
|
| 7971 |
|
| 7972 |
|
| 7973 |
|
| 7974 |
|
| 7975 |
|
| 7976 |
|
| 7977 |
|
| 7978 |
|
| 7979 |
template <typename Iter> |
| 7980 |
inline internal::ElementsAreArrayMatcher< |
| 7981 |
typename ::std::iterator_traits<Iter>::value_type> |
| 7982 |
ElementsAreArray(Iter first, Iter last) { |
| 7983 |
typedef typename ::std::iterator_traits<Iter>::value_type T; |
| 7984 |
return internal::ElementsAreArrayMatcher<T>(first, last); |
| 7985 |
} |
| 7986 |
|
| 7987 |
template <typename T> |
| 7988 |
inline internal::ElementsAreArrayMatcher<T> ElementsAreArray( |
| 7989 |
const T* pointer, size_t count) { |
| 7990 |
return ElementsAreArray(pointer, pointer + count); |
| 7991 |
} |
| 7992 |
|
| 7993 |
template <typename T, size_t N> |
| 7994 |
inline internal::ElementsAreArrayMatcher<T> ElementsAreArray( |
| 7995 |
const T (&array)[N]) { |
| 7996 |
return ElementsAreArray(array, N); |
| 7997 |
} |
| 7998 |
|
| 7999 |
template <typename T, typename A> |
| 8000 |
inline internal::ElementsAreArrayMatcher<T> ElementsAreArray( |
| 8001 |
const ::std::vector<T, A>& vec) { |
| 8002 |
return ElementsAreArray(vec.begin(), vec.end()); |
| 8003 |
} |
| 8004 |
|
| 8005 |
#if GTEST_LANG_CXX11 |
| 8006 |
template <typename T> |
| 8007 |
inline internal::ElementsAreArrayMatcher<T> |
| 8008 |
ElementsAreArray(::std::initializer_list<T> xs) { |
| 8009 |
return ElementsAreArray(xs.begin(), xs.end()); |
| 8010 |
} |
| 8011 |
#endif |
| 8012 |
|
| 8013 |
|
| 8014 |
|
| 8015 |
|
| 8016 |
|
| 8017 |
|
| 8018 |
|
| 8019 |
|
| 8020 |
|
| 8021 |
template <typename Iter> |
| 8022 |
inline internal::UnorderedElementsAreArrayMatcher< |
| 8023 |
typename ::std::iterator_traits<Iter>::value_type> |
| 8024 |
UnorderedElementsAreArray(Iter first, Iter last) { |
| 8025 |
typedef typename ::std::iterator_traits<Iter>::value_type T; |
| 8026 |
return internal::UnorderedElementsAreArrayMatcher<T>(first, last); |
| 8027 |
} |
| 8028 |
|
| 8029 |
template <typename T> |
| 8030 |
inline internal::UnorderedElementsAreArrayMatcher<T> |
| 8031 |
UnorderedElementsAreArray(const T* pointer, size_t count) { |
| 8032 |
return UnorderedElementsAreArray(pointer, pointer + count); |
| 8033 |
} |
| 8034 |
|
| 8035 |
template <typename T, size_t N> |
| 8036 |
inline internal::UnorderedElementsAreArrayMatcher<T> |
| 8037 |
UnorderedElementsAreArray(const T (&array)[N]) { |
| 8038 |
return UnorderedElementsAreArray(array, N); |
| 8039 |
} |
| 8040 |
|
| 8041 |
template <typename T, typename A> |
| 8042 |
inline internal::UnorderedElementsAreArrayMatcher<T> |
| 8043 |
UnorderedElementsAreArray(const ::std::vector<T, A>& vec) { |
| 8044 |
return UnorderedElementsAreArray(vec.begin(), vec.end()); |
| 8045 |
} |
| 8046 |
|
| 8047 |
#if GTEST_LANG_CXX11 |
| 8048 |
template <typename T> |
| 8049 |
inline internal::UnorderedElementsAreArrayMatcher<T> |
| 8050 |
UnorderedElementsAreArray(::std::initializer_list<T> xs) { |
| 8051 |
return UnorderedElementsAreArray(xs.begin(), xs.end()); |
| 8052 |
} |
| 8053 |
#endif |
| 8054 |
|
| 8055 |
|
| 8056 |
|
| 8057 |
|
| 8058 |
|
| 8059 |
|
| 8060 |
|
| 8061 |
|
| 8062 |
|
| 8063 |
|
| 8064 |
const internal::AnythingMatcher _ = {}; |
| 8065 |
|
| 8066 |
template <typename T> |
| 8067 |
inline Matcher<T> A() { return MakeMatcher(new internal::AnyMatcherImpl<T>()); } |
| 8068 |
|
| 8069 |
|
| 8070 |
template <typename T> |
| 8071 |
inline Matcher<T> An() { return A<T>(); } |
| 8072 |
|
| 8073 |
|
| 8074 |
|
| 8075 |
|
| 8076 |
template <typename T> |
| 8077 |
inline internal::EqMatcher<T> Eq(T x) { return internal::EqMatcher<T>(x); } |
| 8078 |
|
| 8079 |
|
| 8080 |
|
| 8081 |
template <typename T> |
| 8082 |
Matcher<T>::Matcher(T value) { *this = Eq(value); } |
| 8083 |
|
| 8084 |
|
| 8085 |
|
| 8086 |
|
| 8087 |
|
| 8088 |
|
| 8089 |
|
| 8090 |
|
| 8091 |
|
| 8092 |
|
| 8093 |
|
| 8094 |
|
| 8095 |
|
| 8096 |
template <typename Lhs, typename Rhs> |
| 8097 |
inline Matcher<Lhs> TypedEq(const Rhs& rhs) { return Eq(rhs); } |
| 8098 |
|
| 8099 |
|
| 8100 |
template <typename Rhs> |
| 8101 |
inline internal::GeMatcher<Rhs> Ge(Rhs x) { |
| 8102 |
return internal::GeMatcher<Rhs>(x); |
| 8103 |
} |
| 8104 |
|
| 8105 |
|
| 8106 |
template <typename Rhs> |
| 8107 |
inline internal::GtMatcher<Rhs> Gt(Rhs x) { |
| 8108 |
return internal::GtMatcher<Rhs>(x); |
| 8109 |
} |
| 8110 |
|
| 8111 |
|
| 8112 |
template <typename Rhs> |
| 8113 |
inline internal::LeMatcher<Rhs> Le(Rhs x) { |
| 8114 |
return internal::LeMatcher<Rhs>(x); |
| 8115 |
} |
| 8116 |
|
| 8117 |
|
| 8118 |
template <typename Rhs> |
| 8119 |
inline internal::LtMatcher<Rhs> Lt(Rhs x) { |
| 8120 |
return internal::LtMatcher<Rhs>(x); |
| 8121 |
} |
| 8122 |
|
| 8123 |
|
| 8124 |
template <typename Rhs> |
| 8125 |
inline internal::NeMatcher<Rhs> Ne(Rhs x) { |
| 8126 |
return internal::NeMatcher<Rhs>(x); |
| 8127 |
} |
| 8128 |
|
| 8129 |
|
| 8130 |
inline PolymorphicMatcher<internal::IsNullMatcher > IsNull() { |
| 8131 |
return MakePolymorphicMatcher(internal::IsNullMatcher()); |
| 8132 |
} |
| 8133 |
|
| 8134 |
|
| 8135 |
|
| 8136 |
|
| 8137 |
inline PolymorphicMatcher<internal::NotNullMatcher > NotNull() { |
| 8138 |
return MakePolymorphicMatcher(internal::NotNullMatcher()); |
| 8139 |
} |
| 8140 |
|
| 8141 |
|
| 8142 |
|
| 8143 |
template <typename T> |
| 8144 |
inline internal::RefMatcher<T&> Ref(T& x) { |
| 8145 |
return internal::RefMatcher<T&>(x); |
| 8146 |
} |
| 8147 |
|
| 8148 |
|
| 8149 |
|
| 8150 |
inline internal::FloatingEqMatcher<double> DoubleEq(double rhs) { |
| 8151 |
return internal::FloatingEqMatcher<double>(rhs, false); |
| 8152 |
} |
| 8153 |
|
| 8154 |
|
| 8155 |
|
| 8156 |
inline internal::FloatingEqMatcher<double> NanSensitiveDoubleEq(double rhs) { |
| 8157 |
return internal::FloatingEqMatcher<double>(rhs, true); |
| 8158 |
} |
| 8159 |
|
| 8160 |
|
| 8161 |
|
| 8162 |
|
| 8163 |
inline internal::FloatingEqMatcher<double> DoubleNear( |
| 8164 |
double rhs, double max_abs_error) { |
| 8165 |
return internal::FloatingEqMatcher<double>(rhs, false, max_abs_error); |
| 8166 |
} |
| 8167 |
|
| 8168 |
|
| 8169 |
|
| 8170 |
|
| 8171 |
inline internal::FloatingEqMatcher<double> NanSensitiveDoubleNear( |
| 8172 |
double rhs, double max_abs_error) { |
| 8173 |
return internal::FloatingEqMatcher<double>(rhs, true, max_abs_error); |
| 8174 |
} |
| 8175 |
|
| 8176 |
|
| 8177 |
|
| 8178 |
inline internal::FloatingEqMatcher<float> FloatEq(float rhs) { |
| 8179 |
return internal::FloatingEqMatcher<float>(rhs, false); |
| 8180 |
} |
| 8181 |
|
| 8182 |
|
| 8183 |
|
| 8184 |
inline internal::FloatingEqMatcher<float> NanSensitiveFloatEq(float rhs) { |
| 8185 |
return internal::FloatingEqMatcher<float>(rhs, true); |
| 8186 |
} |
| 8187 |
|
| 8188 |
|
| 8189 |
|
| 8190 |
|
| 8191 |
inline internal::FloatingEqMatcher<float> FloatNear( |
| 8192 |
float rhs, float max_abs_error) { |
| 8193 |
return internal::FloatingEqMatcher<float>(rhs, false, max_abs_error); |
| 8194 |
} |
| 8195 |
|
| 8196 |
|
| 8197 |
|
| 8198 |
|
| 8199 |
inline internal::FloatingEqMatcher<float> NanSensitiveFloatNear( |
| 8200 |
float rhs, float max_abs_error) { |
| 8201 |
return internal::FloatingEqMatcher<float>(rhs, true, max_abs_error); |
| 8202 |
} |
| 8203 |
|
| 8204 |
|
| 8205 |
|
| 8206 |
template <typename InnerMatcher> |
| 8207 |
inline internal::PointeeMatcher<InnerMatcher> Pointee( |
| 8208 |
const InnerMatcher& inner_matcher) { |
| 8209 |
return internal::PointeeMatcher<InnerMatcher>(inner_matcher); |
| 8210 |
} |
| 8211 |
|
| 8212 |
|
| 8213 |
|
| 8214 |
|
| 8215 |
|
| 8216 |
template <typename Class, typename FieldType, typename FieldMatcher> |
| 8217 |
inline PolymorphicMatcher< |
| 8218 |
internal::FieldMatcher<Class, FieldType> > Field( |
| 8219 |
FieldType Class::*field, const FieldMatcher& matcher) { |
| 8220 |
return MakePolymorphicMatcher( |
| 8221 |
internal::FieldMatcher<Class, FieldType>( |
| 8222 |
field, MatcherCast<const FieldType&>(matcher))); |
| 8223 |
|
| 8224 |
|
| 8225 |
|
| 8226 |
|
| 8227 |
} |
| 8228 |
|
| 8229 |
|
| 8230 |
|
| 8231 |
|
| 8232 |
|
| 8233 |
template <typename Class, typename PropertyType, typename PropertyMatcher> |
| 8234 |
inline PolymorphicMatcher< |
| 8235 |
internal::PropertyMatcher<Class, PropertyType> > Property( |
| 8236 |
PropertyType (Class::*property)() const, const PropertyMatcher& matcher) { |
| 8237 |
return MakePolymorphicMatcher( |
| 8238 |
internal::PropertyMatcher<Class, PropertyType>( |
| 8239 |
property, |
| 8240 |
MatcherCast<GTEST_REFERENCE_TO_CONST_(PropertyType)>(matcher))); |
| 8241 |
|
| 8242 |
|
| 8243 |
|
| 8244 |
|
| 8245 |
} |
| 8246 |
|
| 8247 |
|
| 8248 |
|
| 8249 |
|
| 8250 |
|
| 8251 |
|
| 8252 |
|
| 8253 |
|
| 8254 |
|
| 8255 |
|
| 8256 |
|
| 8257 |
|
| 8258 |
|
| 8259 |
|
| 8260 |
template <typename Callable, typename ResultOfMatcher> |
| 8261 |
internal::ResultOfMatcher<Callable> ResultOf( |
| 8262 |
Callable callable, const ResultOfMatcher& matcher) { |
| 8263 |
return internal::ResultOfMatcher<Callable>( |
| 8264 |
callable, |
| 8265 |
MatcherCast<typename internal::CallableTraits<Callable>::ResultType>( |
| 8266 |
matcher)); |
| 8267 |
|
| 8268 |
|
| 8269 |
|
| 8270 |
|
| 8271 |
} |
| 8272 |
|
| 8273 |
|
| 8274 |
|
| 8275 |
|
| 8276 |
inline PolymorphicMatcher<internal::StrEqualityMatcher<internal::string> > |
| 8277 |
StrEq(const internal::string& str) { |
| 8278 |
return MakePolymorphicMatcher(internal::StrEqualityMatcher<internal::string>( |
| 8279 |
str, true, true)); |
| 8280 |
} |
| 8281 |
|
| 8282 |
|
| 8283 |
inline PolymorphicMatcher<internal::StrEqualityMatcher<internal::string> > |
| 8284 |
StrNe(const internal::string& str) { |
| 8285 |
return MakePolymorphicMatcher(internal::StrEqualityMatcher<internal::string>( |
| 8286 |
str, false, true)); |
| 8287 |
} |
| 8288 |
|
| 8289 |
|
| 8290 |
inline PolymorphicMatcher<internal::StrEqualityMatcher<internal::string> > |
| 8291 |
StrCaseEq(const internal::string& str) { |
| 8292 |
return MakePolymorphicMatcher(internal::StrEqualityMatcher<internal::string>( |
| 8293 |
str, true, false)); |
| 8294 |
} |
| 8295 |
|
| 8296 |
|
| 8297 |
inline PolymorphicMatcher<internal::StrEqualityMatcher<internal::string> > |
| 8298 |
StrCaseNe(const internal::string& str) { |
| 8299 |
return MakePolymorphicMatcher(internal::StrEqualityMatcher<internal::string>( |
| 8300 |
str, false, false)); |
| 8301 |
} |
| 8302 |
|
| 8303 |
|
| 8304 |
|
| 8305 |
inline PolymorphicMatcher<internal::HasSubstrMatcher<internal::string> > |
| 8306 |
HasSubstr(const internal::string& substring) { |
| 8307 |
return MakePolymorphicMatcher(internal::HasSubstrMatcher<internal::string>( |
| 8308 |
substring)); |
| 8309 |
} |
| 8310 |
|
| 8311 |
|
| 8312 |
inline PolymorphicMatcher<internal::StartsWithMatcher<internal::string> > |
| 8313 |
StartsWith(const internal::string& prefix) { |
| 8314 |
return MakePolymorphicMatcher(internal::StartsWithMatcher<internal::string>( |
| 8315 |
prefix)); |
| 8316 |
} |
| 8317 |
|
| 8318 |
|
| 8319 |
inline PolymorphicMatcher<internal::EndsWithMatcher<internal::string> > |
| 8320 |
EndsWith(const internal::string& suffix) { |
| 8321 |
return MakePolymorphicMatcher(internal::EndsWithMatcher<internal::string>( |
| 8322 |
suffix)); |
| 8323 |
} |
| 8324 |
|
| 8325 |
|
| 8326 |
|
| 8327 |
inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex( |
| 8328 |
const internal::RE* regex) { |
| 8329 |
return MakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, true)); |
| 8330 |
} |
| 8331 |
inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex( |
| 8332 |
const internal::string& regex) { |
| 8333 |
return MatchesRegex(new internal::RE(regex)); |
| 8334 |
} |
| 8335 |
|
| 8336 |
|
| 8337 |
|
| 8338 |
inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex( |
| 8339 |
const internal::RE* regex) { |
| 8340 |
return MakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, false)); |
| 8341 |
} |
| 8342 |
inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex( |
| 8343 |
const internal::string& regex) { |
| 8344 |
return ContainsRegex(new internal::RE(regex)); |
| 8345 |
} |
| 8346 |
|
| 8347 |
#if GTEST_HAS_GLOBAL_WSTRING || GTEST_HAS_STD_WSTRING |
| 8348 |
|
| 8349 |
|
| 8350 |
|
| 8351 |
inline PolymorphicMatcher<internal::StrEqualityMatcher<internal::wstring> > |
| 8352 |
StrEq(const internal::wstring& str) { |
| 8353 |
return MakePolymorphicMatcher(internal::StrEqualityMatcher<internal::wstring>( |
| 8354 |
str, true, true)); |
| 8355 |
} |
| 8356 |
|
| 8357 |
|
| 8358 |
inline PolymorphicMatcher<internal::StrEqualityMatcher<internal::wstring> > |
| 8359 |
StrNe(const internal::wstring& str) { |
| 8360 |
return MakePolymorphicMatcher(internal::StrEqualityMatcher<internal::wstring>( |
| 8361 |
str, false, true)); |
| 8362 |
} |
| 8363 |
|
| 8364 |
|
| 8365 |
inline PolymorphicMatcher<internal::StrEqualityMatcher<internal::wstring> > |
| 8366 |
StrCaseEq(const internal::wstring& str) { |
| 8367 |
return MakePolymorphicMatcher(internal::StrEqualityMatcher<internal::wstring>( |
| 8368 |
str, true, false)); |
| 8369 |
} |
| 8370 |
|
| 8371 |
|
| 8372 |
inline PolymorphicMatcher<internal::StrEqualityMatcher<internal::wstring> > |
| 8373 |
StrCaseNe(const internal::wstring& str) { |
| 8374 |
return MakePolymorphicMatcher(internal::StrEqualityMatcher<internal::wstring>( |
| 8375 |
str, false, false)); |
| 8376 |
} |
| 8377 |
|
| 8378 |
|
| 8379 |
|
| 8380 |
inline PolymorphicMatcher<internal::HasSubstrMatcher<internal::wstring> > |
| 8381 |
HasSubstr(const internal::wstring& substring) { |
| 8382 |
return MakePolymorphicMatcher(internal::HasSubstrMatcher<internal::wstring>( |
| 8383 |
substring)); |
| 8384 |
} |
| 8385 |
|
| 8386 |
|
| 8387 |
inline PolymorphicMatcher<internal::StartsWithMatcher<internal::wstring> > |
| 8388 |
StartsWith(const internal::wstring& prefix) { |
| 8389 |
return MakePolymorphicMatcher(internal::StartsWithMatcher<internal::wstring>( |
| 8390 |
prefix)); |
| 8391 |
} |
| 8392 |
|
| 8393 |
|
| 8394 |
inline PolymorphicMatcher<internal::EndsWithMatcher<internal::wstring> > |
| 8395 |
EndsWith(const internal::wstring& suffix) { |
| 8396 |
return MakePolymorphicMatcher(internal::EndsWithMatcher<internal::wstring>( |
| 8397 |
suffix)); |
| 8398 |
} |
| 8399 |
|
| 8400 |
#endif |
| 8401 |
|
| 8402 |
|
| 8403 |
|
| 8404 |
inline internal::Eq2Matcher Eq() { return internal::Eq2Matcher(); } |
| 8405 |
|
| 8406 |
|
| 8407 |
|
| 8408 |
inline internal::Ge2Matcher Ge() { return internal::Ge2Matcher(); } |
| 8409 |
|
| 8410 |
|
| 8411 |
|
| 8412 |
inline internal::Gt2Matcher Gt() { return internal::Gt2Matcher(); } |
| 8413 |
|
| 8414 |
|
| 8415 |
|
| 8416 |
inline internal::Le2Matcher Le() { return internal::Le2Matcher(); } |
| 8417 |
|
| 8418 |
|
| 8419 |
|
| 8420 |
inline internal::Lt2Matcher Lt() { return internal::Lt2Matcher(); } |
| 8421 |
|
| 8422 |
|
| 8423 |
|
| 8424 |
inline internal::Ne2Matcher Ne() { return internal::Ne2Matcher(); } |
| 8425 |
|
| 8426 |
|
| 8427 |
|
| 8428 |
template <typename InnerMatcher> |
| 8429 |
inline internal::NotMatcher<InnerMatcher> Not(InnerMatcher m) { |
| 8430 |
return internal::NotMatcher<InnerMatcher>(m); |
| 8431 |
} |
| 8432 |
|
| 8433 |
|
| 8434 |
|
| 8435 |
|
| 8436 |
template <typename Predicate> |
| 8437 |
inline PolymorphicMatcher<internal::TrulyMatcher<Predicate> > |
| 8438 |
Truly(Predicate pred) { |
| 8439 |
return MakePolymorphicMatcher(internal::TrulyMatcher<Predicate>(pred)); |
| 8440 |
} |
| 8441 |
|
| 8442 |
|
| 8443 |
|
| 8444 |
|
| 8445 |
|
| 8446 |
|
| 8447 |
|
| 8448 |
template <typename SizeMatcher> |
| 8449 |
inline internal::SizeIsMatcher<SizeMatcher> |
| 8450 |
SizeIs(const SizeMatcher& size_matcher) { |
| 8451 |
return internal::SizeIsMatcher<SizeMatcher>(size_matcher); |
| 8452 |
} |
| 8453 |
|
| 8454 |
|
| 8455 |
|
| 8456 |
|
| 8457 |
|
| 8458 |
template <typename Container> |
| 8459 |
inline PolymorphicMatcher<internal::ContainerEqMatcher< |
| 8460 |
GTEST_REMOVE_CONST_(Container)> > |
| 8461 |
ContainerEq(const Container& rhs) { |
| 8462 |
|
| 8463 |
|
| 8464 |
typedef GTEST_REMOVE_CONST_(Container) RawContainer; |
| 8465 |
return MakePolymorphicMatcher( |
| 8466 |
internal::ContainerEqMatcher<RawContainer>(rhs)); |
| 8467 |
} |
| 8468 |
|
| 8469 |
|
| 8470 |
|
| 8471 |
template <typename Comparator, typename ContainerMatcher> |
| 8472 |
inline internal::WhenSortedByMatcher<Comparator, ContainerMatcher> |
| 8473 |
WhenSortedBy(const Comparator& comparator, |
| 8474 |
const ContainerMatcher& container_matcher) { |
| 8475 |
return internal::WhenSortedByMatcher<Comparator, ContainerMatcher>( |
| 8476 |
comparator, container_matcher); |
| 8477 |
} |
| 8478 |
|
| 8479 |
|
| 8480 |
|
| 8481 |
template <typename ContainerMatcher> |
| 8482 |
inline internal::WhenSortedByMatcher<internal::LessComparator, ContainerMatcher> |
| 8483 |
WhenSorted(const ContainerMatcher& container_matcher) { |
| 8484 |
return |
| 8485 |
internal::WhenSortedByMatcher<internal::LessComparator, ContainerMatcher>( |
| 8486 |
internal::LessComparator(), container_matcher); |
| 8487 |
} |
| 8488 |
|
| 8489 |
|
| 8490 |
|
| 8491 |
|
| 8492 |
|
| 8493 |
|
| 8494 |
|
| 8495 |
template <typename TupleMatcher, typename Container> |
| 8496 |
inline internal::PointwiseMatcher<TupleMatcher, |
| 8497 |
GTEST_REMOVE_CONST_(Container)> |
| 8498 |
Pointwise(const TupleMatcher& tuple_matcher, const Container& rhs) { |
| 8499 |
|
| 8500 |
|
| 8501 |
typedef GTEST_REMOVE_CONST_(Container) RawContainer; |
| 8502 |
return internal::PointwiseMatcher<TupleMatcher, RawContainer>( |
| 8503 |
tuple_matcher, rhs); |
| 8504 |
} |
| 8505 |
|
| 8506 |
|
| 8507 |
|
| 8508 |
|
| 8509 |
|
| 8510 |
|
| 8511 |
|
| 8512 |
|
| 8513 |
|
| 8514 |
|
| 8515 |
|
| 8516 |
|
| 8517 |
|
| 8518 |
|
| 8519 |
|
| 8520 |
|
| 8521 |
|
| 8522 |
|
| 8523 |
|
| 8524 |
template <typename M> |
| 8525 |
inline internal::ContainsMatcher<M> Contains(M matcher) { |
| 8526 |
return internal::ContainsMatcher<M>(matcher); |
| 8527 |
} |
| 8528 |
|
| 8529 |
|
| 8530 |
|
| 8531 |
|
| 8532 |
|
| 8533 |
|
| 8534 |
|
| 8535 |
|
| 8536 |
|
| 8537 |
|
| 8538 |
|
| 8539 |
|
| 8540 |
|
| 8541 |
|
| 8542 |
|
| 8543 |
|
| 8544 |
|
| 8545 |
|
| 8546 |
|
| 8547 |
|
| 8548 |
|
| 8549 |
|
| 8550 |
|
| 8551 |
|
| 8552 |
|
| 8553 |
|
| 8554 |
|
| 8555 |
|
| 8556 |
template <typename M> |
| 8557 |
inline internal::EachMatcher<M> Each(M matcher) { |
| 8558 |
return internal::EachMatcher<M>(matcher); |
| 8559 |
} |
| 8560 |
|
| 8561 |
|
| 8562 |
|
| 8563 |
|
| 8564 |
template <typename M> |
| 8565 |
inline internal::KeyMatcher<M> Key(M inner_matcher) { |
| 8566 |
return internal::KeyMatcher<M>(inner_matcher); |
| 8567 |
} |
| 8568 |
|
| 8569 |
|
| 8570 |
|
| 8571 |
|
| 8572 |
|
| 8573 |
|
| 8574 |
template <typename FirstMatcher, typename SecondMatcher> |
| 8575 |
inline internal::PairMatcher<FirstMatcher, SecondMatcher> |
| 8576 |
Pair(FirstMatcher first_matcher, SecondMatcher second_matcher) { |
| 8577 |
return internal::PairMatcher<FirstMatcher, SecondMatcher>( |
| 8578 |
first_matcher, second_matcher); |
| 8579 |
} |
| 8580 |
|
| 8581 |
|
| 8582 |
|
| 8583 |
template <typename M> |
| 8584 |
inline internal::MatcherAsPredicate<M> Matches(M matcher) { |
| 8585 |
return internal::MatcherAsPredicate<M>(matcher); |
| 8586 |
} |
| 8587 |
|
| 8588 |
|
| 8589 |
template <typename T, typename M> |
| 8590 |
inline bool Value(const T& value, M matcher) { |
| 8591 |
return testing::Matches(matcher)(value); |
| 8592 |
} |
| 8593 |
|
| 8594 |
|
| 8595 |
|
| 8596 |
template <typename T, typename M> |
| 8597 |
inline bool ExplainMatchResult( |
| 8598 |
M matcher, const T& value, MatchResultListener* listener) { |
| 8599 |
return SafeMatcherCast<const T&>(matcher).MatchAndExplain(value, listener); |
| 8600 |
} |
| 8601 |
|
| 8602 |
#if GTEST_LANG_CXX11 |
| 8603 |
|
| 8604 |
|
| 8605 |
template <typename... Args> |
| 8606 |
inline internal::AllOfMatcher<Args...> AllOf(const Args&... matchers) { |
| 8607 |
return internal::AllOfMatcher<Args...>(matchers...); |
| 8608 |
} |
| 8609 |
|
| 8610 |
template <typename... Args> |
| 8611 |
inline internal::AnyOfMatcher<Args...> AnyOf(const Args&... matchers) { |
| 8612 |
return internal::AnyOfMatcher<Args...>(matchers...); |
| 8613 |
} |
| 8614 |
|
| 8615 |
#endif |
| 8616 |
|
| 8617 |
|
| 8618 |
|
| 8619 |
|
| 8620 |
|
| 8621 |
|
| 8622 |
|
| 8623 |
|
| 8624 |
template <typename InnerMatcher> |
| 8625 |
inline InnerMatcher AllArgs(const InnerMatcher& matcher) { return matcher; } |
| 8626 |
|
| 8627 |
|
| 8628 |
|
| 8629 |
|
| 8630 |
|
| 8631 |
#define ASSERT_THAT(value, matcher) ASSERT_PRED_FORMAT1(\ |
| 8632 |
::testing::internal::MakePredicateFormatterFromMatcher(matcher), value) |
| 8633 |
#define EXPECT_THAT(value, matcher) EXPECT_PRED_FORMAT1(\ |
| 8634 |
::testing::internal::MakePredicateFormatterFromMatcher(matcher), value) |
| 8635 |
|
| 8636 |
} |
| 8637 |
|
| 8638 |
#endif |
| 8639 |
|
| 8640 |
namespace testing { |
| 8641 |
|
| 8642 |
|
| 8643 |
class Expectation; |
| 8644 |
|
| 8645 |
|
| 8646 |
class ExpectationSet; |
| 8647 |
|
| 8648 |
|
| 8649 |
|
| 8650 |
namespace internal { |
| 8651 |
|
| 8652 |
|
| 8653 |
template <typename F> class FunctionMocker; |
| 8654 |
|
| 8655 |
|
| 8656 |
class ExpectationBase; |
| 8657 |
|
| 8658 |
|
| 8659 |
template <typename F> class TypedExpectation; |
| 8660 |
|
| 8661 |
|
| 8662 |
class ExpectationTester; |
| 8663 |
|
| 8664 |
|
| 8665 |
template <typename F> class FunctionMockerBase; |
| 8666 |
|
| 8667 |
|
| 8668 |
|
| 8669 |
|
| 8670 |
|
| 8671 |
|
| 8672 |
|
| 8673 |
|
| 8674 |
|
| 8675 |
|
| 8676 |
|
| 8677 |
|
| 8678 |
GTEST_API_ GTEST_DECLARE_STATIC_MUTEX_(g_gmock_mutex); |
| 8679 |
|
| 8680 |
|
| 8681 |
class UntypedActionResultHolderBase; |
| 8682 |
|
| 8683 |
|
| 8684 |
|
| 8685 |
|
| 8686 |
class GTEST_API_ UntypedFunctionMockerBase { |
| 8687 |
public: |
| 8688 |
UntypedFunctionMockerBase(); |
| 8689 |
virtual ~UntypedFunctionMockerBase(); |
| 8690 |
|
| 8691 |
|
| 8692 |
|
| 8693 |
|
| 8694 |
bool VerifyAndClearExpectationsLocked() |
| 8695 |
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex); |
| 8696 |
|
| 8697 |
|
| 8698 |
virtual void ClearDefaultActionsLocked() |
| 8699 |
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) = 0; |
| 8700 |
|
| 8701 |
|
| 8702 |
|
| 8703 |
|
| 8704 |
|
| 8705 |
|
| 8706 |
|
| 8707 |
|
| 8708 |
|
| 8709 |
|
| 8710 |
virtual UntypedActionResultHolderBase* UntypedPerformDefaultAction( |
| 8711 |
const void* untyped_args, |
| 8712 |
const string& call_description) const = 0; |
| 8713 |
|
| 8714 |
|
| 8715 |
|
| 8716 |
|
| 8717 |
virtual UntypedActionResultHolderBase* UntypedPerformAction( |
| 8718 |
const void* untyped_action, |
| 8719 |
const void* untyped_args) const = 0; |
| 8720 |
|
| 8721 |
|
| 8722 |
|
| 8723 |
|
| 8724 |
virtual void UntypedDescribeUninterestingCall( |
| 8725 |
const void* untyped_args, |
| 8726 |
::std::ostream* os) const |
| 8727 |
GTEST_LOCK_EXCLUDED_(g_gmock_mutex) = 0; |
| 8728 |
|
| 8729 |
|
| 8730 |
|
| 8731 |
|
| 8732 |
|
| 8733 |
|
| 8734 |
|
| 8735 |
virtual const ExpectationBase* UntypedFindMatchingExpectation( |
| 8736 |
const void* untyped_args, |
| 8737 |
const void** untyped_action, bool* is_excessive, |
| 8738 |
::std::ostream* what, ::std::ostream* why) |
| 8739 |
GTEST_LOCK_EXCLUDED_(g_gmock_mutex) = 0; |
| 8740 |
|
| 8741 |
|
| 8742 |
virtual void UntypedPrintArgs(const void* untyped_args, |
| 8743 |
::std::ostream* os) const = 0; |
| 8744 |
|
| 8745 |
|
| 8746 |
|
| 8747 |
|
| 8748 |
|
| 8749 |
|
| 8750 |
void RegisterOwner(const void* mock_obj) |
| 8751 |
GTEST_LOCK_EXCLUDED_(g_gmock_mutex); |
| 8752 |
|
| 8753 |
|
| 8754 |
|
| 8755 |
|
| 8756 |
void SetOwnerAndName(const void* mock_obj, const char* name) |
| 8757 |
GTEST_LOCK_EXCLUDED_(g_gmock_mutex); |
| 8758 |
|
| 8759 |
|
| 8760 |
|
| 8761 |
|
| 8762 |
const void* MockObject() const |
| 8763 |
GTEST_LOCK_EXCLUDED_(g_gmock_mutex); |
| 8764 |
|
| 8765 |
|
| 8766 |
|
| 8767 |
const char* Name() const |
| 8768 |
GTEST_LOCK_EXCLUDED_(g_gmock_mutex); |
| 8769 |
|
| 8770 |
|
| 8771 |
|
| 8772 |
|
| 8773 |
|
| 8774 |
const UntypedActionResultHolderBase* UntypedInvokeWith( |
| 8775 |
const void* untyped_args) |
| 8776 |
GTEST_LOCK_EXCLUDED_(g_gmock_mutex); |
| 8777 |
|
| 8778 |
protected: |
| 8779 |
typedef std::vector<const void*> UntypedOnCallSpecs; |
| 8780 |
|
| 8781 |
typedef std::vector<internal::linked_ptr<ExpectationBase> > |
| 8782 |
UntypedExpectations; |
| 8783 |
|
| 8784 |
|
| 8785 |
|
| 8786 |
Expectation GetHandleOf(ExpectationBase* exp); |
| 8787 |
|
| 8788 |
|
| 8789 |
|
| 8790 |
|
| 8791 |
const void* mock_obj_; |
| 8792 |
|
| 8793 |
|
| 8794 |
|
| 8795 |
const char* name_; |
| 8796 |
|
| 8797 |
|
| 8798 |
UntypedOnCallSpecs untyped_on_call_specs_; |
| 8799 |
|
| 8800 |
|
| 8801 |
UntypedExpectations untyped_expectations_; |
| 8802 |
}; |
| 8803 |
|
| 8804 |
|
| 8805 |
class UntypedOnCallSpecBase { |
| 8806 |
public: |
| 8807 |
|
| 8808 |
UntypedOnCallSpecBase(const char* a_file, int a_line) |
| 8809 |
: file_(a_file), line_(a_line), last_clause_(kNone) {} |
| 8810 |
|
| 8811 |
|
| 8812 |
const char* file() const { return file_; } |
| 8813 |
int line() const { return line_; } |
| 8814 |
|
| 8815 |
protected: |
| 8816 |
|
| 8817 |
enum Clause { |
| 8818 |
|
| 8819 |
|
| 8820 |
kNone, |
| 8821 |
kWith, |
| 8822 |
kWillByDefault |
| 8823 |
}; |
| 8824 |
|
| 8825 |
|
| 8826 |
void AssertSpecProperty(bool property, const string& failure_message) const { |
| 8827 |
Assert(property, file_, line_, failure_message); |
| 8828 |
} |
| 8829 |
|
| 8830 |
|
| 8831 |
void ExpectSpecProperty(bool property, const string& failure_message) const { |
| 8832 |
Expect(property, file_, line_, failure_message); |
| 8833 |
} |
| 8834 |
|
| 8835 |
const char* file_; |
| 8836 |
int line_; |
| 8837 |
|
| 8838 |
|
| 8839 |
|
| 8840 |
Clause last_clause_; |
| 8841 |
}; |
| 8842 |
|
| 8843 |
|
| 8844 |
template <typename F> |
| 8845 |
class OnCallSpec : public UntypedOnCallSpecBase { |
| 8846 |
public: |
| 8847 |
typedef typename Function<F>::ArgumentTuple ArgumentTuple; |
| 8848 |
typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple; |
| 8849 |
|
| 8850 |
|
| 8851 |
|
| 8852 |
OnCallSpec(const char* a_file, int a_line, |
| 8853 |
const ArgumentMatcherTuple& matchers) |
| 8854 |
: UntypedOnCallSpecBase(a_file, a_line), |
| 8855 |
matchers_(matchers), |
| 8856 |
|
| 8857 |
|
| 8858 |
|
| 8859 |
|
| 8860 |
extra_matcher_(A<const ArgumentTuple&>()) { |
| 8861 |
} |
| 8862 |
|
| 8863 |
|
| 8864 |
OnCallSpec& With(const Matcher<const ArgumentTuple&>& m) { |
| 8865 |
|
| 8866 |
ExpectSpecProperty(last_clause_ < kWith, |
| 8867 |
".With() cannot appear " |
| 8868 |
"more than once in an ON_CALL()."); |
| 8869 |
last_clause_ = kWith; |
| 8870 |
|
| 8871 |
extra_matcher_ = m; |
| 8872 |
return *this; |
| 8873 |
} |
| 8874 |
|
| 8875 |
|
| 8876 |
OnCallSpec& WillByDefault(const Action<F>& action) { |
| 8877 |
ExpectSpecProperty(last_clause_ < kWillByDefault, |
| 8878 |
".WillByDefault() must appear " |
| 8879 |
"exactly once in an ON_CALL()."); |
| 8880 |
last_clause_ = kWillByDefault; |
| 8881 |
|
| 8882 |
ExpectSpecProperty(!action.IsDoDefault(), |
| 8883 |
"DoDefault() cannot be used in ON_CALL()."); |
| 8884 |
action_ = action; |
| 8885 |
return *this; |
| 8886 |
} |
| 8887 |
|
| 8888 |
|
| 8889 |
bool Matches(const ArgumentTuple& args) const { |
| 8890 |
return TupleMatches(matchers_, args) && extra_matcher_.Matches(args); |
| 8891 |
} |
| 8892 |
|
| 8893 |
|
| 8894 |
const Action<F>& GetAction() const { |
| 8895 |
AssertSpecProperty(last_clause_ == kWillByDefault, |
| 8896 |
".WillByDefault() must appear exactly " |
| 8897 |
"once in an ON_CALL()."); |
| 8898 |
return action_; |
| 8899 |
} |
| 8900 |
|
| 8901 |
private: |
| 8902 |
|
| 8903 |
|
| 8904 |
|
| 8905 |
|
| 8906 |
|
| 8907 |
|
| 8908 |
|
| 8909 |
|
| 8910 |
|
| 8911 |
|
| 8912 |
|
| 8913 |
|
| 8914 |
|
| 8915 |
ArgumentMatcherTuple matchers_; |
| 8916 |
Matcher<const ArgumentTuple&> extra_matcher_; |
| 8917 |
Action<F> action_; |
| 8918 |
}; |
| 8919 |
|
| 8920 |
|
| 8921 |
enum CallReaction { |
| 8922 |
kAllow, |
| 8923 |
kWarn, |
| 8924 |
kFail, |
| 8925 |
kDefault = kWarn |
| 8926 |
}; |
| 8927 |
|
| 8928 |
} |
| 8929 |
|
| 8930 |
|
| 8931 |
class GTEST_API_ Mock { |
| 8932 |
public: |
| 8933 |
|
| 8934 |
|
| 8935 |
|
| 8936 |
|
| 8937 |
static void AllowLeak(const void* mock_obj) |
| 8938 |
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); |
| 8939 |
|
| 8940 |
|
| 8941 |
|
| 8942 |
|
| 8943 |
static bool VerifyAndClearExpectations(void* mock_obj) |
| 8944 |
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); |
| 8945 |
|
| 8946 |
|
| 8947 |
|
| 8948 |
|
| 8949 |
static bool VerifyAndClear(void* mock_obj) |
| 8950 |
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); |
| 8951 |
|
| 8952 |
private: |
| 8953 |
friend class internal::UntypedFunctionMockerBase; |
| 8954 |
|
| 8955 |
|
| 8956 |
|
| 8957 |
template <typename F> |
| 8958 |
friend class internal::FunctionMockerBase; |
| 8959 |
|
| 8960 |
template <typename M> |
| 8961 |
friend class NiceMock; |
| 8962 |
|
| 8963 |
template <typename M> |
| 8964 |
friend class NaggyMock; |
| 8965 |
|
| 8966 |
template <typename M> |
| 8967 |
friend class StrictMock; |
| 8968 |
|
| 8969 |
|
| 8970 |
|
| 8971 |
static void AllowUninterestingCalls(const void* mock_obj) |
| 8972 |
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); |
| 8973 |
|
| 8974 |
|
| 8975 |
|
| 8976 |
static void WarnUninterestingCalls(const void* mock_obj) |
| 8977 |
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); |
| 8978 |
|
| 8979 |
|
| 8980 |
|
| 8981 |
static void FailUninterestingCalls(const void* mock_obj) |
| 8982 |
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); |
| 8983 |
|
| 8984 |
|
| 8985 |
|
| 8986 |
static void UnregisterCallReaction(const void* mock_obj) |
| 8987 |
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); |
| 8988 |
|
| 8989 |
|
| 8990 |
|
| 8991 |
static internal::CallReaction GetReactionOnUninterestingCalls( |
| 8992 |
const void* mock_obj) |
| 8993 |
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); |
| 8994 |
|
| 8995 |
|
| 8996 |
|
| 8997 |
|
| 8998 |
static bool VerifyAndClearExpectationsLocked(void* mock_obj) |
| 8999 |
GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex); |
| 9000 |
|
| 9001 |
|
| 9002 |
static void ClearDefaultActionsLocked(void* mock_obj) |
| 9003 |
GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex); |
| 9004 |
|
| 9005 |
|
| 9006 |
static void Register( |
| 9007 |
const void* mock_obj, |
| 9008 |
internal::UntypedFunctionMockerBase* mocker) |
| 9009 |
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); |
| 9010 |
|
| 9011 |
|
| 9012 |
|
| 9013 |
|
| 9014 |
static void RegisterUseByOnCallOrExpectCall( |
| 9015 |
const void* mock_obj, const char* file, int line) |
| 9016 |
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); |
| 9017 |
|
| 9018 |
|
| 9019 |
|
| 9020 |
|
| 9021 |
|
| 9022 |
static void UnregisterLocked(internal::UntypedFunctionMockerBase* mocker) |
| 9023 |
GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex); |
| 9024 |
}; |
| 9025 |
|
| 9026 |
|
| 9027 |
|
| 9028 |
|
| 9029 |
|
| 9030 |
|
| 9031 |
|
| 9032 |
|
| 9033 |
|
| 9034 |
|
| 9035 |
|
| 9036 |
|
| 9037 |
|
| 9038 |
|
| 9039 |
|
| 9040 |
|
| 9041 |
|
| 9042 |
|
| 9043 |
|
| 9044 |
|
| 9045 |
|
| 9046 |
|
| 9047 |
class GTEST_API_ Expectation { |
| 9048 |
public: |
| 9049 |
|
| 9050 |
Expectation(); |
| 9051 |
|
| 9052 |
~Expectation(); |
| 9053 |
|
| 9054 |
|
| 9055 |
|
| 9056 |
|
| 9057 |
|
| 9058 |
|
| 9059 |
|
| 9060 |
|
| 9061 |
|
| 9062 |
|
| 9063 |
Expectation(internal::ExpectationBase& exp); |
| 9064 |
|
| 9065 |
|
| 9066 |
|
| 9067 |
|
| 9068 |
|
| 9069 |
bool operator==(const Expectation& rhs) const { |
| 9070 |
return expectation_base_ == rhs.expectation_base_; |
| 9071 |
} |
| 9072 |
|
| 9073 |
bool operator!=(const Expectation& rhs) const { return !(*this == rhs); } |
| 9074 |
|
| 9075 |
private: |
| 9076 |
friend class ExpectationSet; |
| 9077 |
friend class Sequence; |
| 9078 |
friend class ::testing::internal::ExpectationBase; |
| 9079 |
friend class ::testing::internal::UntypedFunctionMockerBase; |
| 9080 |
|
| 9081 |
template <typename F> |
| 9082 |
friend class ::testing::internal::FunctionMockerBase; |
| 9083 |
|
| 9084 |
template <typename F> |
| 9085 |
friend class ::testing::internal::TypedExpectation; |
| 9086 |
|
| 9087 |
|
| 9088 |
class Less { |
| 9089 |
public: |
| 9090 |
bool operator()(const Expectation& lhs, const Expectation& rhs) const { |
| 9091 |
return lhs.expectation_base_.get() < rhs.expectation_base_.get(); |
| 9092 |
} |
| 9093 |
}; |
| 9094 |
|
| 9095 |
typedef ::std::set<Expectation, Less> Set; |
| 9096 |
|
| 9097 |
Expectation( |
| 9098 |
const internal::linked_ptr<internal::ExpectationBase>& expectation_base); |
| 9099 |
|
| 9100 |
|
| 9101 |
const internal::linked_ptr<internal::ExpectationBase>& |
| 9102 |
expectation_base() const { |
| 9103 |
return expectation_base_; |
| 9104 |
} |
| 9105 |
|
| 9106 |
|
| 9107 |
internal::linked_ptr<internal::ExpectationBase> expectation_base_; |
| 9108 |
}; |
| 9109 |
|
| 9110 |
|
| 9111 |
|
| 9112 |
|
| 9113 |
|
| 9114 |
|
| 9115 |
|
| 9116 |
|
| 9117 |
|
| 9118 |
|
| 9119 |
|
| 9120 |
|
| 9121 |
|
| 9122 |
|
| 9123 |
class ExpectationSet { |
| 9124 |
public: |
| 9125 |
|
| 9126 |
typedef Expectation::Set::const_iterator const_iterator; |
| 9127 |
|
| 9128 |
|
| 9129 |
typedef Expectation::Set::value_type value_type; |
| 9130 |
|
| 9131 |
|
| 9132 |
ExpectationSet() {} |
| 9133 |
|
| 9134 |
|
| 9135 |
|
| 9136 |
|
| 9137 |
ExpectationSet(internal::ExpectationBase& exp) { |
| 9138 |
*this += Expectation(exp); |
| 9139 |
} |
| 9140 |
|
| 9141 |
|
| 9142 |
|
| 9143 |
|
| 9144 |
ExpectationSet(const Expectation& e) { |
| 9145 |
*this += e; |
| 9146 |
} |
| 9147 |
|
| 9148 |
|
| 9149 |
|
| 9150 |
|
| 9151 |
|
| 9152 |
|
| 9153 |
bool operator==(const ExpectationSet& rhs) const { |
| 9154 |
return expectations_ == rhs.expectations_; |
| 9155 |
} |
| 9156 |
|
| 9157 |
bool operator!=(const ExpectationSet& rhs) const { return !(*this == rhs); } |
| 9158 |
|
| 9159 |
|
| 9160 |
|
| 9161 |
ExpectationSet& operator+=(const Expectation& e) { |
| 9162 |
expectations_.insert(e); |
| 9163 |
return *this; |
| 9164 |
} |
| 9165 |
|
| 9166 |
int size() const { return static_cast<int>(expectations_.size()); } |
| 9167 |
|
| 9168 |
const_iterator begin() const { return expectations_.begin(); } |
| 9169 |
const_iterator end() const { return expectations_.end(); } |
| 9170 |
|
| 9171 |
private: |
| 9172 |
Expectation::Set expectations_; |
| 9173 |
}; |
| 9174 |
|
| 9175 |
|
| 9176 |
|
| 9177 |
|
| 9178 |
|
| 9179 |
class GTEST_API_ Sequence { |
| 9180 |
public: |
| 9181 |
|
| 9182 |
Sequence() : last_expectation_(new Expectation) {} |
| 9183 |
|
| 9184 |
|
| 9185 |
|
| 9186 |
void AddExpectation(const Expectation& expectation) const; |
| 9187 |
|
| 9188 |
private: |
| 9189 |
|
| 9190 |
|
| 9191 |
|
| 9192 |
|
| 9193 |
internal::linked_ptr<Expectation> last_expectation_; |
| 9194 |
}; |
| 9195 |
|
| 9196 |
|
| 9197 |
|
| 9198 |
|
| 9199 |
|
| 9200 |
|
| 9201 |
|
| 9202 |
|
| 9203 |
|
| 9204 |
|
| 9205 |
|
| 9206 |
|
| 9207 |
|
| 9208 |
|
| 9209 |
|
| 9210 |
|
| 9211 |
|
| 9212 |
|
| 9213 |
|
| 9214 |
|
| 9215 |
|
| 9216 |
|
| 9217 |
|
| 9218 |
|
| 9219 |
|
| 9220 |
class GTEST_API_ InSequence { |
| 9221 |
public: |
| 9222 |
InSequence(); |
| 9223 |
~InSequence(); |
| 9224 |
private: |
| 9225 |
bool sequence_created_; |
| 9226 |
|
| 9227 |
GTEST_DISALLOW_COPY_AND_ASSIGN_(InSequence); |
| 9228 |
} GTEST_ATTRIBUTE_UNUSED_; |
| 9229 |
|
| 9230 |
namespace internal { |
| 9231 |
|
| 9232 |
|
| 9233 |
|
| 9234 |
GTEST_API_ extern ThreadLocal<Sequence*> g_gmock_implicit_sequence; |
| 9235 |
|
| 9236 |
|
| 9237 |
|
| 9238 |
|
| 9239 |
|
| 9240 |
|
| 9241 |
|
| 9242 |
|
| 9243 |
|
| 9244 |
|
| 9245 |
|
| 9246 |
|
| 9247 |
|
| 9248 |
|
| 9249 |
|
| 9250 |
class GTEST_API_ ExpectationBase { |
| 9251 |
public: |
| 9252 |
|
| 9253 |
ExpectationBase(const char* file, int line, const string& source_text); |
| 9254 |
|
| 9255 |
virtual ~ExpectationBase(); |
| 9256 |
|
| 9257 |
|
| 9258 |
const char* file() const { return file_; } |
| 9259 |
int line() const { return line_; } |
| 9260 |
const char* source_text() const { return source_text_.c_str(); } |
| 9261 |
|
| 9262 |
const Cardinality& cardinality() const { return cardinality_; } |
| 9263 |
|
| 9264 |
|
| 9265 |
void DescribeLocationTo(::std::ostream* os) const { |
| 9266 |
*os << FormatFileLocation(file(), line()) << " "; |
| 9267 |
} |
| 9268 |
|
| 9269 |
|
| 9270 |
|
| 9271 |
void DescribeCallCountTo(::std::ostream* os) const |
| 9272 |
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex); |
| 9273 |
|
| 9274 |
|
| 9275 |
|
| 9276 |
virtual void MaybeDescribeExtraMatcherTo(::std::ostream* os) = 0; |
| 9277 |
|
| 9278 |
protected: |
| 9279 |
friend class ::testing::Expectation; |
| 9280 |
friend class UntypedFunctionMockerBase; |
| 9281 |
|
| 9282 |
enum Clause { |
| 9283 |
|
| 9284 |
kNone, |
| 9285 |
kWith, |
| 9286 |
kTimes, |
| 9287 |
kInSequence, |
| 9288 |
kAfter, |
| 9289 |
kWillOnce, |
| 9290 |
kWillRepeatedly, |
| 9291 |
kRetiresOnSaturation |
| 9292 |
}; |
| 9293 |
|
| 9294 |
typedef std::vector<const void*> UntypedActions; |
| 9295 |
|
| 9296 |
|
| 9297 |
|
| 9298 |
virtual Expectation GetHandle() = 0; |
| 9299 |
|
| 9300 |
|
| 9301 |
void AssertSpecProperty(bool property, const string& failure_message) const { |
| 9302 |
Assert(property, file_, line_, failure_message); |
| 9303 |
} |
| 9304 |
|
| 9305 |
|
| 9306 |
void ExpectSpecProperty(bool property, const string& failure_message) const { |
| 9307 |
Expect(property, file_, line_, failure_message); |
| 9308 |
} |
| 9309 |
|
| 9310 |
|
| 9311 |
|
| 9312 |
void SpecifyCardinality(const Cardinality& cardinality); |
| 9313 |
|
| 9314 |
|
| 9315 |
|
| 9316 |
bool cardinality_specified() const { return cardinality_specified_; } |
| 9317 |
|
| 9318 |
|
| 9319 |
void set_cardinality(const Cardinality& a_cardinality) { |
| 9320 |
cardinality_ = a_cardinality; |
| 9321 |
} |
| 9322 |
|
| 9323 |
|
| 9324 |
|
| 9325 |
|
| 9326 |
|
| 9327 |
|
| 9328 |
void RetireAllPreRequisites() |
| 9329 |
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex); |
| 9330 |
|
| 9331 |
|
| 9332 |
bool is_retired() const |
| 9333 |
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { |
| 9334 |
g_gmock_mutex.AssertHeld(); |
| 9335 |
return retired_; |
| 9336 |
} |
| 9337 |
|
| 9338 |
|
| 9339 |
void Retire() |
| 9340 |
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { |
| 9341 |
g_gmock_mutex.AssertHeld(); |
| 9342 |
retired_ = true; |
| 9343 |
} |
| 9344 |
|
| 9345 |
|
| 9346 |
bool IsSatisfied() const |
| 9347 |
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { |
| 9348 |
g_gmock_mutex.AssertHeld(); |
| 9349 |
return cardinality().IsSatisfiedByCallCount(call_count_); |
| 9350 |
} |
| 9351 |
|
| 9352 |
|
| 9353 |
bool IsSaturated() const |
| 9354 |
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { |
| 9355 |
g_gmock_mutex.AssertHeld(); |
| 9356 |
return cardinality().IsSaturatedByCallCount(call_count_); |
| 9357 |
} |
| 9358 |
|
| 9359 |
|
| 9360 |
bool IsOverSaturated() const |
| 9361 |
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { |
| 9362 |
g_gmock_mutex.AssertHeld(); |
| 9363 |
return cardinality().IsOverSaturatedByCallCount(call_count_); |
| 9364 |
} |
| 9365 |
|
| 9366 |
|
| 9367 |
bool AllPrerequisitesAreSatisfied() const |
| 9368 |
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex); |
| 9369 |
|
| 9370 |
|
| 9371 |
void FindUnsatisfiedPrerequisites(ExpectationSet* result) const |
| 9372 |
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex); |
| 9373 |
|
| 9374 |
|
| 9375 |
int call_count() const |
| 9376 |
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { |
| 9377 |
g_gmock_mutex.AssertHeld(); |
| 9378 |
return call_count_; |
| 9379 |
} |
| 9380 |
|
| 9381 |
|
| 9382 |
void IncrementCallCount() |
| 9383 |
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { |
| 9384 |
g_gmock_mutex.AssertHeld(); |
| 9385 |
call_count_++; |
| 9386 |
} |
| 9387 |
|
| 9388 |
|
| 9389 |
|
| 9390 |
|
| 9391 |
|
| 9392 |
void CheckActionCountIfNotDone() const |
| 9393 |
GTEST_LOCK_EXCLUDED_(mutex_); |
| 9394 |
|
| 9395 |
friend class ::testing::Sequence; |
| 9396 |
friend class ::testing::internal::ExpectationTester; |
| 9397 |
|
| 9398 |
template <typename Function> |
| 9399 |
friend class TypedExpectation; |
| 9400 |
|
| 9401 |
|
| 9402 |
void UntypedTimes(const Cardinality& a_cardinality); |
| 9403 |
|
| 9404 |
|
| 9405 |
|
| 9406 |
const char* file_; |
| 9407 |
int line_; |
| 9408 |
const string source_text_; |
| 9409 |
|
| 9410 |
bool cardinality_specified_; |
| 9411 |
Cardinality cardinality_; |
| 9412 |
|
| 9413 |
|
| 9414 |
|
| 9415 |
|
| 9416 |
|
| 9417 |
|
| 9418 |
ExpectationSet immediate_prerequisites_; |
| 9419 |
|
| 9420 |
|
| 9421 |
|
| 9422 |
int call_count_; |
| 9423 |
bool retired_; |
| 9424 |
UntypedActions untyped_actions_; |
| 9425 |
bool extra_matcher_specified_; |
| 9426 |
bool repeated_action_specified_; |
| 9427 |
bool retires_on_saturation_; |
| 9428 |
Clause last_clause_; |
| 9429 |
mutable bool action_count_checked_; |
| 9430 |
mutable Mutex mutex_; |
| 9431 |
|
| 9432 |
GTEST_DISALLOW_ASSIGN_(ExpectationBase); |
| 9433 |
}; |
| 9434 |
|
| 9435 |
|
| 9436 |
template <typename F> |
| 9437 |
class TypedExpectation : public ExpectationBase { |
| 9438 |
public: |
| 9439 |
typedef typename Function<F>::ArgumentTuple ArgumentTuple; |
| 9440 |
typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple; |
| 9441 |
typedef typename Function<F>::Result Result; |
| 9442 |
|
| 9443 |
TypedExpectation(FunctionMockerBase<F>* owner, |
| 9444 |
const char* a_file, int a_line, const string& a_source_text, |
| 9445 |
const ArgumentMatcherTuple& m) |
| 9446 |
: ExpectationBase(a_file, a_line, a_source_text), |
| 9447 |
owner_(owner), |
| 9448 |
matchers_(m), |
| 9449 |
|
| 9450 |
|
| 9451 |
|
| 9452 |
|
| 9453 |
extra_matcher_(A<const ArgumentTuple&>()), |
| 9454 |
repeated_action_(DoDefault()) {} |
| 9455 |
|
| 9456 |
virtual ~TypedExpectation() { |
| 9457 |
|
| 9458 |
|
| 9459 |
CheckActionCountIfNotDone(); |
| 9460 |
for (UntypedActions::const_iterator it = untyped_actions_.begin(); |
| 9461 |
it != untyped_actions_.end(); ++it) { |
| 9462 |
delete static_cast<const Action<F>*>(*it); |
| 9463 |
} |
| 9464 |
} |
| 9465 |
|
| 9466 |
|
| 9467 |
TypedExpectation& With(const Matcher<const ArgumentTuple&>& m) { |
| 9468 |
if (last_clause_ == kWith) { |
| 9469 |
ExpectSpecProperty(false, |
| 9470 |
".With() cannot appear " |
| 9471 |
"more than once in an EXPECT_CALL()."); |
| 9472 |
} else { |
| 9473 |
ExpectSpecProperty(last_clause_ < kWith, |
| 9474 |
".With() must be the first " |
| 9475 |
"clause in an EXPECT_CALL()."); |
| 9476 |
} |
| 9477 |
last_clause_ = kWith; |
| 9478 |
|
| 9479 |
extra_matcher_ = m; |
| 9480 |
extra_matcher_specified_ = true; |
| 9481 |
return *this; |
| 9482 |
} |
| 9483 |
|
| 9484 |
|
| 9485 |
TypedExpectation& Times(const Cardinality& a_cardinality) { |
| 9486 |
ExpectationBase::UntypedTimes(a_cardinality); |
| 9487 |
return *this; |
| 9488 |
} |
| 9489 |
|
| 9490 |
|
| 9491 |
TypedExpectation& Times(int n) { |
| 9492 |
return Times(Exactly(n)); |
| 9493 |
} |
| 9494 |
|
| 9495 |
|
| 9496 |
TypedExpectation& InSequence(const Sequence& s) { |
| 9497 |
ExpectSpecProperty(last_clause_ <= kInSequence, |
| 9498 |
".InSequence() cannot appear after .After()," |
| 9499 |
" .WillOnce(), .WillRepeatedly(), or " |
| 9500 |
".RetiresOnSaturation()."); |
| 9501 |
last_clause_ = kInSequence; |
| 9502 |
|
| 9503 |
s.AddExpectation(GetHandle()); |
| 9504 |
return *this; |
| 9505 |
} |
| 9506 |
TypedExpectation& InSequence(const Sequence& s1, const Sequence& s2) { |
| 9507 |
return InSequence(s1).InSequence(s2); |
| 9508 |
} |
| 9509 |
TypedExpectation& InSequence(const Sequence& s1, const Sequence& s2, |
| 9510 |
const Sequence& s3) { |
| 9511 |
return InSequence(s1, s2).InSequence(s3); |
| 9512 |
} |
| 9513 |
TypedExpectation& InSequence(const Sequence& s1, const Sequence& s2, |
| 9514 |
const Sequence& s3, const Sequence& s4) { |
| 9515 |
return InSequence(s1, s2, s3).InSequence(s4); |
| 9516 |
} |
| 9517 |
TypedExpectation& InSequence(const Sequence& s1, const Sequence& s2, |
| 9518 |
const Sequence& s3, const Sequence& s4, |
| 9519 |
const Sequence& s5) { |
| 9520 |
return InSequence(s1, s2, s3, s4).InSequence(s5); |
| 9521 |
} |
| 9522 |
|
| 9523 |
|
| 9524 |
TypedExpectation& After(const ExpectationSet& s) { |
| 9525 |
ExpectSpecProperty(last_clause_ <= kAfter, |
| 9526 |
".After() cannot appear after .WillOnce()," |
| 9527 |
" .WillRepeatedly(), or " |
| 9528 |
".RetiresOnSaturation()."); |
| 9529 |
last_clause_ = kAfter; |
| 9530 |
|
| 9531 |
for (ExpectationSet::const_iterator it = s.begin(); it != s.end(); ++it) { |
| 9532 |
immediate_prerequisites_ += *it; |
| 9533 |
} |
| 9534 |
return *this; |
| 9535 |
} |
| 9536 |
TypedExpectation& After(const ExpectationSet& s1, const ExpectationSet& s2) { |
| 9537 |
return After(s1).After(s2); |
| 9538 |
} |
| 9539 |
TypedExpectation& After(const ExpectationSet& s1, const ExpectationSet& s2, |
| 9540 |
const ExpectationSet& s3) { |
| 9541 |
return After(s1, s2).After(s3); |
| 9542 |
} |
| 9543 |
TypedExpectation& After(const ExpectationSet& s1, const ExpectationSet& s2, |
| 9544 |
const ExpectationSet& s3, const ExpectationSet& s4) { |
| 9545 |
return After(s1, s2, s3).After(s4); |
| 9546 |
} |
| 9547 |
TypedExpectation& After(const ExpectationSet& s1, const ExpectationSet& s2, |
| 9548 |
const ExpectationSet& s3, const ExpectationSet& s4, |
| 9549 |
const ExpectationSet& s5) { |
| 9550 |
return After(s1, s2, s3, s4).After(s5); |
| 9551 |
} |
| 9552 |
|
| 9553 |
|
| 9554 |
TypedExpectation& WillOnce(const Action<F>& action) { |
| 9555 |
ExpectSpecProperty(last_clause_ <= kWillOnce, |
| 9556 |
".WillOnce() cannot appear after " |
| 9557 |
".WillRepeatedly() or .RetiresOnSaturation()."); |
| 9558 |
last_clause_ = kWillOnce; |
| 9559 |
|
| 9560 |
untyped_actions_.push_back(new Action<F>(action)); |
| 9561 |
if (!cardinality_specified()) { |
| 9562 |
set_cardinality(Exactly(static_cast<int>(untyped_actions_.size()))); |
| 9563 |
} |
| 9564 |
return *this; |
| 9565 |
} |
| 9566 |
|
| 9567 |
|
| 9568 |
TypedExpectation& WillRepeatedly(const Action<F>& action) { |
| 9569 |
if (last_clause_ == kWillRepeatedly) { |
| 9570 |
ExpectSpecProperty(false, |
| 9571 |
".WillRepeatedly() cannot appear " |
| 9572 |
"more than once in an EXPECT_CALL()."); |
| 9573 |
} else { |
| 9574 |
ExpectSpecProperty(last_clause_ < kWillRepeatedly, |
| 9575 |
".WillRepeatedly() cannot appear " |
| 9576 |
"after .RetiresOnSaturation()."); |
| 9577 |
} |
| 9578 |
last_clause_ = kWillRepeatedly; |
| 9579 |
repeated_action_specified_ = true; |
| 9580 |
|
| 9581 |
repeated_action_ = action; |
| 9582 |
if (!cardinality_specified()) { |
| 9583 |
set_cardinality(AtLeast(static_cast<int>(untyped_actions_.size()))); |
| 9584 |
} |
| 9585 |
|
| 9586 |
|
| 9587 |
|
| 9588 |
CheckActionCountIfNotDone(); |
| 9589 |
return *this; |
| 9590 |
} |
| 9591 |
|
| 9592 |
|
| 9593 |
TypedExpectation& RetiresOnSaturation() { |
| 9594 |
ExpectSpecProperty(last_clause_ < kRetiresOnSaturation, |
| 9595 |
".RetiresOnSaturation() cannot appear " |
| 9596 |
"more than once."); |
| 9597 |
last_clause_ = kRetiresOnSaturation; |
| 9598 |
retires_on_saturation_ = true; |
| 9599 |
|
| 9600 |
|
| 9601 |
|
| 9602 |
CheckActionCountIfNotDone(); |
| 9603 |
return *this; |
| 9604 |
} |
| 9605 |
|
| 9606 |
|
| 9607 |
|
| 9608 |
const ArgumentMatcherTuple& matchers() const { |
| 9609 |
return matchers_; |
| 9610 |
} |
| 9611 |
|
| 9612 |
|
| 9613 |
const Matcher<const ArgumentTuple&>& extra_matcher() const { |
| 9614 |
return extra_matcher_; |
| 9615 |
} |
| 9616 |
|
| 9617 |
|
| 9618 |
const Action<F>& repeated_action() const { return repeated_action_; } |
| 9619 |
|
| 9620 |
|
| 9621 |
|
| 9622 |
virtual void MaybeDescribeExtraMatcherTo(::std::ostream* os) { |
| 9623 |
if (extra_matcher_specified_) { |
| 9624 |
*os << " Expected args: "; |
| 9625 |
extra_matcher_.DescribeTo(os); |
| 9626 |
*os << "\n"; |
| 9627 |
} |
| 9628 |
} |
| 9629 |
|
| 9630 |
private: |
| 9631 |
template <typename Function> |
| 9632 |
friend class FunctionMockerBase; |
| 9633 |
|
| 9634 |
|
| 9635 |
|
| 9636 |
virtual Expectation GetHandle() { |
| 9637 |
return owner_->GetHandleOf(this); |
| 9638 |
} |
| 9639 |
|
| 9640 |
|
| 9641 |
|
| 9642 |
|
| 9643 |
|
| 9644 |
|
| 9645 |
bool Matches(const ArgumentTuple& args) const |
| 9646 |
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { |
| 9647 |
g_gmock_mutex.AssertHeld(); |
| 9648 |
return TupleMatches(matchers_, args) && extra_matcher_.Matches(args); |
| 9649 |
} |
| 9650 |
|
| 9651 |
|
| 9652 |
bool ShouldHandleArguments(const ArgumentTuple& args) const |
| 9653 |
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { |
| 9654 |
g_gmock_mutex.AssertHeld(); |
| 9655 |
|
| 9656 |
|
| 9657 |
|
| 9658 |
|
| 9659 |
|
| 9660 |
CheckActionCountIfNotDone(); |
| 9661 |
return !is_retired() && AllPrerequisitesAreSatisfied() && Matches(args); |
| 9662 |
} |
| 9663 |
|
| 9664 |
|
| 9665 |
|
| 9666 |
void ExplainMatchResultTo( |
| 9667 |
const ArgumentTuple& args, |
| 9668 |
::std::ostream* os) const |
| 9669 |
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { |
| 9670 |
g_gmock_mutex.AssertHeld(); |
| 9671 |
|
| 9672 |
if (is_retired()) { |
| 9673 |
*os << " Expected: the expectation is active\n" |
| 9674 |
<< " Actual: it is retired\n"; |
| 9675 |
} else if (!Matches(args)) { |
| 9676 |
if (!TupleMatches(matchers_, args)) { |
| 9677 |
ExplainMatchFailureTupleTo(matchers_, args, os); |
| 9678 |
} |
| 9679 |
StringMatchResultListener listener; |
| 9680 |
if (!extra_matcher_.MatchAndExplain(args, &listener)) { |
| 9681 |
*os << " Expected args: "; |
| 9682 |
extra_matcher_.DescribeTo(os); |
| 9683 |
*os << "\n Actual: don't match"; |
| 9684 |
|
| 9685 |
internal::PrintIfNotEmpty(listener.str(), os); |
| 9686 |
*os << "\n"; |
| 9687 |
} |
| 9688 |
} else if (!AllPrerequisitesAreSatisfied()) { |
| 9689 |
*os << " Expected: all pre-requisites are satisfied\n" |
| 9690 |
<< " Actual: the following immediate pre-requisites " |
| 9691 |
<< "are not satisfied:\n"; |
| 9692 |
ExpectationSet unsatisfied_prereqs; |
| 9693 |
FindUnsatisfiedPrerequisites(&unsatisfied_prereqs); |
| 9694 |
int i = 0; |
| 9695 |
for (ExpectationSet::const_iterator it = unsatisfied_prereqs.begin(); |
| 9696 |
it != unsatisfied_prereqs.end(); ++it) { |
| 9697 |
it->expectation_base()->DescribeLocationTo(os); |
| 9698 |
*os << "pre-requisite #" << i++ << "\n"; |
| 9699 |
} |
| 9700 |
*os << " (end of pre-requisites)\n"; |
| 9701 |
} else { |
| 9702 |
|
| 9703 |
|
| 9704 |
|
| 9705 |
|
| 9706 |
*os << "The call matches the expectation.\n"; |
| 9707 |
} |
| 9708 |
} |
| 9709 |
|
| 9710 |
|
| 9711 |
const Action<F>& GetCurrentAction( |
| 9712 |
const FunctionMockerBase<F>* mocker, |
| 9713 |
const ArgumentTuple& args) const |
| 9714 |
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { |
| 9715 |
g_gmock_mutex.AssertHeld(); |
| 9716 |
const int count = call_count(); |
| 9717 |
Assert(count >= 1, __FILE__, __LINE__, |
| 9718 |
"call_count() is <= 0 when GetCurrentAction() is " |
| 9719 |
"called - this should never happen."); |
| 9720 |
|
| 9721 |
const int action_count = static_cast<int>(untyped_actions_.size()); |
| 9722 |
if (action_count > 0 && !repeated_action_specified_ && |
| 9723 |
count > action_count) { |
| 9724 |
|
| 9725 |
|
| 9726 |
::std::stringstream ss; |
| 9727 |
DescribeLocationTo(&ss); |
| 9728 |
ss << "Actions ran out in " << source_text() << "...\n" |
| 9729 |
<< "Called " << count << " times, but only " |
| 9730 |
<< action_count << " WillOnce()" |
| 9731 |
<< (action_count == 1 ? " is" : "s are") << " specified - "; |
| 9732 |
mocker->DescribeDefaultActionTo(args, &ss); |
| 9733 |
Log(kWarning, ss.str(), 1); |
| 9734 |
} |
| 9735 |
|
| 9736 |
return count <= action_count ? |
| 9737 |
*static_cast<const Action<F>*>(untyped_actions_[count - 1]) : |
| 9738 |
repeated_action(); |
| 9739 |
} |
| 9740 |
|
| 9741 |
|
| 9742 |
|
| 9743 |
|
| 9744 |
|
| 9745 |
|
| 9746 |
|
| 9747 |
|
| 9748 |
const Action<F>* GetActionForArguments( |
| 9749 |
const FunctionMockerBase<F>* mocker, |
| 9750 |
const ArgumentTuple& args, |
| 9751 |
::std::ostream* what, |
| 9752 |
::std::ostream* why) |
| 9753 |
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { |
| 9754 |
g_gmock_mutex.AssertHeld(); |
| 9755 |
if (IsSaturated()) { |
| 9756 |
|
| 9757 |
IncrementCallCount(); |
| 9758 |
*what << "Mock function called more times than expected - "; |
| 9759 |
mocker->DescribeDefaultActionTo(args, what); |
| 9760 |
DescribeCallCountTo(why); |
| 9761 |
|
| 9762 |
|
| 9763 |
|
| 9764 |
|
| 9765 |
return NULL; |
| 9766 |
} |
| 9767 |
|
| 9768 |
IncrementCallCount(); |
| 9769 |
RetireAllPreRequisites(); |
| 9770 |
|
| 9771 |
if (retires_on_saturation_ && IsSaturated()) { |
| 9772 |
Retire(); |
| 9773 |
} |
| 9774 |
|
| 9775 |
|
| 9776 |
*what << "Mock function call matches " << source_text() <<"...\n"; |
| 9777 |
return &(GetCurrentAction(mocker, args)); |
| 9778 |
} |
| 9779 |
|
| 9780 |
|
| 9781 |
|
| 9782 |
FunctionMockerBase<F>* const owner_; |
| 9783 |
ArgumentMatcherTuple matchers_; |
| 9784 |
Matcher<const ArgumentTuple&> extra_matcher_; |
| 9785 |
Action<F> repeated_action_; |
| 9786 |
|
| 9787 |
GTEST_DISALLOW_COPY_AND_ASSIGN_(TypedExpectation); |
| 9788 |
}; |
| 9789 |
|
| 9790 |
|
| 9791 |
|
| 9792 |
|
| 9793 |
|
| 9794 |
|
| 9795 |
|
| 9796 |
|
| 9797 |
|
| 9798 |
|
| 9799 |
|
| 9800 |
|
| 9801 |
GTEST_API_ void LogWithLocation(testing::internal::LogSeverity severity, |
| 9802 |
const char* file, int line, |
| 9803 |
const string& message); |
| 9804 |
|
| 9805 |
template <typename F> |
| 9806 |
class MockSpec { |
| 9807 |
public: |
| 9808 |
typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; |
| 9809 |
typedef typename internal::Function<F>::ArgumentMatcherTuple |
| 9810 |
ArgumentMatcherTuple; |
| 9811 |
|
| 9812 |
|
| 9813 |
|
| 9814 |
explicit MockSpec(internal::FunctionMockerBase<F>* function_mocker) |
| 9815 |
: function_mocker_(function_mocker) {} |
| 9816 |
|
| 9817 |
|
| 9818 |
|
| 9819 |
internal::OnCallSpec<F>& InternalDefaultActionSetAt( |
| 9820 |
const char* file, int line, const char* obj, const char* call) { |
| 9821 |
LogWithLocation(internal::kInfo, file, line, |
| 9822 |
string("ON_CALL(") + obj + ", " + call + ") invoked"); |
| 9823 |
return function_mocker_->AddNewOnCallSpec(file, line, matchers_); |
| 9824 |
} |
| 9825 |
|
| 9826 |
|
| 9827 |
|
| 9828 |
internal::TypedExpectation<F>& InternalExpectedAt( |
| 9829 |
const char* file, int line, const char* obj, const char* call) { |
| 9830 |
const string source_text(string("EXPECT_CALL(") + obj + ", " + call + ")"); |
| 9831 |
LogWithLocation(internal::kInfo, file, line, source_text + " invoked"); |
| 9832 |
return function_mocker_->AddNewExpectation( |
| 9833 |
file, line, source_text, matchers_); |
| 9834 |
} |
| 9835 |
|
| 9836 |
private: |
| 9837 |
template <typename Function> |
| 9838 |
friend class internal::FunctionMocker; |
| 9839 |
|
| 9840 |
void SetMatchers(const ArgumentMatcherTuple& matchers) { |
| 9841 |
matchers_ = matchers; |
| 9842 |
} |
| 9843 |
|
| 9844 |
|
| 9845 |
internal::FunctionMockerBase<F>* const function_mocker_; |
| 9846 |
|
| 9847 |
ArgumentMatcherTuple matchers_; |
| 9848 |
|
| 9849 |
GTEST_DISALLOW_ASSIGN_(MockSpec); |
| 9850 |
}; |
| 9851 |
|
| 9852 |
|
| 9853 |
|
| 9854 |
|
| 9855 |
|
| 9856 |
|
| 9857 |
#ifdef _MSC_VER |
| 9858 |
# pragma warning(push) // Saves the current warning state. |
| 9859 |
# pragma warning(disable:4355) // Temporarily disables warning 4355. |
| 9860 |
#endif |
| 9861 |
|
| 9862 |
|
| 9863 |
|
| 9864 |
|
| 9865 |
|
| 9866 |
|
| 9867 |
|
| 9868 |
|
| 9869 |
|
| 9870 |
|
| 9871 |
class UntypedActionResultHolderBase { |
| 9872 |
public: |
| 9873 |
virtual ~UntypedActionResultHolderBase() {} |
| 9874 |
|
| 9875 |
|
| 9876 |
virtual void PrintAsActionResult(::std::ostream* os) const = 0; |
| 9877 |
}; |
| 9878 |
|
| 9879 |
|
| 9880 |
template <typename T> |
| 9881 |
class ActionResultHolder : public UntypedActionResultHolderBase { |
| 9882 |
public: |
| 9883 |
explicit ActionResultHolder(T a_value) : value_(a_value) {} |
| 9884 |
|
| 9885 |
|
| 9886 |
|
| 9887 |
|
| 9888 |
|
| 9889 |
T GetValueAndDelete() const { |
| 9890 |
T retval(value_); |
| 9891 |
delete this; |
| 9892 |
return retval; |
| 9893 |
} |
| 9894 |
|
| 9895 |
|
| 9896 |
virtual void PrintAsActionResult(::std::ostream* os) const { |
| 9897 |
*os << "\n Returns: "; |
| 9898 |
|
| 9899 |
UniversalPrinter<T>::Print(value_, os); |
| 9900 |
} |
| 9901 |
|
| 9902 |
|
| 9903 |
|
| 9904 |
template <typename F> |
| 9905 |
static ActionResultHolder* PerformDefaultAction( |
| 9906 |
const FunctionMockerBase<F>* func_mocker, |
| 9907 |
const typename Function<F>::ArgumentTuple& args, |
| 9908 |
const string& call_description) { |
| 9909 |
return new ActionResultHolder( |
| 9910 |
func_mocker->PerformDefaultAction(args, call_description)); |
| 9911 |
} |
| 9912 |
|
| 9913 |
|
| 9914 |
|
| 9915 |
template <typename F> |
| 9916 |
static ActionResultHolder* |
| 9917 |
PerformAction(const Action<F>& action, |
| 9918 |
const typename Function<F>::ArgumentTuple& args) { |
| 9919 |
return new ActionResultHolder(action.Perform(args)); |
| 9920 |
} |
| 9921 |
|
| 9922 |
private: |
| 9923 |
T value_; |
| 9924 |
|
| 9925 |
|
| 9926 |
GTEST_DISALLOW_ASSIGN_(ActionResultHolder); |
| 9927 |
}; |
| 9928 |
|
| 9929 |
|
| 9930 |
template <> |
| 9931 |
class ActionResultHolder<void> : public UntypedActionResultHolderBase { |
| 9932 |
public: |
| 9933 |
void GetValueAndDelete() const { delete this; } |
| 9934 |
|
| 9935 |
virtual void PrintAsActionResult(::std::ostream* ) const {} |
| 9936 |
|
| 9937 |
|
| 9938 |
template <typename F> |
| 9939 |
static ActionResultHolder* PerformDefaultAction( |
| 9940 |
const FunctionMockerBase<F>* func_mocker, |
| 9941 |
const typename Function<F>::ArgumentTuple& args, |
| 9942 |
const string& call_description) { |
| 9943 |
func_mocker->PerformDefaultAction(args, call_description); |
| 9944 |
return NULL; |
| 9945 |
} |
| 9946 |
|
| 9947 |
|
| 9948 |
template <typename F> |
| 9949 |
static ActionResultHolder* PerformAction( |
| 9950 |
const Action<F>& action, |
| 9951 |
const typename Function<F>::ArgumentTuple& args) { |
| 9952 |
action.Perform(args); |
| 9953 |
return NULL; |
| 9954 |
} |
| 9955 |
}; |
| 9956 |
|
| 9957 |
|
| 9958 |
|
| 9959 |
|
| 9960 |
template <typename F> |
| 9961 |
class FunctionMockerBase : public UntypedFunctionMockerBase { |
| 9962 |
public: |
| 9963 |
typedef typename Function<F>::Result Result; |
| 9964 |
typedef typename Function<F>::ArgumentTuple ArgumentTuple; |
| 9965 |
typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple; |
| 9966 |
|
| 9967 |
FunctionMockerBase() : current_spec_(this) {} |
| 9968 |
|
| 9969 |
|
| 9970 |
|
| 9971 |
|
| 9972 |
virtual ~FunctionMockerBase() |
| 9973 |
GTEST_LOCK_EXCLUDED_(g_gmock_mutex) { |
| 9974 |
MutexLock l(&g_gmock_mutex); |
| 9975 |
VerifyAndClearExpectationsLocked(); |
| 9976 |
Mock::UnregisterLocked(this); |
| 9977 |
ClearDefaultActionsLocked(); |
| 9978 |
} |
| 9979 |
|
| 9980 |
|
| 9981 |
|
| 9982 |
|
| 9983 |
const OnCallSpec<F>* FindOnCallSpec( |
| 9984 |
const ArgumentTuple& args) const { |
| 9985 |
for (UntypedOnCallSpecs::const_reverse_iterator it |
| 9986 |
= untyped_on_call_specs_.rbegin(); |
| 9987 |
it != untyped_on_call_specs_.rend(); ++it) { |
| 9988 |
const OnCallSpec<F>* spec = static_cast<const OnCallSpec<F>*>(*it); |
| 9989 |
if (spec->Matches(args)) |
| 9990 |
return spec; |
| 9991 |
} |
| 9992 |
|
| 9993 |
return NULL; |
| 9994 |
} |
| 9995 |
|
| 9996 |
|
| 9997 |
|
| 9998 |
|
| 9999 |
|
| 10000 |
|
| 10001 |
|
| 10002 |
|
| 10003 |
Result PerformDefaultAction(const ArgumentTuple& args, |
| 10004 |
const string& call_description) const { |
| 10005 |
const OnCallSpec<F>* const spec = |
| 10006 |
this->FindOnCallSpec(args); |
| 10007 |
if (spec != NULL) { |
| 10008 |
return spec->GetAction().Perform(args); |
| 10009 |
} |
| 10010 |
const string message = call_description + |
| 10011 |
"\n The mock function has no default action " |
| 10012 |
"set, and its return type has no default value set."; |
| 10013 |
#if GTEST_HAS_EXCEPTIONS |
| 10014 |
if (!DefaultValue<Result>::Exists()) { |
| 10015 |
throw std::runtime_error(message); |
| 10016 |
} |
| 10017 |
#else |
| 10018 |
Assert(DefaultValue<Result>::Exists(), "", -1, message); |
| 10019 |
#endif |
| 10020 |
return DefaultValue<Result>::Get(); |
| 10021 |
} |
| 10022 |
|
| 10023 |
|
| 10024 |
|
| 10025 |
|
| 10026 |
|
| 10027 |
|
| 10028 |
virtual UntypedActionResultHolderBase* UntypedPerformDefaultAction( |
| 10029 |
const void* untyped_args, |
| 10030 |
const string& call_description) const { |
| 10031 |
const ArgumentTuple& args = |
| 10032 |
*static_cast<const ArgumentTuple*>(untyped_args); |
| 10033 |
return ResultHolder::PerformDefaultAction(this, args, call_description); |
| 10034 |
} |
| 10035 |
|
| 10036 |
|
| 10037 |
|
| 10038 |
|
| 10039 |
|
| 10040 |
virtual UntypedActionResultHolderBase* UntypedPerformAction( |
| 10041 |
const void* untyped_action, const void* untyped_args) const { |
| 10042 |
|
| 10043 |
|
| 10044 |
const Action<F> action = *static_cast<const Action<F>*>(untyped_action); |
| 10045 |
const ArgumentTuple& args = |
| 10046 |
*static_cast<const ArgumentTuple*>(untyped_args); |
| 10047 |
return ResultHolder::PerformAction(action, args); |
| 10048 |
} |
| 10049 |
|
| 10050 |
|
| 10051 |
|
| 10052 |
virtual void ClearDefaultActionsLocked() |
| 10053 |
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { |
| 10054 |
g_gmock_mutex.AssertHeld(); |
| 10055 |
|
| 10056 |
|
| 10057 |
|
| 10058 |
|
| 10059 |
|
| 10060 |
|
| 10061 |
|
| 10062 |
|
| 10063 |
UntypedOnCallSpecs specs_to_delete; |
| 10064 |
untyped_on_call_specs_.swap(specs_to_delete); |
| 10065 |
|
| 10066 |
g_gmock_mutex.Unlock(); |
| 10067 |
for (UntypedOnCallSpecs::const_iterator it = |
| 10068 |
specs_to_delete.begin(); |
| 10069 |
it != specs_to_delete.end(); ++it) { |
| 10070 |
delete static_cast<const OnCallSpec<F>*>(*it); |
| 10071 |
} |
| 10072 |
|
| 10073 |
|
| 10074 |
|
| 10075 |
g_gmock_mutex.Lock(); |
| 10076 |
} |
| 10077 |
|
| 10078 |
protected: |
| 10079 |
template <typename Function> |
| 10080 |
friend class MockSpec; |
| 10081 |
|
| 10082 |
typedef ActionResultHolder<Result> ResultHolder; |
| 10083 |
|
| 10084 |
|
| 10085 |
|
| 10086 |
|
| 10087 |
Result InvokeWith(const ArgumentTuple& args) |
| 10088 |
GTEST_LOCK_EXCLUDED_(g_gmock_mutex) { |
| 10089 |
return static_cast<const ResultHolder*>( |
| 10090 |
this->UntypedInvokeWith(&args))->GetValueAndDelete(); |
| 10091 |
} |
| 10092 |
|
| 10093 |
|
| 10094 |
OnCallSpec<F>& AddNewOnCallSpec( |
| 10095 |
const char* file, int line, |
| 10096 |
const ArgumentMatcherTuple& m) |
| 10097 |
GTEST_LOCK_EXCLUDED_(g_gmock_mutex) { |
| 10098 |
Mock::RegisterUseByOnCallOrExpectCall(MockObject(), file, line); |
| 10099 |
OnCallSpec<F>* const on_call_spec = new OnCallSpec<F>(file, line, m); |
| 10100 |
untyped_on_call_specs_.push_back(on_call_spec); |
| 10101 |
return *on_call_spec; |
| 10102 |
} |
| 10103 |
|
| 10104 |
|
| 10105 |
TypedExpectation<F>& AddNewExpectation( |
| 10106 |
const char* file, |
| 10107 |
int line, |
| 10108 |
const string& source_text, |
| 10109 |
const ArgumentMatcherTuple& m) |
| 10110 |
GTEST_LOCK_EXCLUDED_(g_gmock_mutex) { |
| 10111 |
Mock::RegisterUseByOnCallOrExpectCall(MockObject(), file, line); |
| 10112 |
TypedExpectation<F>* const expectation = |
| 10113 |
new TypedExpectation<F>(this, file, line, source_text, m); |
| 10114 |
const linked_ptr<ExpectationBase> untyped_expectation(expectation); |
| 10115 |
untyped_expectations_.push_back(untyped_expectation); |
| 10116 |
|
| 10117 |
|
| 10118 |
Sequence* const implicit_sequence = g_gmock_implicit_sequence.get(); |
| 10119 |
if (implicit_sequence != NULL) { |
| 10120 |
implicit_sequence->AddExpectation(Expectation(untyped_expectation)); |
| 10121 |
} |
| 10122 |
|
| 10123 |
return *expectation; |
| 10124 |
} |
| 10125 |
|
| 10126 |
|
| 10127 |
|
| 10128 |
MockSpec<F>& current_spec() { return current_spec_; } |
| 10129 |
|
| 10130 |
private: |
| 10131 |
template <typename Func> friend class TypedExpectation; |
| 10132 |
|
| 10133 |
|
| 10134 |
|
| 10135 |
|
| 10136 |
|
| 10137 |
|
| 10138 |
void DescribeDefaultActionTo(const ArgumentTuple& args, |
| 10139 |
::std::ostream* os) const { |
| 10140 |
const OnCallSpec<F>* const spec = FindOnCallSpec(args); |
| 10141 |
|
| 10142 |
if (spec == NULL) { |
| 10143 |
*os << (internal::type_equals<Result, void>::value ? |
| 10144 |
"returning directly.\n" : |
| 10145 |
"returning default value.\n"); |
| 10146 |
} else { |
| 10147 |
*os << "taking default action specified at:\n" |
| 10148 |
<< FormatFileLocation(spec->file(), spec->line()) << "\n"; |
| 10149 |
} |
| 10150 |
} |
| 10151 |
|
| 10152 |
|
| 10153 |
|
| 10154 |
|
| 10155 |
virtual void UntypedDescribeUninterestingCall( |
| 10156 |
const void* untyped_args, |
| 10157 |
::std::ostream* os) const |
| 10158 |
GTEST_LOCK_EXCLUDED_(g_gmock_mutex) { |
| 10159 |
const ArgumentTuple& args = |
| 10160 |
*static_cast<const ArgumentTuple*>(untyped_args); |
| 10161 |
*os << "Uninteresting mock function call - "; |
| 10162 |
DescribeDefaultActionTo(args, os); |
| 10163 |
*os << " Function call: " << Name(); |
| 10164 |
UniversalPrint(args, os); |
| 10165 |
} |
| 10166 |
|
| 10167 |
|
| 10168 |
|
| 10169 |
|
| 10170 |
|
| 10171 |
|
| 10172 |
|
| 10173 |
|
| 10174 |
|
| 10175 |
|
| 10176 |
|
| 10177 |
|
| 10178 |
|
| 10179 |
|
| 10180 |
|
| 10181 |
|
| 10182 |
|
| 10183 |
virtual const ExpectationBase* UntypedFindMatchingExpectation( |
| 10184 |
const void* untyped_args, |
| 10185 |
const void** untyped_action, bool* is_excessive, |
| 10186 |
::std::ostream* what, ::std::ostream* why) |
| 10187 |
GTEST_LOCK_EXCLUDED_(g_gmock_mutex) { |
| 10188 |
const ArgumentTuple& args = |
| 10189 |
*static_cast<const ArgumentTuple*>(untyped_args); |
| 10190 |
MutexLock l(&g_gmock_mutex); |
| 10191 |
TypedExpectation<F>* exp = this->FindMatchingExpectationLocked(args); |
| 10192 |
if (exp == NULL) { |
| 10193 |
this->FormatUnexpectedCallMessageLocked(args, what, why); |
| 10194 |
return NULL; |
| 10195 |
} |
| 10196 |
|
| 10197 |
|
| 10198 |
|
| 10199 |
|
| 10200 |
*is_excessive = exp->IsSaturated(); |
| 10201 |
const Action<F>* action = exp->GetActionForArguments(this, args, what, why); |
| 10202 |
if (action != NULL && action->IsDoDefault()) |
| 10203 |
action = NULL; |
| 10204 |
*untyped_action = action; |
| 10205 |
return exp; |
| 10206 |
} |
| 10207 |
|
| 10208 |
|
| 10209 |
virtual void UntypedPrintArgs(const void* untyped_args, |
| 10210 |
::std::ostream* os) const { |
| 10211 |
const ArgumentTuple& args = |
| 10212 |
*static_cast<const ArgumentTuple*>(untyped_args); |
| 10213 |
UniversalPrint(args, os); |
| 10214 |
} |
| 10215 |
|
| 10216 |
|
| 10217 |
|
| 10218 |
TypedExpectation<F>* FindMatchingExpectationLocked( |
| 10219 |
const ArgumentTuple& args) const |
| 10220 |
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { |
| 10221 |
g_gmock_mutex.AssertHeld(); |
| 10222 |
for (typename UntypedExpectations::const_reverse_iterator it = |
| 10223 |
untyped_expectations_.rbegin(); |
| 10224 |
it != untyped_expectations_.rend(); ++it) { |
| 10225 |
TypedExpectation<F>* const exp = |
| 10226 |
static_cast<TypedExpectation<F>*>(it->get()); |
| 10227 |
if (exp->ShouldHandleArguments(args)) { |
| 10228 |
return exp; |
| 10229 |
} |
| 10230 |
} |
| 10231 |
return NULL; |
| 10232 |
} |
| 10233 |
|
| 10234 |
|
| 10235 |
void FormatUnexpectedCallMessageLocked( |
| 10236 |
const ArgumentTuple& args, |
| 10237 |
::std::ostream* os, |
| 10238 |
::std::ostream* why) const |
| 10239 |
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { |
| 10240 |
g_gmock_mutex.AssertHeld(); |
| 10241 |
*os << "\nUnexpected mock function call - "; |
| 10242 |
DescribeDefaultActionTo(args, os); |
| 10243 |
PrintTriedExpectationsLocked(args, why); |
| 10244 |
} |
| 10245 |
|
| 10246 |
|
| 10247 |
|
| 10248 |
void PrintTriedExpectationsLocked( |
| 10249 |
const ArgumentTuple& args, |
| 10250 |
::std::ostream* why) const |
| 10251 |
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { |
| 10252 |
g_gmock_mutex.AssertHeld(); |
| 10253 |
const int count = static_cast<int>(untyped_expectations_.size()); |
| 10254 |
*why << "Google Mock tried the following " << count << " " |
| 10255 |
<< (count == 1 ? "expectation, but it didn't match" : |
| 10256 |
"expectations, but none matched") |
| 10257 |
<< ":\n"; |
| 10258 |
for (int i = 0; i < count; i++) { |
| 10259 |
TypedExpectation<F>* const expectation = |
| 10260 |
static_cast<TypedExpectation<F>*>(untyped_expectations_[i].get()); |
| 10261 |
*why << "\n"; |
| 10262 |
expectation->DescribeLocationTo(why); |
| 10263 |
if (count > 1) { |
| 10264 |
*why << "tried expectation #" << i << ": "; |
| 10265 |
} |
| 10266 |
*why << expectation->source_text() << "...\n"; |
| 10267 |
expectation->ExplainMatchResultTo(args, why); |
| 10268 |
expectation->DescribeCallCountTo(why); |
| 10269 |
} |
| 10270 |
} |
| 10271 |
|
| 10272 |
|
| 10273 |
|
| 10274 |
MockSpec<F> current_spec_; |
| 10275 |
|
| 10276 |
|
| 10277 |
|
| 10278 |
|
| 10279 |
|
| 10280 |
|
| 10281 |
|
| 10282 |
|
| 10283 |
|
| 10284 |
|
| 10285 |
|
| 10286 |
|
| 10287 |
|
| 10288 |
GTEST_DISALLOW_COPY_AND_ASSIGN_(FunctionMockerBase); |
| 10289 |
}; |
| 10290 |
|
| 10291 |
#ifdef _MSC_VER |
| 10292 |
# pragma warning(pop) // Restores the warning state. |
| 10293 |
#endif |
| 10294 |
|
| 10295 |
|
| 10296 |
|
| 10297 |
|
| 10298 |
|
| 10299 |
|
| 10300 |
|
| 10301 |
|
| 10302 |
|
| 10303 |
void ReportUninterestingCall(CallReaction reaction, const string& msg); |
| 10304 |
|
| 10305 |
} |
| 10306 |
|
| 10307 |
|
| 10308 |
|
| 10309 |
|
| 10310 |
|
| 10311 |
|
| 10312 |
using internal::MockSpec; |
| 10313 |
|
| 10314 |
|
| 10315 |
|
| 10316 |
|
| 10317 |
|
| 10318 |
|
| 10319 |
|
| 10320 |
|
| 10321 |
|
| 10322 |
|
| 10323 |
|
| 10324 |
|
| 10325 |
|
| 10326 |
|
| 10327 |
|
| 10328 |
|
| 10329 |
template <typename T> |
| 10330 |
inline const T& Const(const T& x) { return x; } |
| 10331 |
|
| 10332 |
|
| 10333 |
inline Expectation::Expectation(internal::ExpectationBase& exp) |
| 10334 |
: expectation_base_(exp.GetHandle().expectation_base()) {} |
| 10335 |
|
| 10336 |
} |
| 10337 |
|
| 10338 |
|
| 10339 |
|
| 10340 |
|
| 10341 |
|
| 10342 |
#define GMOCK_ON_CALL_IMPL_(obj, call) \ |
| 10343 |
((obj).gmock_##call).InternalDefaultActionSetAt(__FILE__, __LINE__, \ |
| 10344 |
#obj, #call) |
| 10345 |
#define ON_CALL(obj, call) GMOCK_ON_CALL_IMPL_(obj, call) |
| 10346 |
|
| 10347 |
#define GMOCK_EXPECT_CALL_IMPL_(obj, call) \ |
| 10348 |
((obj).gmock_##call).InternalExpectedAt(__FILE__, __LINE__, #obj, #call) |
| 10349 |
#define EXPECT_CALL(obj, call) GMOCK_EXPECT_CALL_IMPL_(obj, call) |
| 10350 |
|
| 10351 |
#endif |
| 10352 |
|
| 10353 |
namespace testing { |
| 10354 |
namespace internal { |
| 10355 |
|
| 10356 |
template <typename F> |
| 10357 |
class FunctionMockerBase; |
| 10358 |
|
| 10359 |
|
| 10360 |
|
| 10361 |
|
| 10362 |
|
| 10363 |
|
| 10364 |
template <typename F> |
| 10365 |
class FunctionMocker; |
| 10366 |
|
| 10367 |
template <typename R> |
| 10368 |
class FunctionMocker<R()> : public |
| 10369 |
internal::FunctionMockerBase<R()> { |
| 10370 |
public: |
| 10371 |
typedef R F(); |
| 10372 |
typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; |
| 10373 |
|
| 10374 |
MockSpec<F>& With() { |
| 10375 |
return this->current_spec(); |
| 10376 |
} |
| 10377 |
|
| 10378 |
R Invoke() { |
| 10379 |
|
| 10380 |
|
| 10381 |
|
| 10382 |
|
| 10383 |
return this->InvokeWith(ArgumentTuple()); |
| 10384 |
} |
| 10385 |
}; |
| 10386 |
|
| 10387 |
template <typename R, typename A1> |
| 10388 |
class FunctionMocker<R(A1)> : public |
| 10389 |
internal::FunctionMockerBase<R(A1)> { |
| 10390 |
public: |
| 10391 |
typedef R F(A1); |
| 10392 |
typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; |
| 10393 |
|
| 10394 |
MockSpec<F>& With(const Matcher<A1>& m1) { |
| 10395 |
this->current_spec().SetMatchers(::std::tr1::make_tuple(m1)); |
| 10396 |
return this->current_spec(); |
| 10397 |
} |
| 10398 |
|
| 10399 |
R Invoke(A1 a1) { |
| 10400 |
|
| 10401 |
|
| 10402 |
|
| 10403 |
|
| 10404 |
return this->InvokeWith(ArgumentTuple(a1)); |
| 10405 |
} |
| 10406 |
}; |
| 10407 |
|
| 10408 |
template <typename R, typename A1, typename A2> |
| 10409 |
class FunctionMocker<R(A1, A2)> : public |
| 10410 |
internal::FunctionMockerBase<R(A1, A2)> { |
| 10411 |
public: |
| 10412 |
typedef R F(A1, A2); |
| 10413 |
typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; |
| 10414 |
|
| 10415 |
MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2) { |
| 10416 |
this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2)); |
| 10417 |
return this->current_spec(); |
| 10418 |
} |
| 10419 |
|
| 10420 |
R Invoke(A1 a1, A2 a2) { |
| 10421 |
|
| 10422 |
|
| 10423 |
|
| 10424 |
|
| 10425 |
return this->InvokeWith(ArgumentTuple(a1, a2)); |
| 10426 |
} |
| 10427 |
}; |
| 10428 |
|
| 10429 |
template <typename R, typename A1, typename A2, typename A3> |
| 10430 |
class FunctionMocker<R(A1, A2, A3)> : public |
| 10431 |
internal::FunctionMockerBase<R(A1, A2, A3)> { |
| 10432 |
public: |
| 10433 |
typedef R F(A1, A2, A3); |
| 10434 |
typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; |
| 10435 |
|
| 10436 |
MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2, |
| 10437 |
const Matcher<A3>& m3) { |
| 10438 |
this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3)); |
| 10439 |
return this->current_spec(); |
| 10440 |
} |
| 10441 |
|
| 10442 |
R Invoke(A1 a1, A2 a2, A3 a3) { |
| 10443 |
|
| 10444 |
|
| 10445 |
|
| 10446 |
|
| 10447 |
return this->InvokeWith(ArgumentTuple(a1, a2, a3)); |
| 10448 |
} |
| 10449 |
}; |
| 10450 |
|
| 10451 |
template <typename R, typename A1, typename A2, typename A3, typename A4> |
| 10452 |
class FunctionMocker<R(A1, A2, A3, A4)> : public |
| 10453 |
internal::FunctionMockerBase<R(A1, A2, A3, A4)> { |
| 10454 |
public: |
| 10455 |
typedef R F(A1, A2, A3, A4); |
| 10456 |
typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; |
| 10457 |
|
| 10458 |
MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2, |
| 10459 |
const Matcher<A3>& m3, const Matcher<A4>& m4) { |
| 10460 |
this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4)); |
| 10461 |
return this->current_spec(); |
| 10462 |
} |
| 10463 |
|
| 10464 |
R Invoke(A1 a1, A2 a2, A3 a3, A4 a4) { |
| 10465 |
|
| 10466 |
|
| 10467 |
|
| 10468 |
|
| 10469 |
return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4)); |
| 10470 |
} |
| 10471 |
}; |
| 10472 |
|
| 10473 |
template <typename R, typename A1, typename A2, typename A3, typename A4, |
| 10474 |
typename A5> |
| 10475 |
class FunctionMocker<R(A1, A2, A3, A4, A5)> : public |
| 10476 |
internal::FunctionMockerBase<R(A1, A2, A3, A4, A5)> { |
| 10477 |
public: |
| 10478 |
typedef R F(A1, A2, A3, A4, A5); |
| 10479 |
typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; |
| 10480 |
|
| 10481 |
MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2, |
| 10482 |
const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5) { |
| 10483 |
this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4, |
| 10484 |
m5)); |
| 10485 |
return this->current_spec(); |
| 10486 |
} |
| 10487 |
|
| 10488 |
R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) { |
| 10489 |
|
| 10490 |
|
| 10491 |
|
| 10492 |
|
| 10493 |
return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5)); |
| 10494 |
} |
| 10495 |
}; |
| 10496 |
|
| 10497 |
template <typename R, typename A1, typename A2, typename A3, typename A4, |
| 10498 |
typename A5, typename A6> |
| 10499 |
class FunctionMocker<R(A1, A2, A3, A4, A5, A6)> : public |
| 10500 |
internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6)> { |
| 10501 |
public: |
| 10502 |
typedef R F(A1, A2, A3, A4, A5, A6); |
| 10503 |
typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; |
| 10504 |
|
| 10505 |
MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2, |
| 10506 |
const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5, |
| 10507 |
const Matcher<A6>& m6) { |
| 10508 |
this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4, m5, |
| 10509 |
m6)); |
| 10510 |
return this->current_spec(); |
| 10511 |
} |
| 10512 |
|
| 10513 |
R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) { |
| 10514 |
|
| 10515 |
|
| 10516 |
|
| 10517 |
|
| 10518 |
return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6)); |
| 10519 |
} |
| 10520 |
}; |
| 10521 |
|
| 10522 |
template <typename R, typename A1, typename A2, typename A3, typename A4, |
| 10523 |
typename A5, typename A6, typename A7> |
| 10524 |
class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7)> : public |
| 10525 |
internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7)> { |
| 10526 |
public: |
| 10527 |
typedef R F(A1, A2, A3, A4, A5, A6, A7); |
| 10528 |
typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; |
| 10529 |
|
| 10530 |
MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2, |
| 10531 |
const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5, |
| 10532 |
const Matcher<A6>& m6, const Matcher<A7>& m7) { |
| 10533 |
this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4, m5, |
| 10534 |
m6, m7)); |
| 10535 |
return this->current_spec(); |
| 10536 |
} |
| 10537 |
|
| 10538 |
R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) { |
| 10539 |
|
| 10540 |
|
| 10541 |
|
| 10542 |
|
| 10543 |
return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7)); |
| 10544 |
} |
| 10545 |
}; |
| 10546 |
|
| 10547 |
template <typename R, typename A1, typename A2, typename A3, typename A4, |
| 10548 |
typename A5, typename A6, typename A7, typename A8> |
| 10549 |
class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8)> : public |
| 10550 |
internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8)> { |
| 10551 |
public: |
| 10552 |
typedef R F(A1, A2, A3, A4, A5, A6, A7, A8); |
| 10553 |
typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; |
| 10554 |
|
| 10555 |
MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2, |
| 10556 |
const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5, |
| 10557 |
const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& m8) { |
| 10558 |
this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4, m5, |
| 10559 |
m6, m7, m8)); |
| 10560 |
return this->current_spec(); |
| 10561 |
} |
| 10562 |
|
| 10563 |
R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) { |
| 10564 |
|
| 10565 |
|
| 10566 |
|
| 10567 |
|
| 10568 |
return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7, a8)); |
| 10569 |
} |
| 10570 |
}; |
| 10571 |
|
| 10572 |
template <typename R, typename A1, typename A2, typename A3, typename A4, |
| 10573 |
typename A5, typename A6, typename A7, typename A8, typename A9> |
| 10574 |
class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> : public |
| 10575 |
internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> { |
| 10576 |
public: |
| 10577 |
typedef R F(A1, A2, A3, A4, A5, A6, A7, A8, A9); |
| 10578 |
typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; |
| 10579 |
|
| 10580 |
MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2, |
| 10581 |
const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5, |
| 10582 |
const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& m8, |
| 10583 |
const Matcher<A9>& m9) { |
| 10584 |
this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4, m5, |
| 10585 |
m6, m7, m8, m9)); |
| 10586 |
return this->current_spec(); |
| 10587 |
} |
| 10588 |
|
| 10589 |
R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) { |
| 10590 |
|
| 10591 |
|
| 10592 |
|
| 10593 |
|
| 10594 |
return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7, a8, a9)); |
| 10595 |
} |
| 10596 |
}; |
| 10597 |
|
| 10598 |
template <typename R, typename A1, typename A2, typename A3, typename A4, |
| 10599 |
typename A5, typename A6, typename A7, typename A8, typename A9, |
| 10600 |
typename A10> |
| 10601 |
class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> : public |
| 10602 |
internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> { |
| 10603 |
public: |
| 10604 |
typedef R F(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10); |
| 10605 |
typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; |
| 10606 |
|
| 10607 |
MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2, |
| 10608 |
const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5, |
| 10609 |
const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& m8, |
| 10610 |
const Matcher<A9>& m9, const Matcher<A10>& m10) { |
| 10611 |
this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4, m5, |
| 10612 |
m6, m7, m8, m9, m10)); |
| 10613 |
return this->current_spec(); |
| 10614 |
} |
| 10615 |
|
| 10616 |
R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, |
| 10617 |
A10 a10) { |
| 10618 |
|
| 10619 |
|
| 10620 |
|
| 10621 |
|
| 10622 |
return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7, a8, a9, |
| 10623 |
a10)); |
| 10624 |
} |
| 10625 |
}; |
| 10626 |
|
| 10627 |
} |
| 10628 |
|
| 10629 |
|
| 10630 |
|
| 10631 |
|
| 10632 |
|
| 10633 |
|
| 10634 |
using internal::FunctionMocker; |
| 10635 |
|
| 10636 |
|
| 10637 |
|
| 10638 |
|
| 10639 |
|
| 10640 |
|
| 10641 |
#define GMOCK_RESULT_(tn, ...) \ |
| 10642 |
tn ::testing::internal::Function<__VA_ARGS__>::Result |
| 10643 |
|
| 10644 |
|
| 10645 |
|
| 10646 |
#define GMOCK_ARG_(tn, N, ...) \ |
| 10647 |
tn ::testing::internal::Function<__VA_ARGS__>::Argument##N |
| 10648 |
|
| 10649 |
|
| 10650 |
|
| 10651 |
#define GMOCK_MATCHER_(tn, N, ...) \ |
| 10652 |
const ::testing::Matcher<GMOCK_ARG_(tn, N, __VA_ARGS__)>& |
| 10653 |
|
| 10654 |
|
| 10655 |
|
| 10656 |
#define GMOCK_MOCKER_(arity, constness, Method) \ |
| 10657 |
GTEST_CONCAT_TOKEN_(gmock##constness##arity##_##Method##_, __LINE__) |
| 10658 |
|
| 10659 |
|
| 10660 |
#define GMOCK_METHOD0_(tn, constness, ct, Method, ...) \ |
| 10661 |
GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ |
| 10662 |
) constness { \ |
| 10663 |
GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size< \ |
| 10664 |
tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ |
| 10665 |
== 0), \ |
| 10666 |
this_method_does_not_take_0_arguments); \ |
| 10667 |
GMOCK_MOCKER_(0, constness, Method).SetOwnerAndName(this, #Method); \ |
| 10668 |
return GMOCK_MOCKER_(0, constness, Method).Invoke(); \ |
| 10669 |
} \ |
| 10670 |
::testing::MockSpec<__VA_ARGS__>& \ |
| 10671 |
gmock_##Method() constness { \ |
| 10672 |
GMOCK_MOCKER_(0, constness, Method).RegisterOwner(this); \ |
| 10673 |
return GMOCK_MOCKER_(0, constness, Method).With(); \ |
| 10674 |
} \ |
| 10675 |
mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(0, constness, \ |
| 10676 |
Method) |
| 10677 |
|
| 10678 |
|
| 10679 |
#define GMOCK_METHOD1_(tn, constness, ct, Method, ...) \ |
| 10680 |
GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ |
| 10681 |
GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1) constness { \ |
| 10682 |
GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size< \ |
| 10683 |
tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ |
| 10684 |
== 1), \ |
| 10685 |
this_method_does_not_take_1_argument); \ |
| 10686 |
GMOCK_MOCKER_(1, constness, Method).SetOwnerAndName(this, #Method); \ |
| 10687 |
return GMOCK_MOCKER_(1, constness, Method).Invoke(gmock_a1); \ |
| 10688 |
} \ |
| 10689 |
::testing::MockSpec<__VA_ARGS__>& \ |
| 10690 |
gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1) constness { \ |
| 10691 |
GMOCK_MOCKER_(1, constness, Method).RegisterOwner(this); \ |
| 10692 |
return GMOCK_MOCKER_(1, constness, Method).With(gmock_a1); \ |
| 10693 |
} \ |
| 10694 |
mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(1, constness, \ |
| 10695 |
Method) |
| 10696 |
|
| 10697 |
|
| 10698 |
#define GMOCK_METHOD2_(tn, constness, ct, Method, ...) \ |
| 10699 |
GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ |
| 10700 |
GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \ |
| 10701 |
GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2) constness { \ |
| 10702 |
GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size< \ |
| 10703 |
tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ |
| 10704 |
== 2), \ |
| 10705 |
this_method_does_not_take_2_arguments); \ |
| 10706 |
GMOCK_MOCKER_(2, constness, Method).SetOwnerAndName(this, #Method); \ |
| 10707 |
return GMOCK_MOCKER_(2, constness, Method).Invoke(gmock_a1, gmock_a2); \ |
| 10708 |
} \ |
| 10709 |
::testing::MockSpec<__VA_ARGS__>& \ |
| 10710 |
gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ |
| 10711 |
GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2) constness { \ |
| 10712 |
GMOCK_MOCKER_(2, constness, Method).RegisterOwner(this); \ |
| 10713 |
return GMOCK_MOCKER_(2, constness, Method).With(gmock_a1, gmock_a2); \ |
| 10714 |
} \ |
| 10715 |
mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(2, constness, \ |
| 10716 |
Method) |
| 10717 |
|
| 10718 |
|
| 10719 |
#define GMOCK_METHOD3_(tn, constness, ct, Method, ...) \ |
| 10720 |
GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ |
| 10721 |
GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \ |
| 10722 |
GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \ |
| 10723 |
GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3) constness { \ |
| 10724 |
GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size< \ |
| 10725 |
tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ |
| 10726 |
== 3), \ |
| 10727 |
this_method_does_not_take_3_arguments); \ |
| 10728 |
GMOCK_MOCKER_(3, constness, Method).SetOwnerAndName(this, #Method); \ |
| 10729 |
return GMOCK_MOCKER_(3, constness, Method).Invoke(gmock_a1, gmock_a2, \ |
| 10730 |
gmock_a3); \ |
| 10731 |
} \ |
| 10732 |
::testing::MockSpec<__VA_ARGS__>& \ |
| 10733 |
gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ |
| 10734 |
GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ |
| 10735 |
GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3) constness { \ |
| 10736 |
GMOCK_MOCKER_(3, constness, Method).RegisterOwner(this); \ |
| 10737 |
return GMOCK_MOCKER_(3, constness, Method).With(gmock_a1, gmock_a2, \ |
| 10738 |
gmock_a3); \ |
| 10739 |
} \ |
| 10740 |
mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(3, constness, \ |
| 10741 |
Method) |
| 10742 |
|
| 10743 |
|
| 10744 |
#define GMOCK_METHOD4_(tn, constness, ct, Method, ...) \ |
| 10745 |
GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ |
| 10746 |
GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \ |
| 10747 |
GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \ |
| 10748 |
GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \ |
| 10749 |
GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4) constness { \ |
| 10750 |
GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size< \ |
| 10751 |
tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ |
| 10752 |
== 4), \ |
| 10753 |
this_method_does_not_take_4_arguments); \ |
| 10754 |
GMOCK_MOCKER_(4, constness, Method).SetOwnerAndName(this, #Method); \ |
| 10755 |
return GMOCK_MOCKER_(4, constness, Method).Invoke(gmock_a1, gmock_a2, \ |
| 10756 |
gmock_a3, gmock_a4); \ |
| 10757 |
} \ |
| 10758 |
::testing::MockSpec<__VA_ARGS__>& \ |
| 10759 |
gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ |
| 10760 |
GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ |
| 10761 |
GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ |
| 10762 |
GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4) constness { \ |
| 10763 |
GMOCK_MOCKER_(4, constness, Method).RegisterOwner(this); \ |
| 10764 |
return GMOCK_MOCKER_(4, constness, Method).With(gmock_a1, gmock_a2, \ |
| 10765 |
gmock_a3, gmock_a4); \ |
| 10766 |
} \ |
| 10767 |
mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(4, constness, \ |
| 10768 |
Method) |
| 10769 |
|
| 10770 |
|
| 10771 |
#define GMOCK_METHOD5_(tn, constness, ct, Method, ...) \ |
| 10772 |
GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ |
| 10773 |
GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \ |
| 10774 |
GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \ |
| 10775 |
GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \ |
| 10776 |
GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \ |
| 10777 |
GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5) constness { \ |
| 10778 |
GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size< \ |
| 10779 |
tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ |
| 10780 |
== 5), \ |
| 10781 |
this_method_does_not_take_5_arguments); \ |
| 10782 |
GMOCK_MOCKER_(5, constness, Method).SetOwnerAndName(this, #Method); \ |
| 10783 |
return GMOCK_MOCKER_(5, constness, Method).Invoke(gmock_a1, gmock_a2, \ |
| 10784 |
gmock_a3, gmock_a4, gmock_a5); \ |
| 10785 |
} \ |
| 10786 |
::testing::MockSpec<__VA_ARGS__>& \ |
| 10787 |
gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ |
| 10788 |
GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ |
| 10789 |
GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ |
| 10790 |
GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ |
| 10791 |
GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5) constness { \ |
| 10792 |
GMOCK_MOCKER_(5, constness, Method).RegisterOwner(this); \ |
| 10793 |
return GMOCK_MOCKER_(5, constness, Method).With(gmock_a1, gmock_a2, \ |
| 10794 |
gmock_a3, gmock_a4, gmock_a5); \ |
| 10795 |
} \ |
| 10796 |
mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(5, constness, \ |
| 10797 |
Method) |
| 10798 |
|
| 10799 |
|
| 10800 |
#define GMOCK_METHOD6_(tn, constness, ct, Method, ...) \ |
| 10801 |
GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ |
| 10802 |
GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \ |
| 10803 |
GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \ |
| 10804 |
GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \ |
| 10805 |
GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \ |
| 10806 |
GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \ |
| 10807 |
GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6) constness { \ |
| 10808 |
GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size< \ |
| 10809 |
tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ |
| 10810 |
== 6), \ |
| 10811 |
this_method_does_not_take_6_arguments); \ |
| 10812 |
GMOCK_MOCKER_(6, constness, Method).SetOwnerAndName(this, #Method); \ |
| 10813 |
return GMOCK_MOCKER_(6, constness, Method).Invoke(gmock_a1, gmock_a2, \ |
| 10814 |
gmock_a3, gmock_a4, gmock_a5, gmock_a6); \ |
| 10815 |
} \ |
| 10816 |
::testing::MockSpec<__VA_ARGS__>& \ |
| 10817 |
gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ |
| 10818 |
GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ |
| 10819 |
GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ |
| 10820 |
GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ |
| 10821 |
GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \ |
| 10822 |
GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6) constness { \ |
| 10823 |
GMOCK_MOCKER_(6, constness, Method).RegisterOwner(this); \ |
| 10824 |
return GMOCK_MOCKER_(6, constness, Method).With(gmock_a1, gmock_a2, \ |
| 10825 |
gmock_a3, gmock_a4, gmock_a5, gmock_a6); \ |
| 10826 |
} \ |
| 10827 |
mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(6, constness, \ |
| 10828 |
Method) |
| 10829 |
|
| 10830 |
|
| 10831 |
#define GMOCK_METHOD7_(tn, constness, ct, Method, ...) \ |
| 10832 |
GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ |
| 10833 |
GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \ |
| 10834 |
GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \ |
| 10835 |
GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \ |
| 10836 |
GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \ |
| 10837 |
GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \ |
| 10838 |
GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \ |
| 10839 |
GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7) constness { \ |
| 10840 |
GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size< \ |
| 10841 |
tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ |
| 10842 |
== 7), \ |
| 10843 |
this_method_does_not_take_7_arguments); \ |
| 10844 |
GMOCK_MOCKER_(7, constness, Method).SetOwnerAndName(this, #Method); \ |
| 10845 |
return GMOCK_MOCKER_(7, constness, Method).Invoke(gmock_a1, gmock_a2, \ |
| 10846 |
gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7); \ |
| 10847 |
} \ |
| 10848 |
::testing::MockSpec<__VA_ARGS__>& \ |
| 10849 |
gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ |
| 10850 |
GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ |
| 10851 |
GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ |
| 10852 |
GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ |
| 10853 |
GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \ |
| 10854 |
GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \ |
| 10855 |
GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7) constness { \ |
| 10856 |
GMOCK_MOCKER_(7, constness, Method).RegisterOwner(this); \ |
| 10857 |
return GMOCK_MOCKER_(7, constness, Method).With(gmock_a1, gmock_a2, \ |
| 10858 |
gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7); \ |
| 10859 |
} \ |
| 10860 |
mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(7, constness, \ |
| 10861 |
Method) |
| 10862 |
|
| 10863 |
|
| 10864 |
#define GMOCK_METHOD8_(tn, constness, ct, Method, ...) \ |
| 10865 |
GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ |
| 10866 |
GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \ |
| 10867 |
GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \ |
| 10868 |
GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \ |
| 10869 |
GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \ |
| 10870 |
GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \ |
| 10871 |
GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \ |
| 10872 |
GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, \ |
| 10873 |
GMOCK_ARG_(tn, 8, __VA_ARGS__) gmock_a8) constness { \ |
| 10874 |
GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size< \ |
| 10875 |
tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ |
| 10876 |
== 8), \ |
| 10877 |
this_method_does_not_take_8_arguments); \ |
| 10878 |
GMOCK_MOCKER_(8, constness, Method).SetOwnerAndName(this, #Method); \ |
| 10879 |
return GMOCK_MOCKER_(8, constness, Method).Invoke(gmock_a1, gmock_a2, \ |
| 10880 |
gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \ |
| 10881 |
} \ |
| 10882 |
::testing::MockSpec<__VA_ARGS__>& \ |
| 10883 |
gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ |
| 10884 |
GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ |
| 10885 |
GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ |
| 10886 |
GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ |
| 10887 |
GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \ |
| 10888 |
GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \ |
| 10889 |
GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \ |
| 10890 |
GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8) constness { \ |
| 10891 |
GMOCK_MOCKER_(8, constness, Method).RegisterOwner(this); \ |
| 10892 |
return GMOCK_MOCKER_(8, constness, Method).With(gmock_a1, gmock_a2, \ |
| 10893 |
gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \ |
| 10894 |
} \ |
| 10895 |
mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(8, constness, \ |
| 10896 |
Method) |
| 10897 |
|
| 10898 |
|
| 10899 |
#define GMOCK_METHOD9_(tn, constness, ct, Method, ...) \ |
| 10900 |
GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ |
| 10901 |
GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \ |
| 10902 |
GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \ |
| 10903 |
GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \ |
| 10904 |
GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \ |
| 10905 |
GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \ |
| 10906 |
GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \ |
| 10907 |
GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, \ |
| 10908 |
GMOCK_ARG_(tn, 8, __VA_ARGS__) gmock_a8, \ |
| 10909 |
GMOCK_ARG_(tn, 9, __VA_ARGS__) gmock_a9) constness { \ |
| 10910 |
GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size< \ |
| 10911 |
tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ |
| 10912 |
== 9), \ |
| 10913 |
this_method_does_not_take_9_arguments); \ |
| 10914 |
GMOCK_MOCKER_(9, constness, Method).SetOwnerAndName(this, #Method); \ |
| 10915 |
return GMOCK_MOCKER_(9, constness, Method).Invoke(gmock_a1, gmock_a2, \ |
| 10916 |
gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, \ |
| 10917 |
gmock_a9); \ |
| 10918 |
} \ |
| 10919 |
::testing::MockSpec<__VA_ARGS__>& \ |
| 10920 |
gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ |
| 10921 |
GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ |
| 10922 |
GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ |
| 10923 |
GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ |
| 10924 |
GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \ |
| 10925 |
GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \ |
| 10926 |
GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \ |
| 10927 |
GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8, \ |
| 10928 |
GMOCK_MATCHER_(tn, 9, __VA_ARGS__) gmock_a9) constness { \ |
| 10929 |
GMOCK_MOCKER_(9, constness, Method).RegisterOwner(this); \ |
| 10930 |
return GMOCK_MOCKER_(9, constness, Method).With(gmock_a1, gmock_a2, \ |
| 10931 |
gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, \ |
| 10932 |
gmock_a9); \ |
| 10933 |
} \ |
| 10934 |
mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(9, constness, \ |
| 10935 |
Method) |
| 10936 |
|
| 10937 |
|
| 10938 |
#define GMOCK_METHOD10_(tn, constness, ct, Method, ...) \ |
| 10939 |
GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ |
| 10940 |
GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \ |
| 10941 |
GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \ |
| 10942 |
GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \ |
| 10943 |
GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \ |
| 10944 |
GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \ |
| 10945 |
GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \ |
| 10946 |
GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, \ |
| 10947 |
GMOCK_ARG_(tn, 8, __VA_ARGS__) gmock_a8, \ |
| 10948 |
GMOCK_ARG_(tn, 9, __VA_ARGS__) gmock_a9, \ |
| 10949 |
GMOCK_ARG_(tn, 10, __VA_ARGS__) gmock_a10) constness { \ |
| 10950 |
GTEST_COMPILE_ASSERT_((::std::tr1::tuple_size< \ |
| 10951 |
tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \ |
| 10952 |
== 10), \ |
| 10953 |
this_method_does_not_take_10_arguments); \ |
| 10954 |
GMOCK_MOCKER_(10, constness, Method).SetOwnerAndName(this, #Method); \ |
| 10955 |
return GMOCK_MOCKER_(10, constness, Method).Invoke(gmock_a1, gmock_a2, \ |
| 10956 |
gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9, \ |
| 10957 |
gmock_a10); \ |
| 10958 |
} \ |
| 10959 |
::testing::MockSpec<__VA_ARGS__>& \ |
| 10960 |
gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ |
| 10961 |
GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ |
| 10962 |
GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ |
| 10963 |
GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ |
| 10964 |
GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \ |
| 10965 |
GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \ |
| 10966 |
GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \ |
| 10967 |
GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8, \ |
| 10968 |
GMOCK_MATCHER_(tn, 9, __VA_ARGS__) gmock_a9, \ |
| 10969 |
GMOCK_MATCHER_(tn, 10, \ |
| 10970 |
__VA_ARGS__) gmock_a10) constness { \ |
| 10971 |
GMOCK_MOCKER_(10, constness, Method).RegisterOwner(this); \ |
| 10972 |
return GMOCK_MOCKER_(10, constness, Method).With(gmock_a1, gmock_a2, \ |
| 10973 |
gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9, \ |
| 10974 |
gmock_a10); \ |
| 10975 |
} \ |
| 10976 |
mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(10, constness, \ |
| 10977 |
Method) |
| 10978 |
|
| 10979 |
#define MOCK_METHOD0(m, ...) GMOCK_METHOD0_(, , , m, __VA_ARGS__) |
| 10980 |
#define MOCK_METHOD1(m, ...) GMOCK_METHOD1_(, , , m, __VA_ARGS__) |
| 10981 |
#define MOCK_METHOD2(m, ...) GMOCK_METHOD2_(, , , m, __VA_ARGS__) |
| 10982 |
#define MOCK_METHOD3(m, ...) GMOCK_METHOD3_(, , , m, __VA_ARGS__) |
| 10983 |
#define MOCK_METHOD4(m, ...) GMOCK_METHOD4_(, , , m, __VA_ARGS__) |
| 10984 |
#define MOCK_METHOD5(m, ...) GMOCK_METHOD5_(, , , m, __VA_ARGS__) |
| 10985 |
#define MOCK_METHOD6(m, ...) GMOCK_METHOD6_(, , , m, __VA_ARGS__) |
| 10986 |
#define MOCK_METHOD7(m, ...) GMOCK_METHOD7_(, , , m, __VA_ARGS__) |
| 10987 |
#define MOCK_METHOD8(m, ...) GMOCK_METHOD8_(, , , m, __VA_ARGS__) |
| 10988 |
#define MOCK_METHOD9(m, ...) GMOCK_METHOD9_(, , , m, __VA_ARGS__) |
| 10989 |
#define MOCK_METHOD10(m, ...) GMOCK_METHOD10_(, , , m, __VA_ARGS__) |
| 10990 |
|
| 10991 |
#define MOCK_CONST_METHOD0(m, ...) GMOCK_METHOD0_(, const, , m, __VA_ARGS__) |
| 10992 |
#define MOCK_CONST_METHOD1(m, ...) GMOCK_METHOD1_(, const, , m, __VA_ARGS__) |
| 10993 |
#define MOCK_CONST_METHOD2(m, ...) GMOCK_METHOD2_(, const, , m, __VA_ARGS__) |
| 10994 |
#define MOCK_CONST_METHOD3(m, ...) GMOCK_METHOD3_(, const, , m, __VA_ARGS__) |
| 10995 |
#define MOCK_CONST_METHOD4(m, ...) GMOCK_METHOD4_(, const, , m, __VA_ARGS__) |
| 10996 |
#define MOCK_CONST_METHOD5(m, ...) GMOCK_METHOD5_(, const, , m, __VA_ARGS__) |
| 10997 |
#define MOCK_CONST_METHOD6(m, ...) GMOCK_METHOD6_(, const, , m, __VA_ARGS__) |
| 10998 |
#define MOCK_CONST_METHOD7(m, ...) GMOCK_METHOD7_(, const, , m, __VA_ARGS__) |
| 10999 |
#define MOCK_CONST_METHOD8(m, ...) GMOCK_METHOD8_(, const, , m, __VA_ARGS__) |
| 11000 |
#define MOCK_CONST_METHOD9(m, ...) GMOCK_METHOD9_(, const, , m, __VA_ARGS__) |
| 11001 |
#define MOCK_CONST_METHOD10(m, ...) GMOCK_METHOD10_(, const, , m, __VA_ARGS__) |
| 11002 |
|
| 11003 |
#define MOCK_METHOD0_T(m, ...) GMOCK_METHOD0_(typename, , , m, __VA_ARGS__) |
| 11004 |
#define MOCK_METHOD1_T(m, ...) GMOCK_METHOD1_(typename, , , m, __VA_ARGS__) |
| 11005 |
#define MOCK_METHOD2_T(m, ...) GMOCK_METHOD2_(typename, , , m, __VA_ARGS__) |
| 11006 |
#define MOCK_METHOD3_T(m, ...) GMOCK_METHOD3_(typename, , , m, __VA_ARGS__) |
| 11007 |
#define MOCK_METHOD4_T(m, ...) GMOCK_METHOD4_(typename, , , m, __VA_ARGS__) |
| 11008 |
#define MOCK_METHOD5_T(m, ...) GMOCK_METHOD5_(typename, , , m, __VA_ARGS__) |
| 11009 |
#define MOCK_METHOD6_T(m, ...) GMOCK_METHOD6_(typename, , , m, __VA_ARGS__) |
| 11010 |
#define MOCK_METHOD7_T(m, ...) GMOCK_METHOD7_(typename, , , m, __VA_ARGS__) |
| 11011 |
#define MOCK_METHOD8_T(m, ...) GMOCK_METHOD8_(typename, , , m, __VA_ARGS__) |
| 11012 |
#define MOCK_METHOD9_T(m, ...) GMOCK_METHOD9_(typename, , , m, __VA_ARGS__) |
| 11013 |
#define MOCK_METHOD10_T(m, ...) GMOCK_METHOD10_(typename, , , m, __VA_ARGS__) |
| 11014 |
|
| 11015 |
#define MOCK_CONST_METHOD0_T(m, ...) \ |
| 11016 |
GMOCK_METHOD0_(typename, const, , m, __VA_ARGS__) |
| 11017 |
#define MOCK_CONST_METHOD1_T(m, ...) \ |
| 11018 |
GMOCK_METHOD1_(typename, const, , m, __VA_ARGS__) |
| 11019 |
#define MOCK_CONST_METHOD2_T(m, ...) \ |
| 11020 |
GMOCK_METHOD2_(typename, const, , m, __VA_ARGS__) |
| 11021 |
#define MOCK_CONST_METHOD3_T(m, ...) \ |
| 11022 |
GMOCK_METHOD3_(typename, const, , m, __VA_ARGS__) |
| 11023 |
#define MOCK_CONST_METHOD4_T(m, ...) \ |
| 11024 |
GMOCK_METHOD4_(typename, const, , m, __VA_ARGS__) |
| 11025 |
#define MOCK_CONST_METHOD5_T(m, ...) \ |
| 11026 |
GMOCK_METHOD5_(typename, const, , m, __VA_ARGS__) |
| 11027 |
#define MOCK_CONST_METHOD6_T(m, ...) \ |
| 11028 |
GMOCK_METHOD6_(typename, const, , m, __VA_ARGS__) |
| 11029 |
#define MOCK_CONST_METHOD7_T(m, ...) \ |
| 11030 |
GMOCK_METHOD7_(typename, const, , m, __VA_ARGS__) |
| 11031 |
#define MOCK_CONST_METHOD8_T(m, ...) \ |
| 11032 |
GMOCK_METHOD8_(typename, const, , m, __VA_ARGS__) |
| 11033 |
#define MOCK_CONST_METHOD9_T(m, ...) \ |
| 11034 |
GMOCK_METHOD9_(typename, const, , m, __VA_ARGS__) |
| 11035 |
#define MOCK_CONST_METHOD10_T(m, ...) \ |
| 11036 |
GMOCK_METHOD10_(typename, const, , m, __VA_ARGS__) |
| 11037 |
|
| 11038 |
#define MOCK_METHOD0_WITH_CALLTYPE(ct, m, ...) \ |
| 11039 |
GMOCK_METHOD0_(, , ct, m, __VA_ARGS__) |
| 11040 |
#define MOCK_METHOD1_WITH_CALLTYPE(ct, m, ...) \ |
| 11041 |
GMOCK_METHOD1_(, , ct, m, __VA_ARGS__) |
| 11042 |
#define MOCK_METHOD2_WITH_CALLTYPE(ct, m, ...) \ |
| 11043 |
GMOCK_METHOD2_(, , ct, m, __VA_ARGS__) |
| 11044 |
#define MOCK_METHOD3_WITH_CALLTYPE(ct, m, ...) \ |
| 11045 |
GMOCK_METHOD3_(, , ct, m, __VA_ARGS__) |
| 11046 |
#define MOCK_METHOD4_WITH_CALLTYPE(ct, m, ...) \ |
| 11047 |
GMOCK_METHOD4_(, , ct, m, __VA_ARGS__) |
| 11048 |
#define MOCK_METHOD5_WITH_CALLTYPE(ct, m, ...) \ |
| 11049 |
GMOCK_METHOD5_(, , ct, m, __VA_ARGS__) |
| 11050 |
#define MOCK_METHOD6_WITH_CALLTYPE(ct, m, ...) \ |
| 11051 |
GMOCK_METHOD6_(, , ct, m, __VA_ARGS__) |
| 11052 |
#define MOCK_METHOD7_WITH_CALLTYPE(ct, m, ...) \ |
| 11053 |
GMOCK_METHOD7_(, , ct, m, __VA_ARGS__) |
| 11054 |
#define MOCK_METHOD8_WITH_CALLTYPE(ct, m, ...) \ |
| 11055 |
GMOCK_METHOD8_(, , ct, m, __VA_ARGS__) |
| 11056 |
#define MOCK_METHOD9_WITH_CALLTYPE(ct, m, ...) \ |
| 11057 |
GMOCK_METHOD9_(, , ct, m, __VA_ARGS__) |
| 11058 |
#define MOCK_METHOD10_WITH_CALLTYPE(ct, m, ...) \ |
| 11059 |
GMOCK_METHOD10_(, , ct, m, __VA_ARGS__) |
| 11060 |
|
| 11061 |
#define MOCK_CONST_METHOD0_WITH_CALLTYPE(ct, m, ...) \ |
| 11062 |
GMOCK_METHOD0_(, const, ct, m, __VA_ARGS__) |
| 11063 |
#define MOCK_CONST_METHOD1_WITH_CALLTYPE(ct, m, ...) \ |
| 11064 |
GMOCK_METHOD1_(, const, ct, m, __VA_ARGS__) |
| 11065 |
#define MOCK_CONST_METHOD2_WITH_CALLTYPE(ct, m, ...) \ |
| 11066 |
GMOCK_METHOD2_(, const, ct, m, __VA_ARGS__) |
| 11067 |
#define MOCK_CONST_METHOD3_WITH_CALLTYPE(ct, m, ...) \ |
| 11068 |
GMOCK_METHOD3_(, const, ct, m, __VA_ARGS__) |
| 11069 |
#define MOCK_CONST_METHOD4_WITH_CALLTYPE(ct, m, ...) \ |
| 11070 |
GMOCK_METHOD4_(, const, ct, m, __VA_ARGS__) |
| 11071 |
#define MOCK_CONST_METHOD5_WITH_CALLTYPE(ct, m, ...) \ |
| 11072 |
GMOCK_METHOD5_(, const, ct, m, __VA_ARGS__) |
| 11073 |
#define MOCK_CONST_METHOD6_WITH_CALLTYPE(ct, m, ...) \ |
| 11074 |
GMOCK_METHOD6_(, const, ct, m, __VA_ARGS__) |
| 11075 |
#define MOCK_CONST_METHOD7_WITH_CALLTYPE(ct, m, ...) \ |
| 11076 |
GMOCK_METHOD7_(, const, ct, m, __VA_ARGS__) |
| 11077 |
#define MOCK_CONST_METHOD8_WITH_CALLTYPE(ct, m, ...) \ |
| 11078 |
GMOCK_METHOD8_(, const, ct, m, __VA_ARGS__) |
| 11079 |
#define MOCK_CONST_METHOD9_WITH_CALLTYPE(ct, m, ...) \ |
| 11080 |
GMOCK_METHOD9_(, const, ct, m, __VA_ARGS__) |
| 11081 |
#define MOCK_CONST_METHOD10_WITH_CALLTYPE(ct, m, ...) \ |
| 11082 |
GMOCK_METHOD10_(, const, ct, m, __VA_ARGS__) |
| 11083 |
|
| 11084 |
#define MOCK_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \ |
| 11085 |
GMOCK_METHOD0_(typename, , ct, m, __VA_ARGS__) |
| 11086 |
#define MOCK_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \ |
| 11087 |
GMOCK_METHOD1_(typename, , ct, m, __VA_ARGS__) |
| 11088 |
#define MOCK_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \ |
| 11089 |
GMOCK_METHOD2_(typename, , ct, m, __VA_ARGS__) |
| 11090 |
#define MOCK_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \ |
| 11091 |
GMOCK_METHOD3_(typename, , ct, m, __VA_ARGS__) |
| 11092 |
#define MOCK_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \ |
| 11093 |
GMOCK_METHOD4_(typename, , ct, m, __VA_ARGS__) |
| 11094 |
#define MOCK_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \ |
| 11095 |
GMOCK_METHOD5_(typename, , ct, m, __VA_ARGS__) |
| 11096 |
#define MOCK_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \ |
| 11097 |
GMOCK_METHOD6_(typename, , ct, m, __VA_ARGS__) |
| 11098 |
#define MOCK_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \ |
| 11099 |
GMOCK_METHOD7_(typename, , ct, m, __VA_ARGS__) |
| 11100 |
#define MOCK_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \ |
| 11101 |
GMOCK_METHOD8_(typename, , ct, m, __VA_ARGS__) |
| 11102 |
#define MOCK_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \ |
| 11103 |
GMOCK_METHOD9_(typename, , ct, m, __VA_ARGS__) |
| 11104 |
#define MOCK_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \ |
| 11105 |
GMOCK_METHOD10_(typename, , ct, m, __VA_ARGS__) |
| 11106 |
|
| 11107 |
#define MOCK_CONST_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \ |
| 11108 |
GMOCK_METHOD0_(typename, const, ct, m, __VA_ARGS__) |
| 11109 |
#define MOCK_CONST_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \ |
| 11110 |
GMOCK_METHOD1_(typename, const, ct, m, __VA_ARGS__) |
| 11111 |
#define MOCK_CONST_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \ |
| 11112 |
GMOCK_METHOD2_(typename, const, ct, m, __VA_ARGS__) |
| 11113 |
#define MOCK_CONST_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \ |
| 11114 |
GMOCK_METHOD3_(typename, const, ct, m, __VA_ARGS__) |
| 11115 |
#define MOCK_CONST_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \ |
| 11116 |
GMOCK_METHOD4_(typename, const, ct, m, __VA_ARGS__) |
| 11117 |
#define MOCK_CONST_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \ |
| 11118 |
GMOCK_METHOD5_(typename, const, ct, m, __VA_ARGS__) |
| 11119 |
#define MOCK_CONST_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \ |
| 11120 |
GMOCK_METHOD6_(typename, const, ct, m, __VA_ARGS__) |
| 11121 |
#define MOCK_CONST_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \ |
| 11122 |
GMOCK_METHOD7_(typename, const, ct, m, __VA_ARGS__) |
| 11123 |
#define MOCK_CONST_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \ |
| 11124 |
GMOCK_METHOD8_(typename, const, ct, m, __VA_ARGS__) |
| 11125 |
#define MOCK_CONST_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \ |
| 11126 |
GMOCK_METHOD9_(typename, const, ct, m, __VA_ARGS__) |
| 11127 |
#define MOCK_CONST_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \ |
| 11128 |
GMOCK_METHOD10_(typename, const, ct, m, __VA_ARGS__) |
| 11129 |
|
| 11130 |
|
| 11131 |
|
| 11132 |
|
| 11133 |
|
| 11134 |
|
| 11135 |
|
| 11136 |
|
| 11137 |
|
| 11138 |
|
| 11139 |
|
| 11140 |
|
| 11141 |
|
| 11142 |
|
| 11143 |
|
| 11144 |
|
| 11145 |
|
| 11146 |
|
| 11147 |
|
| 11148 |
|
| 11149 |
|
| 11150 |
|
| 11151 |
|
| 11152 |
|
| 11153 |
|
| 11154 |
|
| 11155 |
|
| 11156 |
|
| 11157 |
|
| 11158 |
|
| 11159 |
|
| 11160 |
|
| 11161 |
|
| 11162 |
|
| 11163 |
|
| 11164 |
|
| 11165 |
template <typename F> |
| 11166 |
class MockFunction; |
| 11167 |
|
| 11168 |
template <typename R> |
| 11169 |
class MockFunction<R()> { |
| 11170 |
public: |
| 11171 |
MockFunction() {} |
| 11172 |
|
| 11173 |
MOCK_METHOD0_T(Call, R()); |
| 11174 |
|
| 11175 |
private: |
| 11176 |
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); |
| 11177 |
}; |
| 11178 |
|
| 11179 |
template <typename R, typename A0> |
| 11180 |
class MockFunction<R(A0)> { |
| 11181 |
public: |
| 11182 |
MockFunction() {} |
| 11183 |
|
| 11184 |
MOCK_METHOD1_T(Call, R(A0)); |
| 11185 |
|
| 11186 |
private: |
| 11187 |
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); |
| 11188 |
}; |
| 11189 |
|
| 11190 |
template <typename R, typename A0, typename A1> |
| 11191 |
class MockFunction<R(A0, A1)> { |
| 11192 |
public: |
| 11193 |
MockFunction() {} |
| 11194 |
|
| 11195 |
MOCK_METHOD2_T(Call, R(A0, A1)); |
| 11196 |
|
| 11197 |
private: |
| 11198 |
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); |
| 11199 |
}; |
| 11200 |
|
| 11201 |
template <typename R, typename A0, typename A1, typename A2> |
| 11202 |
class MockFunction<R(A0, A1, A2)> { |
| 11203 |
public: |
| 11204 |
MockFunction() {} |
| 11205 |
|
| 11206 |
MOCK_METHOD3_T(Call, R(A0, A1, A2)); |
| 11207 |
|
| 11208 |
private: |
| 11209 |
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); |
| 11210 |
}; |
| 11211 |
|
| 11212 |
template <typename R, typename A0, typename A1, typename A2, typename A3> |
| 11213 |
class MockFunction<R(A0, A1, A2, A3)> { |
| 11214 |
public: |
| 11215 |
MockFunction() {} |
| 11216 |
|
| 11217 |
MOCK_METHOD4_T(Call, R(A0, A1, A2, A3)); |
| 11218 |
|
| 11219 |
private: |
| 11220 |
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); |
| 11221 |
}; |
| 11222 |
|
| 11223 |
template <typename R, typename A0, typename A1, typename A2, typename A3, |
| 11224 |
typename A4> |
| 11225 |
class MockFunction<R(A0, A1, A2, A3, A4)> { |
| 11226 |
public: |
| 11227 |
MockFunction() {} |
| 11228 |
|
| 11229 |
MOCK_METHOD5_T(Call, R(A0, A1, A2, A3, A4)); |
| 11230 |
|
| 11231 |
private: |
| 11232 |
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); |
| 11233 |
}; |
| 11234 |
|
| 11235 |
template <typename R, typename A0, typename A1, typename A2, typename A3, |
| 11236 |
typename A4, typename A5> |
| 11237 |
class MockFunction<R(A0, A1, A2, A3, A4, A5)> { |
| 11238 |
public: |
| 11239 |
MockFunction() {} |
| 11240 |
|
| 11241 |
MOCK_METHOD6_T(Call, R(A0, A1, A2, A3, A4, A5)); |
| 11242 |
|
| 11243 |
private: |
| 11244 |
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); |
| 11245 |
}; |
| 11246 |
|
| 11247 |
template <typename R, typename A0, typename A1, typename A2, typename A3, |
| 11248 |
typename A4, typename A5, typename A6> |
| 11249 |
class MockFunction<R(A0, A1, A2, A3, A4, A5, A6)> { |
| 11250 |
public: |
| 11251 |
MockFunction() {} |
| 11252 |
|
| 11253 |
MOCK_METHOD7_T(Call, R(A0, A1, A2, A3, A4, A5, A6)); |
| 11254 |
|
| 11255 |
private: |
| 11256 |
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); |
| 11257 |
}; |
| 11258 |
|
| 11259 |
template <typename R, typename A0, typename A1, typename A2, typename A3, |
| 11260 |
typename A4, typename A5, typename A6, typename A7> |
| 11261 |
class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7)> { |
| 11262 |
public: |
| 11263 |
MockFunction() {} |
| 11264 |
|
| 11265 |
MOCK_METHOD8_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7)); |
| 11266 |
|
| 11267 |
private: |
| 11268 |
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); |
| 11269 |
}; |
| 11270 |
|
| 11271 |
template <typename R, typename A0, typename A1, typename A2, typename A3, |
| 11272 |
typename A4, typename A5, typename A6, typename A7, typename A8> |
| 11273 |
class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7, A8)> { |
| 11274 |
public: |
| 11275 |
MockFunction() {} |
| 11276 |
|
| 11277 |
MOCK_METHOD9_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8)); |
| 11278 |
|
| 11279 |
private: |
| 11280 |
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); |
| 11281 |
}; |
| 11282 |
|
| 11283 |
template <typename R, typename A0, typename A1, typename A2, typename A3, |
| 11284 |
typename A4, typename A5, typename A6, typename A7, typename A8, |
| 11285 |
typename A9> |
| 11286 |
class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)> { |
| 11287 |
public: |
| 11288 |
MockFunction() {} |
| 11289 |
|
| 11290 |
MOCK_METHOD10_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)); |
| 11291 |
|
| 11292 |
private: |
| 11293 |
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction); |
| 11294 |
}; |
| 11295 |
|
| 11296 |
} |
| 11297 |
|
| 11298 |
#endif |
| 11299 |
|
| 11300 |
|
| 11301 |
|
| 11302 |
|
| 11303 |
|
| 11304 |
|
| 11305 |
|
| 11306 |
|
| 11307 |
|
| 11308 |
|
| 11309 |
|
| 11310 |
|
| 11311 |
|
| 11312 |
|
| 11313 |
|
| 11314 |
|
| 11315 |
|
| 11316 |
|
| 11317 |
|
| 11318 |
|
| 11319 |
|
| 11320 |
|
| 11321 |
|
| 11322 |
|
| 11323 |
|
| 11324 |
|
| 11325 |
|
| 11326 |
|
| 11327 |
|
| 11328 |
|
| 11329 |
|
| 11330 |
|
| 11331 |
|
| 11332 |
|
| 11333 |
|
| 11334 |
|
| 11335 |
|
| 11336 |
|
| 11337 |
|
| 11338 |
|
| 11339 |
|
| 11340 |
|
| 11341 |
|
| 11342 |
|
| 11343 |
|
| 11344 |
|
| 11345 |
|
| 11346 |
|
| 11347 |
|
| 11348 |
|
| 11349 |
|
| 11350 |
|
| 11351 |
|
| 11352 |
|
| 11353 |
|
| 11354 |
|
| 11355 |
|
| 11356 |
|
| 11357 |
|
| 11358 |
|
| 11359 |
|
| 11360 |
|
| 11361 |
|
| 11362 |
|
| 11363 |
|
| 11364 |
|
| 11365 |
|
| 11366 |
|
| 11367 |
|
| 11368 |
|
| 11369 |
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_ |
| 11370 |
#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_ |
| 11371 |
|
| 11372 |
|
| 11373 |
namespace testing { |
| 11374 |
|
| 11375 |
template <class MockClass> |
| 11376 |
class NiceMock : public MockClass { |
| 11377 |
public: |
| 11378 |
|
| 11379 |
|
| 11380 |
NiceMock() { |
| 11381 |
::testing::Mock::AllowUninterestingCalls( |
| 11382 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11383 |
} |
| 11384 |
|
| 11385 |
|
| 11386 |
|
| 11387 |
template <typename A1> |
| 11388 |
explicit NiceMock(const A1& a1) : MockClass(a1) { |
| 11389 |
::testing::Mock::AllowUninterestingCalls( |
| 11390 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11391 |
} |
| 11392 |
template <typename A1, typename A2> |
| 11393 |
NiceMock(const A1& a1, const A2& a2) : MockClass(a1, a2) { |
| 11394 |
::testing::Mock::AllowUninterestingCalls( |
| 11395 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11396 |
} |
| 11397 |
|
| 11398 |
template <typename A1, typename A2, typename A3> |
| 11399 |
NiceMock(const A1& a1, const A2& a2, const A3& a3) : MockClass(a1, a2, a3) { |
| 11400 |
::testing::Mock::AllowUninterestingCalls( |
| 11401 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11402 |
} |
| 11403 |
|
| 11404 |
template <typename A1, typename A2, typename A3, typename A4> |
| 11405 |
NiceMock(const A1& a1, const A2& a2, const A3& a3, |
| 11406 |
const A4& a4) : MockClass(a1, a2, a3, a4) { |
| 11407 |
::testing::Mock::AllowUninterestingCalls( |
| 11408 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11409 |
} |
| 11410 |
|
| 11411 |
template <typename A1, typename A2, typename A3, typename A4, typename A5> |
| 11412 |
NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, |
| 11413 |
const A5& a5) : MockClass(a1, a2, a3, a4, a5) { |
| 11414 |
::testing::Mock::AllowUninterestingCalls( |
| 11415 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11416 |
} |
| 11417 |
|
| 11418 |
template <typename A1, typename A2, typename A3, typename A4, typename A5, |
| 11419 |
typename A6> |
| 11420 |
NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, |
| 11421 |
const A5& a5, const A6& a6) : MockClass(a1, a2, a3, a4, a5, a6) { |
| 11422 |
::testing::Mock::AllowUninterestingCalls( |
| 11423 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11424 |
} |
| 11425 |
|
| 11426 |
template <typename A1, typename A2, typename A3, typename A4, typename A5, |
| 11427 |
typename A6, typename A7> |
| 11428 |
NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, |
| 11429 |
const A5& a5, const A6& a6, const A7& a7) : MockClass(a1, a2, a3, a4, a5, |
| 11430 |
a6, a7) { |
| 11431 |
::testing::Mock::AllowUninterestingCalls( |
| 11432 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11433 |
} |
| 11434 |
|
| 11435 |
template <typename A1, typename A2, typename A3, typename A4, typename A5, |
| 11436 |
typename A6, typename A7, typename A8> |
| 11437 |
NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, |
| 11438 |
const A5& a5, const A6& a6, const A7& a7, const A8& a8) : MockClass(a1, |
| 11439 |
a2, a3, a4, a5, a6, a7, a8) { |
| 11440 |
::testing::Mock::AllowUninterestingCalls( |
| 11441 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11442 |
} |
| 11443 |
|
| 11444 |
template <typename A1, typename A2, typename A3, typename A4, typename A5, |
| 11445 |
typename A6, typename A7, typename A8, typename A9> |
| 11446 |
NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, |
| 11447 |
const A5& a5, const A6& a6, const A7& a7, const A8& a8, |
| 11448 |
const A9& a9) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9) { |
| 11449 |
::testing::Mock::AllowUninterestingCalls( |
| 11450 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11451 |
} |
| 11452 |
|
| 11453 |
template <typename A1, typename A2, typename A3, typename A4, typename A5, |
| 11454 |
typename A6, typename A7, typename A8, typename A9, typename A10> |
| 11455 |
NiceMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, |
| 11456 |
const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9, |
| 11457 |
const A10& a10) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) { |
| 11458 |
::testing::Mock::AllowUninterestingCalls( |
| 11459 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11460 |
} |
| 11461 |
|
| 11462 |
virtual ~NiceMock() { |
| 11463 |
::testing::Mock::UnregisterCallReaction( |
| 11464 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11465 |
} |
| 11466 |
|
| 11467 |
private: |
| 11468 |
GTEST_DISALLOW_COPY_AND_ASSIGN_(NiceMock); |
| 11469 |
}; |
| 11470 |
|
| 11471 |
template <class MockClass> |
| 11472 |
class NaggyMock : public MockClass { |
| 11473 |
public: |
| 11474 |
|
| 11475 |
|
| 11476 |
NaggyMock() { |
| 11477 |
::testing::Mock::WarnUninterestingCalls( |
| 11478 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11479 |
} |
| 11480 |
|
| 11481 |
|
| 11482 |
|
| 11483 |
template <typename A1> |
| 11484 |
explicit NaggyMock(const A1& a1) : MockClass(a1) { |
| 11485 |
::testing::Mock::WarnUninterestingCalls( |
| 11486 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11487 |
} |
| 11488 |
template <typename A1, typename A2> |
| 11489 |
NaggyMock(const A1& a1, const A2& a2) : MockClass(a1, a2) { |
| 11490 |
::testing::Mock::WarnUninterestingCalls( |
| 11491 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11492 |
} |
| 11493 |
|
| 11494 |
template <typename A1, typename A2, typename A3> |
| 11495 |
NaggyMock(const A1& a1, const A2& a2, const A3& a3) : MockClass(a1, a2, a3) { |
| 11496 |
::testing::Mock::WarnUninterestingCalls( |
| 11497 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11498 |
} |
| 11499 |
|
| 11500 |
template <typename A1, typename A2, typename A3, typename A4> |
| 11501 |
NaggyMock(const A1& a1, const A2& a2, const A3& a3, |
| 11502 |
const A4& a4) : MockClass(a1, a2, a3, a4) { |
| 11503 |
::testing::Mock::WarnUninterestingCalls( |
| 11504 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11505 |
} |
| 11506 |
|
| 11507 |
template <typename A1, typename A2, typename A3, typename A4, typename A5> |
| 11508 |
NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, |
| 11509 |
const A5& a5) : MockClass(a1, a2, a3, a4, a5) { |
| 11510 |
::testing::Mock::WarnUninterestingCalls( |
| 11511 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11512 |
} |
| 11513 |
|
| 11514 |
template <typename A1, typename A2, typename A3, typename A4, typename A5, |
| 11515 |
typename A6> |
| 11516 |
NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, |
| 11517 |
const A5& a5, const A6& a6) : MockClass(a1, a2, a3, a4, a5, a6) { |
| 11518 |
::testing::Mock::WarnUninterestingCalls( |
| 11519 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11520 |
} |
| 11521 |
|
| 11522 |
template <typename A1, typename A2, typename A3, typename A4, typename A5, |
| 11523 |
typename A6, typename A7> |
| 11524 |
NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, |
| 11525 |
const A5& a5, const A6& a6, const A7& a7) : MockClass(a1, a2, a3, a4, a5, |
| 11526 |
a6, a7) { |
| 11527 |
::testing::Mock::WarnUninterestingCalls( |
| 11528 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11529 |
} |
| 11530 |
|
| 11531 |
template <typename A1, typename A2, typename A3, typename A4, typename A5, |
| 11532 |
typename A6, typename A7, typename A8> |
| 11533 |
NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, |
| 11534 |
const A5& a5, const A6& a6, const A7& a7, const A8& a8) : MockClass(a1, |
| 11535 |
a2, a3, a4, a5, a6, a7, a8) { |
| 11536 |
::testing::Mock::WarnUninterestingCalls( |
| 11537 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11538 |
} |
| 11539 |
|
| 11540 |
template <typename A1, typename A2, typename A3, typename A4, typename A5, |
| 11541 |
typename A6, typename A7, typename A8, typename A9> |
| 11542 |
NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, |
| 11543 |
const A5& a5, const A6& a6, const A7& a7, const A8& a8, |
| 11544 |
const A9& a9) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9) { |
| 11545 |
::testing::Mock::WarnUninterestingCalls( |
| 11546 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11547 |
} |
| 11548 |
|
| 11549 |
template <typename A1, typename A2, typename A3, typename A4, typename A5, |
| 11550 |
typename A6, typename A7, typename A8, typename A9, typename A10> |
| 11551 |
NaggyMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, |
| 11552 |
const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9, |
| 11553 |
const A10& a10) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) { |
| 11554 |
::testing::Mock::WarnUninterestingCalls( |
| 11555 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11556 |
} |
| 11557 |
|
| 11558 |
virtual ~NaggyMock() { |
| 11559 |
::testing::Mock::UnregisterCallReaction( |
| 11560 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11561 |
} |
| 11562 |
|
| 11563 |
private: |
| 11564 |
GTEST_DISALLOW_COPY_AND_ASSIGN_(NaggyMock); |
| 11565 |
}; |
| 11566 |
|
| 11567 |
template <class MockClass> |
| 11568 |
class StrictMock : public MockClass { |
| 11569 |
public: |
| 11570 |
|
| 11571 |
|
| 11572 |
StrictMock() { |
| 11573 |
::testing::Mock::FailUninterestingCalls( |
| 11574 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11575 |
} |
| 11576 |
|
| 11577 |
|
| 11578 |
|
| 11579 |
template <typename A1> |
| 11580 |
explicit StrictMock(const A1& a1) : MockClass(a1) { |
| 11581 |
::testing::Mock::FailUninterestingCalls( |
| 11582 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11583 |
} |
| 11584 |
template <typename A1, typename A2> |
| 11585 |
StrictMock(const A1& a1, const A2& a2) : MockClass(a1, a2) { |
| 11586 |
::testing::Mock::FailUninterestingCalls( |
| 11587 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11588 |
} |
| 11589 |
|
| 11590 |
template <typename A1, typename A2, typename A3> |
| 11591 |
StrictMock(const A1& a1, const A2& a2, const A3& a3) : MockClass(a1, a2, a3) { |
| 11592 |
::testing::Mock::FailUninterestingCalls( |
| 11593 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11594 |
} |
| 11595 |
|
| 11596 |
template <typename A1, typename A2, typename A3, typename A4> |
| 11597 |
StrictMock(const A1& a1, const A2& a2, const A3& a3, |
| 11598 |
const A4& a4) : MockClass(a1, a2, a3, a4) { |
| 11599 |
::testing::Mock::FailUninterestingCalls( |
| 11600 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11601 |
} |
| 11602 |
|
| 11603 |
template <typename A1, typename A2, typename A3, typename A4, typename A5> |
| 11604 |
StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, |
| 11605 |
const A5& a5) : MockClass(a1, a2, a3, a4, a5) { |
| 11606 |
::testing::Mock::FailUninterestingCalls( |
| 11607 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11608 |
} |
| 11609 |
|
| 11610 |
template <typename A1, typename A2, typename A3, typename A4, typename A5, |
| 11611 |
typename A6> |
| 11612 |
StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, |
| 11613 |
const A5& a5, const A6& a6) : MockClass(a1, a2, a3, a4, a5, a6) { |
| 11614 |
::testing::Mock::FailUninterestingCalls( |
| 11615 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11616 |
} |
| 11617 |
|
| 11618 |
template <typename A1, typename A2, typename A3, typename A4, typename A5, |
| 11619 |
typename A6, typename A7> |
| 11620 |
StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, |
| 11621 |
const A5& a5, const A6& a6, const A7& a7) : MockClass(a1, a2, a3, a4, a5, |
| 11622 |
a6, a7) { |
| 11623 |
::testing::Mock::FailUninterestingCalls( |
| 11624 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11625 |
} |
| 11626 |
|
| 11627 |
template <typename A1, typename A2, typename A3, typename A4, typename A5, |
| 11628 |
typename A6, typename A7, typename A8> |
| 11629 |
StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, |
| 11630 |
const A5& a5, const A6& a6, const A7& a7, const A8& a8) : MockClass(a1, |
| 11631 |
a2, a3, a4, a5, a6, a7, a8) { |
| 11632 |
::testing::Mock::FailUninterestingCalls( |
| 11633 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11634 |
} |
| 11635 |
|
| 11636 |
template <typename A1, typename A2, typename A3, typename A4, typename A5, |
| 11637 |
typename A6, typename A7, typename A8, typename A9> |
| 11638 |
StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, |
| 11639 |
const A5& a5, const A6& a6, const A7& a7, const A8& a8, |
| 11640 |
const A9& a9) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9) { |
| 11641 |
::testing::Mock::FailUninterestingCalls( |
| 11642 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11643 |
} |
| 11644 |
|
| 11645 |
template <typename A1, typename A2, typename A3, typename A4, typename A5, |
| 11646 |
typename A6, typename A7, typename A8, typename A9, typename A10> |
| 11647 |
StrictMock(const A1& a1, const A2& a2, const A3& a3, const A4& a4, |
| 11648 |
const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9, |
| 11649 |
const A10& a10) : MockClass(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) { |
| 11650 |
::testing::Mock::FailUninterestingCalls( |
| 11651 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11652 |
} |
| 11653 |
|
| 11654 |
virtual ~StrictMock() { |
| 11655 |
::testing::Mock::UnregisterCallReaction( |
| 11656 |
internal::ImplicitCast_<MockClass*>(this)); |
| 11657 |
} |
| 11658 |
|
| 11659 |
private: |
| 11660 |
GTEST_DISALLOW_COPY_AND_ASSIGN_(StrictMock); |
| 11661 |
}; |
| 11662 |
|
| 11663 |
|
| 11664 |
|
| 11665 |
|
| 11666 |
|
| 11667 |
|
| 11668 |
|
| 11669 |
|
| 11670 |
template <typename MockClass> |
| 11671 |
class NiceMock<NiceMock<MockClass> >; |
| 11672 |
template <typename MockClass> |
| 11673 |
class NiceMock<NaggyMock<MockClass> >; |
| 11674 |
template <typename MockClass> |
| 11675 |
class NiceMock<StrictMock<MockClass> >; |
| 11676 |
|
| 11677 |
template <typename MockClass> |
| 11678 |
class NaggyMock<NiceMock<MockClass> >; |
| 11679 |
template <typename MockClass> |
| 11680 |
class NaggyMock<NaggyMock<MockClass> >; |
| 11681 |
template <typename MockClass> |
| 11682 |
class NaggyMock<StrictMock<MockClass> >; |
| 11683 |
|
| 11684 |
template <typename MockClass> |
| 11685 |
class StrictMock<NiceMock<MockClass> >; |
| 11686 |
template <typename MockClass> |
| 11687 |
class StrictMock<NaggyMock<MockClass> >; |
| 11688 |
template <typename MockClass> |
| 11689 |
class StrictMock<StrictMock<MockClass> >; |
| 11690 |
|
| 11691 |
} |
| 11692 |
|
| 11693 |
#endif |
| 11694 |
|
| 11695 |
|
| 11696 |
|
| 11697 |
|
| 11698 |
|
| 11699 |
|
| 11700 |
|
| 11701 |
|
| 11702 |
|
| 11703 |
|
| 11704 |
|
| 11705 |
|
| 11706 |
|
| 11707 |
|
| 11708 |
|
| 11709 |
|
| 11710 |
|
| 11711 |
|
| 11712 |
|
| 11713 |
|
| 11714 |
|
| 11715 |
|
| 11716 |
|
| 11717 |
|
| 11718 |
|
| 11719 |
|
| 11720 |
|
| 11721 |
|
| 11722 |
|
| 11723 |
|
| 11724 |
|
| 11725 |
|
| 11726 |
|
| 11727 |
|
| 11728 |
|
| 11729 |
|
| 11730 |
|
| 11731 |
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ |
| 11732 |
#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ |
| 11733 |
|
| 11734 |
#include <iterator> |
| 11735 |
#include <sstream> |
| 11736 |
#include <string> |
| 11737 |
#include <vector> |
| 11738 |
|
| 11739 |
namespace testing { |
| 11740 |
namespace internal { |
| 11741 |
|
| 11742 |
|
| 11743 |
#define GMOCK_FIELD_TYPE_(Tuple, i) \ |
| 11744 |
typename ::std::tr1::tuple_element<i, Tuple>::type |
| 11745 |
|
| 11746 |
|
| 11747 |
|
| 11748 |
|
| 11749 |
|
| 11750 |
|
| 11751 |
|
| 11752 |
|
| 11753 |
|
| 11754 |
|
| 11755 |
|
| 11756 |
|
| 11757 |
template <class Tuple, int k0 = -1, int k1 = -1, int k2 = -1, int k3 = -1, |
| 11758 |
int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1, int k8 = -1, |
| 11759 |
int k9 = -1> |
| 11760 |
class TupleFields; |
| 11761 |
|
| 11762 |
|
| 11763 |
template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6, |
| 11764 |
int k7, int k8, int k9> |
| 11765 |
class TupleFields { |
| 11766 |
public: |
| 11767 |
typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), |
| 11768 |
GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2), |
| 11769 |
GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4), |
| 11770 |
GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6), |
| 11771 |
GMOCK_FIELD_TYPE_(Tuple, k7), GMOCK_FIELD_TYPE_(Tuple, k8), |
| 11772 |
GMOCK_FIELD_TYPE_(Tuple, k9)> type; |
| 11773 |
static type GetSelectedFields(const Tuple& t) { |
| 11774 |
using ::std::tr1::get; |
| 11775 |
return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t), |
| 11776 |
get<k5>(t), get<k6>(t), get<k7>(t), get<k8>(t), get<k9>(t)); |
| 11777 |
} |
| 11778 |
}; |
| 11779 |
|
| 11780 |
|
| 11781 |
|
| 11782 |
template <class Tuple> |
| 11783 |
class TupleFields<Tuple, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1> { |
| 11784 |
public: |
| 11785 |
typedef ::std::tr1::tuple<> type; |
| 11786 |
static type GetSelectedFields(const Tuple& ) { |
| 11787 |
using ::std::tr1::get; |
| 11788 |
return type(); |
| 11789 |
} |
| 11790 |
}; |
| 11791 |
|
| 11792 |
template <class Tuple, int k0> |
| 11793 |
class TupleFields<Tuple, k0, -1, -1, -1, -1, -1, -1, -1, -1, -1> { |
| 11794 |
public: |
| 11795 |
typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0)> type; |
| 11796 |
static type GetSelectedFields(const Tuple& t) { |
| 11797 |
using ::std::tr1::get; |
| 11798 |
return type(get<k0>(t)); |
| 11799 |
} |
| 11800 |
}; |
| 11801 |
|
| 11802 |
template <class Tuple, int k0, int k1> |
| 11803 |
class TupleFields<Tuple, k0, k1, -1, -1, -1, -1, -1, -1, -1, -1> { |
| 11804 |
public: |
| 11805 |
typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), |
| 11806 |
GMOCK_FIELD_TYPE_(Tuple, k1)> type; |
| 11807 |
static type GetSelectedFields(const Tuple& t) { |
| 11808 |
using ::std::tr1::get; |
| 11809 |
return type(get<k0>(t), get<k1>(t)); |
| 11810 |
} |
| 11811 |
}; |
| 11812 |
|
| 11813 |
template <class Tuple, int k0, int k1, int k2> |
| 11814 |
class TupleFields<Tuple, k0, k1, k2, -1, -1, -1, -1, -1, -1, -1> { |
| 11815 |
public: |
| 11816 |
typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), |
| 11817 |
GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2)> type; |
| 11818 |
static type GetSelectedFields(const Tuple& t) { |
| 11819 |
using ::std::tr1::get; |
| 11820 |
return type(get<k0>(t), get<k1>(t), get<k2>(t)); |
| 11821 |
} |
| 11822 |
}; |
| 11823 |
|
| 11824 |
template <class Tuple, int k0, int k1, int k2, int k3> |
| 11825 |
class TupleFields<Tuple, k0, k1, k2, k3, -1, -1, -1, -1, -1, -1> { |
| 11826 |
public: |
| 11827 |
typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), |
| 11828 |
GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2), |
| 11829 |
GMOCK_FIELD_TYPE_(Tuple, k3)> type; |
| 11830 |
static type GetSelectedFields(const Tuple& t) { |
| 11831 |
using ::std::tr1::get; |
| 11832 |
return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t)); |
| 11833 |
} |
| 11834 |
}; |
| 11835 |
|
| 11836 |
template <class Tuple, int k0, int k1, int k2, int k3, int k4> |
| 11837 |
class TupleFields<Tuple, k0, k1, k2, k3, k4, -1, -1, -1, -1, -1> { |
| 11838 |
public: |
| 11839 |
typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), |
| 11840 |
GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2), |
| 11841 |
GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4)> type; |
| 11842 |
static type GetSelectedFields(const Tuple& t) { |
| 11843 |
using ::std::tr1::get; |
| 11844 |
return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t)); |
| 11845 |
} |
| 11846 |
}; |
| 11847 |
|
| 11848 |
template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5> |
| 11849 |
class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, -1, -1, -1, -1> { |
| 11850 |
public: |
| 11851 |
typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), |
| 11852 |
GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2), |
| 11853 |
GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4), |
| 11854 |
GMOCK_FIELD_TYPE_(Tuple, k5)> type; |
| 11855 |
static type GetSelectedFields(const Tuple& t) { |
| 11856 |
using ::std::tr1::get; |
| 11857 |
return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t), |
| 11858 |
get<k5>(t)); |
| 11859 |
} |
| 11860 |
}; |
| 11861 |
|
| 11862 |
template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6> |
| 11863 |
class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, k6, -1, -1, -1> { |
| 11864 |
public: |
| 11865 |
typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), |
| 11866 |
GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2), |
| 11867 |
GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4), |
| 11868 |
GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6)> type; |
| 11869 |
static type GetSelectedFields(const Tuple& t) { |
| 11870 |
using ::std::tr1::get; |
| 11871 |
return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t), |
| 11872 |
get<k5>(t), get<k6>(t)); |
| 11873 |
} |
| 11874 |
}; |
| 11875 |
|
| 11876 |
template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6, |
| 11877 |
int k7> |
| 11878 |
class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, k6, k7, -1, -1> { |
| 11879 |
public: |
| 11880 |
typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), |
| 11881 |
GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2), |
| 11882 |
GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4), |
| 11883 |
GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6), |
| 11884 |
GMOCK_FIELD_TYPE_(Tuple, k7)> type; |
| 11885 |
static type GetSelectedFields(const Tuple& t) { |
| 11886 |
using ::std::tr1::get; |
| 11887 |
return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t), |
| 11888 |
get<k5>(t), get<k6>(t), get<k7>(t)); |
| 11889 |
} |
| 11890 |
}; |
| 11891 |
|
| 11892 |
template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6, |
| 11893 |
int k7, int k8> |
| 11894 |
class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, k6, k7, k8, -1> { |
| 11895 |
public: |
| 11896 |
typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), |
| 11897 |
GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2), |
| 11898 |
GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4), |
| 11899 |
GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6), |
| 11900 |
GMOCK_FIELD_TYPE_(Tuple, k7), GMOCK_FIELD_TYPE_(Tuple, k8)> type; |
| 11901 |
static type GetSelectedFields(const Tuple& t) { |
| 11902 |
using ::std::tr1::get; |
| 11903 |
return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t), |
| 11904 |
get<k5>(t), get<k6>(t), get<k7>(t), get<k8>(t)); |
| 11905 |
} |
| 11906 |
}; |
| 11907 |
|
| 11908 |
#undef GMOCK_FIELD_TYPE_ |
| 11909 |
|
| 11910 |
|
| 11911 |
template <class ArgsTuple, int k0 = -1, int k1 = -1, int k2 = -1, int k3 = -1, |
| 11912 |
int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1, int k8 = -1, |
| 11913 |
int k9 = -1> |
| 11914 |
class ArgsMatcherImpl : public MatcherInterface<ArgsTuple> { |
| 11915 |
public: |
| 11916 |
|
| 11917 |
typedef GTEST_REMOVE_REFERENCE_AND_CONST_(ArgsTuple) RawArgsTuple; |
| 11918 |
typedef typename internal::TupleFields<RawArgsTuple, k0, k1, k2, k3, k4, k5, |
| 11919 |
k6, k7, k8, k9>::type SelectedArgs; |
| 11920 |
typedef Matcher<const SelectedArgs&> MonomorphicInnerMatcher; |
| 11921 |
|
| 11922 |
template <typename InnerMatcher> |
| 11923 |
explicit ArgsMatcherImpl(const InnerMatcher& inner_matcher) |
| 11924 |
: inner_matcher_(SafeMatcherCast<const SelectedArgs&>(inner_matcher)) {} |
| 11925 |
|
| 11926 |
virtual bool MatchAndExplain(ArgsTuple args, |
| 11927 |
MatchResultListener* listener) const { |
| 11928 |
const SelectedArgs& selected_args = GetSelectedArgs(args); |
| 11929 |
if (!listener->IsInterested()) |
| 11930 |
return inner_matcher_.Matches(selected_args); |
| 11931 |
|
| 11932 |
PrintIndices(listener->stream()); |
| 11933 |
*listener << "are " << PrintToString(selected_args); |
| 11934 |
|
| 11935 |
StringMatchResultListener inner_listener; |
| 11936 |
const bool match = inner_matcher_.MatchAndExplain(selected_args, |
| 11937 |
&inner_listener); |
| 11938 |
PrintIfNotEmpty(inner_listener.str(), listener->stream()); |
| 11939 |
return match; |
| 11940 |
} |
| 11941 |
|
| 11942 |
virtual void DescribeTo(::std::ostream* os) const { |
| 11943 |
*os << "are a tuple "; |
| 11944 |
PrintIndices(os); |
| 11945 |
inner_matcher_.DescribeTo(os); |
| 11946 |
} |
| 11947 |
|
| 11948 |
virtual void DescribeNegationTo(::std::ostream* os) const { |
| 11949 |
*os << "are a tuple "; |
| 11950 |
PrintIndices(os); |
| 11951 |
inner_matcher_.DescribeNegationTo(os); |
| 11952 |
} |
| 11953 |
|
| 11954 |
private: |
| 11955 |
static SelectedArgs GetSelectedArgs(ArgsTuple args) { |
| 11956 |
return TupleFields<RawArgsTuple, k0, k1, k2, k3, k4, k5, k6, k7, k8, |
| 11957 |
k9>::GetSelectedFields(args); |
| 11958 |
} |
| 11959 |
|
| 11960 |
|
| 11961 |
static void PrintIndices(::std::ostream* os) { |
| 11962 |
*os << "whose fields ("; |
| 11963 |
const int indices[10] = { k0, k1, k2, k3, k4, k5, k6, k7, k8, k9 }; |
| 11964 |
for (int i = 0; i < 10; i++) { |
| 11965 |
if (indices[i] < 0) |
| 11966 |
break; |
| 11967 |
|
| 11968 |
if (i >= 1) |
| 11969 |
*os << ", "; |
| 11970 |
|
| 11971 |
*os << "#" << indices[i]; |
| 11972 |
} |
| 11973 |
*os << ") "; |
| 11974 |
} |
| 11975 |
|
| 11976 |
const MonomorphicInnerMatcher inner_matcher_; |
| 11977 |
|
| 11978 |
GTEST_DISALLOW_ASSIGN_(ArgsMatcherImpl); |
| 11979 |
}; |
| 11980 |
|
| 11981 |
template <class InnerMatcher, int k0 = -1, int k1 = -1, int k2 = -1, |
| 11982 |
int k3 = -1, int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1, |
| 11983 |
int k8 = -1, int k9 = -1> |
| 11984 |
class ArgsMatcher { |
| 11985 |
public: |
| 11986 |
explicit ArgsMatcher(const InnerMatcher& inner_matcher) |
| 11987 |
: inner_matcher_(inner_matcher) {} |
| 11988 |
|
| 11989 |
template <typename ArgsTuple> |
| 11990 |
operator Matcher<ArgsTuple>() const { |
| 11991 |
return MakeMatcher(new ArgsMatcherImpl<ArgsTuple, k0, k1, k2, k3, k4, k5, |
| 11992 |
k6, k7, k8, k9>(inner_matcher_)); |
| 11993 |
} |
| 11994 |
|
| 11995 |
private: |
| 11996 |
const InnerMatcher inner_matcher_; |
| 11997 |
|
| 11998 |
GTEST_DISALLOW_ASSIGN_(ArgsMatcher); |
| 11999 |
}; |
| 12000 |
|
| 12001 |
|
| 12002 |
|
| 12003 |
|
| 12004 |
|
| 12005 |
|
| 12006 |
|
| 12007 |
template <typename M1> |
| 12008 |
struct AllOfResult1 { |
| 12009 |
typedef M1 type; |
| 12010 |
}; |
| 12011 |
|
| 12012 |
template <typename M1, typename M2> |
| 12013 |
struct AllOfResult2 { |
| 12014 |
typedef BothOfMatcher< |
| 12015 |
typename AllOfResult1<M1>::type, |
| 12016 |
typename AllOfResult1<M2>::type |
| 12017 |
> type; |
| 12018 |
}; |
| 12019 |
|
| 12020 |
template <typename M1, typename M2, typename M3> |
| 12021 |
struct AllOfResult3 { |
| 12022 |
typedef BothOfMatcher< |
| 12023 |
typename AllOfResult1<M1>::type, |
| 12024 |
typename AllOfResult2<M2, M3>::type |
| 12025 |
> type; |
| 12026 |
}; |
| 12027 |
|
| 12028 |
template <typename M1, typename M2, typename M3, typename M4> |
| 12029 |
struct AllOfResult4 { |
| 12030 |
typedef BothOfMatcher< |
| 12031 |
typename AllOfResult2<M1, M2>::type, |
| 12032 |
typename AllOfResult2<M3, M4>::type |
| 12033 |
> type; |
| 12034 |
}; |
| 12035 |
|
| 12036 |
template <typename M1, typename M2, typename M3, typename M4, typename M5> |
| 12037 |
struct AllOfResult5 { |
| 12038 |
typedef BothOfMatcher< |
| 12039 |
typename AllOfResult2<M1, M2>::type, |
| 12040 |
typename AllOfResult3<M3, M4, M5>::type |
| 12041 |
> type; |
| 12042 |
}; |
| 12043 |
|
| 12044 |
template <typename M1, typename M2, typename M3, typename M4, typename M5, |
| 12045 |
typename M6> |
| 12046 |
struct AllOfResult6 { |
| 12047 |
typedef BothOfMatcher< |
| 12048 |
typename AllOfResult3<M1, M2, M3>::type, |
| 12049 |
typename AllOfResult3<M4, M5, M6>::type |
| 12050 |
> type; |
| 12051 |
}; |
| 12052 |
|
| 12053 |
template <typename M1, typename M2, typename M3, typename M4, typename M5, |
| 12054 |
typename M6, typename M7> |
| 12055 |
struct AllOfResult7 { |
| 12056 |
typedef BothOfMatcher< |
| 12057 |
typename AllOfResult3<M1, M2, M3>::type, |
| 12058 |
typename AllOfResult4<M4, M5, M6, M7>::type |
| 12059 |
> type; |
| 12060 |
}; |
| 12061 |
|
| 12062 |
template <typename M1, typename M2, typename M3, typename M4, typename M5, |
| 12063 |
typename M6, typename M7, typename M8> |
| 12064 |
struct AllOfResult8 { |
| 12065 |
typedef BothOfMatcher< |
| 12066 |
typename AllOfResult4<M1, M2, M3, M4>::type, |
| 12067 |
typename AllOfResult4<M5, M6, M7, M8>::type |
| 12068 |
> type; |
| 12069 |
}; |
| 12070 |
|
| 12071 |
template <typename M1, typename M2, typename M3, typename M4, typename M5, |
| 12072 |
typename M6, typename M7, typename M8, typename M9> |
| 12073 |
struct AllOfResult9 { |
| 12074 |
typedef BothOfMatcher< |
| 12075 |
typename AllOfResult4<M1, M2, M3, M4>::type, |
| 12076 |
typename AllOfResult5<M5, M6, M7, M8, M9>::type |
| 12077 |
> type; |
| 12078 |
}; |
| 12079 |
|
| 12080 |
template <typename M1, typename M2, typename M3, typename M4, typename M5, |
| 12081 |
typename M6, typename M7, typename M8, typename M9, typename M10> |
| 12082 |
struct AllOfResult10 { |
| 12083 |
typedef BothOfMatcher< |
| 12084 |
typename AllOfResult5<M1, M2, M3, M4, M5>::type, |
| 12085 |
typename AllOfResult5<M6, M7, M8, M9, M10>::type |
| 12086 |
> type; |
| 12087 |
}; |
| 12088 |
|
| 12089 |
|
| 12090 |
|
| 12091 |
|
| 12092 |
|
| 12093 |
|
| 12094 |
|
| 12095 |
template <typename M1> |
| 12096 |
struct AnyOfResult1 { |
| 12097 |
typedef M1 type; |
| 12098 |
}; |
| 12099 |
|
| 12100 |
template <typename M1, typename M2> |
| 12101 |
struct AnyOfResult2 { |
| 12102 |
typedef EitherOfMatcher< |
| 12103 |
typename AnyOfResult1<M1>::type, |
| 12104 |
typename AnyOfResult1<M2>::type |
| 12105 |
> type; |
| 12106 |
}; |
| 12107 |
|
| 12108 |
template <typename M1, typename M2, typename M3> |
| 12109 |
struct AnyOfResult3 { |
| 12110 |
typedef EitherOfMatcher< |
| 12111 |
typename AnyOfResult1<M1>::type, |
| 12112 |
typename AnyOfResult2<M2, M3>::type |
| 12113 |
> type; |
| 12114 |
}; |
| 12115 |
|
| 12116 |
template <typename M1, typename M2, typename M3, typename M4> |
| 12117 |
struct AnyOfResult4 { |
| 12118 |
typedef EitherOfMatcher< |
| 12119 |
typename AnyOfResult2<M1, M2>::type, |
| 12120 |
typename AnyOfResult2<M3, M4>::type |
| 12121 |
> type; |
| 12122 |
}; |
| 12123 |
|
| 12124 |
template <typename M1, typename M2, typename M3, typename M4, typename M5> |
| 12125 |
struct AnyOfResult5 { |
| 12126 |
typedef EitherOfMatcher< |
| 12127 |
typename AnyOfResult2<M1, M2>::type, |
| 12128 |
typename AnyOfResult3<M3, M4, M5>::type |
| 12129 |
> type; |
| 12130 |
}; |
| 12131 |
|
| 12132 |
template <typename M1, typename M2, typename M3, typename M4, typename M5, |
| 12133 |
typename M6> |
| 12134 |
struct AnyOfResult6 { |
| 12135 |
typedef EitherOfMatcher< |
| 12136 |
typename AnyOfResult3<M1, M2, M3>::type, |
| 12137 |
typename AnyOfResult3<M4, M5, M6>::type |
| 12138 |
> type; |
| 12139 |
}; |
| 12140 |
|
| 12141 |
template <typename M1, typename M2, typename M3, typename M4, typename M5, |
| 12142 |
typename M6, typename M7> |
| 12143 |
struct AnyOfResult7 { |
| 12144 |
typedef EitherOfMatcher< |
| 12145 |
typename AnyOfResult3<M1, M2, M3>::type, |
| 12146 |
typename AnyOfResult4<M4, M5, M6, M7>::type |
| 12147 |
> type; |
| 12148 |
}; |
| 12149 |
|
| 12150 |
template <typename M1, typename M2, typename M3, typename M4, typename M5, |
| 12151 |
typename M6, typename M7, typename M8> |
| 12152 |
struct AnyOfResult8 { |
| 12153 |
typedef EitherOfMatcher< |
| 12154 |
typename AnyOfResult4<M1, M2, M3, M4>::type, |
| 12155 |
typename AnyOfResult4<M5, M6, M7, M8>::type |
| 12156 |
> type; |
| 12157 |
}; |
| 12158 |
|
| 12159 |
template <typename M1, typename M2, typename M3, typename M4, typename M5, |
| 12160 |
typename M6, typename M7, typename M8, typename M9> |
| 12161 |
struct AnyOfResult9 { |
| 12162 |
typedef EitherOfMatcher< |
| 12163 |
typename AnyOfResult4<M1, M2, M3, M4>::type, |
| 12164 |
typename AnyOfResult5<M5, M6, M7, M8, M9>::type |
| 12165 |
> type; |
| 12166 |
}; |
| 12167 |
|
| 12168 |
template <typename M1, typename M2, typename M3, typename M4, typename M5, |
| 12169 |
typename M6, typename M7, typename M8, typename M9, typename M10> |
| 12170 |
struct AnyOfResult10 { |
| 12171 |
typedef EitherOfMatcher< |
| 12172 |
typename AnyOfResult5<M1, M2, M3, M4, M5>::type, |
| 12173 |
typename AnyOfResult5<M6, M7, M8, M9, M10>::type |
| 12174 |
> type; |
| 12175 |
}; |
| 12176 |
|
| 12177 |
} |
| 12178 |
|
| 12179 |
|
| 12180 |
|
| 12181 |
|
| 12182 |
template <typename InnerMatcher> |
| 12183 |
inline internal::ArgsMatcher<InnerMatcher> |
| 12184 |
Args(const InnerMatcher& matcher) { |
| 12185 |
return internal::ArgsMatcher<InnerMatcher>(matcher); |
| 12186 |
} |
| 12187 |
|
| 12188 |
template <int k1, typename InnerMatcher> |
| 12189 |
inline internal::ArgsMatcher<InnerMatcher, k1> |
| 12190 |
Args(const InnerMatcher& matcher) { |
| 12191 |
return internal::ArgsMatcher<InnerMatcher, k1>(matcher); |
| 12192 |
} |
| 12193 |
|
| 12194 |
template <int k1, int k2, typename InnerMatcher> |
| 12195 |
inline internal::ArgsMatcher<InnerMatcher, k1, k2> |
| 12196 |
Args(const InnerMatcher& matcher) { |
| 12197 |
return internal::ArgsMatcher<InnerMatcher, k1, k2>(matcher); |
| 12198 |
} |
| 12199 |
|
| 12200 |
template <int k1, int k2, int k3, typename InnerMatcher> |
| 12201 |
inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3> |
| 12202 |
Args(const InnerMatcher& matcher) { |
| 12203 |
return internal::ArgsMatcher<InnerMatcher, k1, k2, k3>(matcher); |
| 12204 |
} |
| 12205 |
|
| 12206 |
template <int k1, int k2, int k3, int k4, typename InnerMatcher> |
| 12207 |
inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4> |
| 12208 |
Args(const InnerMatcher& matcher) { |
| 12209 |
return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4>(matcher); |
| 12210 |
} |
| 12211 |
|
| 12212 |
template <int k1, int k2, int k3, int k4, int k5, typename InnerMatcher> |
| 12213 |
inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5> |
| 12214 |
Args(const InnerMatcher& matcher) { |
| 12215 |
return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5>(matcher); |
| 12216 |
} |
| 12217 |
|
| 12218 |
template <int k1, int k2, int k3, int k4, int k5, int k6, typename InnerMatcher> |
| 12219 |
inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6> |
| 12220 |
Args(const InnerMatcher& matcher) { |
| 12221 |
return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6>(matcher); |
| 12222 |
} |
| 12223 |
|
| 12224 |
template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, |
| 12225 |
typename InnerMatcher> |
| 12226 |
inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7> |
| 12227 |
Args(const InnerMatcher& matcher) { |
| 12228 |
return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, |
| 12229 |
k7>(matcher); |
| 12230 |
} |
| 12231 |
|
| 12232 |
template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8, |
| 12233 |
typename InnerMatcher> |
| 12234 |
inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8> |
| 12235 |
Args(const InnerMatcher& matcher) { |
| 12236 |
return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, |
| 12237 |
k8>(matcher); |
| 12238 |
} |
| 12239 |
|
| 12240 |
template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8, |
| 12241 |
int k9, typename InnerMatcher> |
| 12242 |
inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8, k9> |
| 12243 |
Args(const InnerMatcher& matcher) { |
| 12244 |
return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8, |
| 12245 |
k9>(matcher); |
| 12246 |
} |
| 12247 |
|
| 12248 |
template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8, |
| 12249 |
int k9, int k10, typename InnerMatcher> |
| 12250 |
inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8, k9, |
| 12251 |
k10> |
| 12252 |
Args(const InnerMatcher& matcher) { |
| 12253 |
return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8, |
| 12254 |
k9, k10>(matcher); |
| 12255 |
} |
| 12256 |
|
| 12257 |
|
| 12258 |
|
| 12259 |
|
| 12260 |
|
| 12261 |
|
| 12262 |
|
| 12263 |
|
| 12264 |
|
| 12265 |
|
| 12266 |
|
| 12267 |
|
| 12268 |
|
| 12269 |
|
| 12270 |
|
| 12271 |
inline internal::ElementsAreMatcher< |
| 12272 |
std::tr1::tuple<> > |
| 12273 |
ElementsAre() { |
| 12274 |
typedef std::tr1::tuple<> Args; |
| 12275 |
return internal::ElementsAreMatcher<Args>(Args()); |
| 12276 |
} |
| 12277 |
|
| 12278 |
template <typename T1> |
| 12279 |
inline internal::ElementsAreMatcher< |
| 12280 |
std::tr1::tuple< |
| 12281 |
typename internal::DecayArray<T1>::type> > |
| 12282 |
ElementsAre(const T1& e1) { |
| 12283 |
typedef std::tr1::tuple< |
| 12284 |
typename internal::DecayArray<T1>::type> Args; |
| 12285 |
return internal::ElementsAreMatcher<Args>(Args(e1)); |
| 12286 |
} |
| 12287 |
|
| 12288 |
template <typename T1, typename T2> |
| 12289 |
inline internal::ElementsAreMatcher< |
| 12290 |
std::tr1::tuple< |
| 12291 |
typename internal::DecayArray<T1>::type, |
| 12292 |
typename internal::DecayArray<T2>::type> > |
| 12293 |
ElementsAre(const T1& e1, const T2& e2) { |
| 12294 |
typedef std::tr1::tuple< |
| 12295 |
typename internal::DecayArray<T1>::type, |
| 12296 |
typename internal::DecayArray<T2>::type> Args; |
| 12297 |
return internal::ElementsAreMatcher<Args>(Args(e1, e2)); |
| 12298 |
} |
| 12299 |
|
| 12300 |
template <typename T1, typename T2, typename T3> |
| 12301 |
inline internal::ElementsAreMatcher< |
| 12302 |
std::tr1::tuple< |
| 12303 |
typename internal::DecayArray<T1>::type, |
| 12304 |
typename internal::DecayArray<T2>::type, |
| 12305 |
typename internal::DecayArray<T3>::type> > |
| 12306 |
ElementsAre(const T1& e1, const T2& e2, const T3& e3) { |
| 12307 |
typedef std::tr1::tuple< |
| 12308 |
typename internal::DecayArray<T1>::type, |
| 12309 |
typename internal::DecayArray<T2>::type, |
| 12310 |
typename internal::DecayArray<T3>::type> Args; |
| 12311 |
return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3)); |
| 12312 |
} |
| 12313 |
|
| 12314 |
template <typename T1, typename T2, typename T3, typename T4> |
| 12315 |
inline internal::ElementsAreMatcher< |
| 12316 |
std::tr1::tuple< |
| 12317 |
typename internal::DecayArray<T1>::type, |
| 12318 |
typename internal::DecayArray<T2>::type, |
| 12319 |
typename internal::DecayArray<T3>::type, |
| 12320 |
typename internal::DecayArray<T4>::type> > |
| 12321 |
ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4) { |
| 12322 |
typedef std::tr1::tuple< |
| 12323 |
typename internal::DecayArray<T1>::type, |
| 12324 |
typename internal::DecayArray<T2>::type, |
| 12325 |
typename internal::DecayArray<T3>::type, |
| 12326 |
typename internal::DecayArray<T4>::type> Args; |
| 12327 |
return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4)); |
| 12328 |
} |
| 12329 |
|
| 12330 |
template <typename T1, typename T2, typename T3, typename T4, typename T5> |
| 12331 |
inline internal::ElementsAreMatcher< |
| 12332 |
std::tr1::tuple< |
| 12333 |
typename internal::DecayArray<T1>::type, |
| 12334 |
typename internal::DecayArray<T2>::type, |
| 12335 |
typename internal::DecayArray<T3>::type, |
| 12336 |
typename internal::DecayArray<T4>::type, |
| 12337 |
typename internal::DecayArray<T5>::type> > |
| 12338 |
ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, |
| 12339 |
const T5& e5) { |
| 12340 |
typedef std::tr1::tuple< |
| 12341 |
typename internal::DecayArray<T1>::type, |
| 12342 |
typename internal::DecayArray<T2>::type, |
| 12343 |
typename internal::DecayArray<T3>::type, |
| 12344 |
typename internal::DecayArray<T4>::type, |
| 12345 |
typename internal::DecayArray<T5>::type> Args; |
| 12346 |
return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5)); |
| 12347 |
} |
| 12348 |
|
| 12349 |
template <typename T1, typename T2, typename T3, typename T4, typename T5, |
| 12350 |
typename T6> |
| 12351 |
inline internal::ElementsAreMatcher< |
| 12352 |
std::tr1::tuple< |
| 12353 |
typename internal::DecayArray<T1>::type, |
| 12354 |
typename internal::DecayArray<T2>::type, |
| 12355 |
typename internal::DecayArray<T3>::type, |
| 12356 |
typename internal::DecayArray<T4>::type, |
| 12357 |
typename internal::DecayArray<T5>::type, |
| 12358 |
typename internal::DecayArray<T6>::type> > |
| 12359 |
ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, |
| 12360 |
const T5& e5, const T6& e6) { |
| 12361 |
typedef std::tr1::tuple< |
| 12362 |
typename internal::DecayArray<T1>::type, |
| 12363 |
typename internal::DecayArray<T2>::type, |
| 12364 |
typename internal::DecayArray<T3>::type, |
| 12365 |
typename internal::DecayArray<T4>::type, |
| 12366 |
typename internal::DecayArray<T5>::type, |
| 12367 |
typename internal::DecayArray<T6>::type> Args; |
| 12368 |
return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, e6)); |
| 12369 |
} |
| 12370 |
|
| 12371 |
template <typename T1, typename T2, typename T3, typename T4, typename T5, |
| 12372 |
typename T6, typename T7> |
| 12373 |
inline internal::ElementsAreMatcher< |
| 12374 |
std::tr1::tuple< |
| 12375 |
typename internal::DecayArray<T1>::type, |
| 12376 |
typename internal::DecayArray<T2>::type, |
| 12377 |
typename internal::DecayArray<T3>::type, |
| 12378 |
typename internal::DecayArray<T4>::type, |
| 12379 |
typename internal::DecayArray<T5>::type, |
| 12380 |
typename internal::DecayArray<T6>::type, |
| 12381 |
typename internal::DecayArray<T7>::type> > |
| 12382 |
ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, |
| 12383 |
const T5& e5, const T6& e6, const T7& e7) { |
| 12384 |
typedef std::tr1::tuple< |
| 12385 |
typename internal::DecayArray<T1>::type, |
| 12386 |
typename internal::DecayArray<T2>::type, |
| 12387 |
typename internal::DecayArray<T3>::type, |
| 12388 |
typename internal::DecayArray<T4>::type, |
| 12389 |
typename internal::DecayArray<T5>::type, |
| 12390 |
typename internal::DecayArray<T6>::type, |
| 12391 |
typename internal::DecayArray<T7>::type> Args; |
| 12392 |
return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, e6, e7)); |
| 12393 |
} |
| 12394 |
|
| 12395 |
template <typename T1, typename T2, typename T3, typename T4, typename T5, |
| 12396 |
typename T6, typename T7, typename T8> |
| 12397 |
inline internal::ElementsAreMatcher< |
| 12398 |
std::tr1::tuple< |
| 12399 |
typename internal::DecayArray<T1>::type, |
| 12400 |
typename internal::DecayArray<T2>::type, |
| 12401 |
typename internal::DecayArray<T3>::type, |
| 12402 |
typename internal::DecayArray<T4>::type, |
| 12403 |
typename internal::DecayArray<T5>::type, |
| 12404 |
typename internal::DecayArray<T6>::type, |
| 12405 |
typename internal::DecayArray<T7>::type, |
| 12406 |
typename internal::DecayArray<T8>::type> > |
| 12407 |
ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, |
| 12408 |
const T5& e5, const T6& e6, const T7& e7, const T8& e8) { |
| 12409 |
typedef std::tr1::tuple< |
| 12410 |
typename internal::DecayArray<T1>::type, |
| 12411 |
typename internal::DecayArray<T2>::type, |
| 12412 |
typename internal::DecayArray<T3>::type, |
| 12413 |
typename internal::DecayArray<T4>::type, |
| 12414 |
typename internal::DecayArray<T5>::type, |
| 12415 |
typename internal::DecayArray<T6>::type, |
| 12416 |
typename internal::DecayArray<T7>::type, |
| 12417 |
typename internal::DecayArray<T8>::type> Args; |
| 12418 |
return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, e6, e7, |
| 12419 |
e8)); |
| 12420 |
} |
| 12421 |
|
| 12422 |
template <typename T1, typename T2, typename T3, typename T4, typename T5, |
| 12423 |
typename T6, typename T7, typename T8, typename T9> |
| 12424 |
inline internal::ElementsAreMatcher< |
| 12425 |
std::tr1::tuple< |
| 12426 |
typename internal::DecayArray<T1>::type, |
| 12427 |
typename internal::DecayArray<T2>::type, |
| 12428 |
typename internal::DecayArray<T3>::type, |
| 12429 |
typename internal::DecayArray<T4>::type, |
| 12430 |
typename internal::DecayArray<T5>::type, |
| 12431 |
typename internal::DecayArray<T6>::type, |
| 12432 |
typename internal::DecayArray<T7>::type, |
| 12433 |
typename internal::DecayArray<T8>::type, |
| 12434 |
typename internal::DecayArray<T9>::type> > |
| 12435 |
ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, |
| 12436 |
const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9) { |
| 12437 |
typedef std::tr1::tuple< |
| 12438 |
typename internal::DecayArray<T1>::type, |
| 12439 |
typename internal::DecayArray<T2>::type, |
| 12440 |
typename internal::DecayArray<T3>::type, |
| 12441 |
typename internal::DecayArray<T4>::type, |
| 12442 |
typename internal::DecayArray<T5>::type, |
| 12443 |
typename internal::DecayArray<T6>::type, |
| 12444 |
typename internal::DecayArray<T7>::type, |
| 12445 |
typename internal::DecayArray<T8>::type, |
| 12446 |
typename internal::DecayArray<T9>::type> Args; |
| 12447 |
return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, e6, e7, |
| 12448 |
e8, e9)); |
| 12449 |
} |
| 12450 |
|
| 12451 |
template <typename T1, typename T2, typename T3, typename T4, typename T5, |
| 12452 |
typename T6, typename T7, typename T8, typename T9, typename T10> |
| 12453 |
inline internal::ElementsAreMatcher< |
| 12454 |
std::tr1::tuple< |
| 12455 |
typename internal::DecayArray<T1>::type, |
| 12456 |
typename internal::DecayArray<T2>::type, |
| 12457 |
typename internal::DecayArray<T3>::type, |
| 12458 |
typename internal::DecayArray<T4>::type, |
| 12459 |
typename internal::DecayArray<T5>::type, |
| 12460 |
typename internal::DecayArray<T6>::type, |
| 12461 |
typename internal::DecayArray<T7>::type, |
| 12462 |
typename internal::DecayArray<T8>::type, |
| 12463 |
typename internal::DecayArray<T9>::type, |
| 12464 |
typename internal::DecayArray<T10>::type> > |
| 12465 |
ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, |
| 12466 |
const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9, |
| 12467 |
const T10& e10) { |
| 12468 |
typedef std::tr1::tuple< |
| 12469 |
typename internal::DecayArray<T1>::type, |
| 12470 |
typename internal::DecayArray<T2>::type, |
| 12471 |
typename internal::DecayArray<T3>::type, |
| 12472 |
typename internal::DecayArray<T4>::type, |
| 12473 |
typename internal::DecayArray<T5>::type, |
| 12474 |
typename internal::DecayArray<T6>::type, |
| 12475 |
typename internal::DecayArray<T7>::type, |
| 12476 |
typename internal::DecayArray<T8>::type, |
| 12477 |
typename internal::DecayArray<T9>::type, |
| 12478 |
typename internal::DecayArray<T10>::type> Args; |
| 12479 |
return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, e6, e7, |
| 12480 |
e8, e9, e10)); |
| 12481 |
} |
| 12482 |
|
| 12483 |
|
| 12484 |
|
| 12485 |
|
| 12486 |
inline internal::UnorderedElementsAreMatcher< |
| 12487 |
std::tr1::tuple<> > |
| 12488 |
UnorderedElementsAre() { |
| 12489 |
typedef std::tr1::tuple<> Args; |
| 12490 |
return internal::UnorderedElementsAreMatcher<Args>(Args()); |
| 12491 |
} |
| 12492 |
|
| 12493 |
template <typename T1> |
| 12494 |
inline internal::UnorderedElementsAreMatcher< |
| 12495 |
std::tr1::tuple< |
| 12496 |
typename internal::DecayArray<T1>::type> > |
| 12497 |
UnorderedElementsAre(const T1& e1) { |
| 12498 |
typedef std::tr1::tuple< |
| 12499 |
typename internal::DecayArray<T1>::type> Args; |
| 12500 |
return internal::UnorderedElementsAreMatcher<Args>(Args(e1)); |
| 12501 |
} |
| 12502 |
|
| 12503 |
template <typename T1, typename T2> |
| 12504 |
inline internal::UnorderedElementsAreMatcher< |
| 12505 |
std::tr1::tuple< |
| 12506 |
typename internal::DecayArray<T1>::type, |
| 12507 |
typename internal::DecayArray<T2>::type> > |
| 12508 |
UnorderedElementsAre(const T1& e1, const T2& e2) { |
| 12509 |
typedef std::tr1::tuple< |
| 12510 |
typename internal::DecayArray<T1>::type, |
| 12511 |
typename internal::DecayArray<T2>::type> Args; |
| 12512 |
return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2)); |
| 12513 |
} |
| 12514 |
|
| 12515 |
template <typename T1, typename T2, typename T3> |
| 12516 |
inline internal::UnorderedElementsAreMatcher< |
| 12517 |
std::tr1::tuple< |
| 12518 |
typename internal::DecayArray<T1>::type, |
| 12519 |
typename internal::DecayArray<T2>::type, |
| 12520 |
typename internal::DecayArray<T3>::type> > |
| 12521 |
UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3) { |
| 12522 |
typedef std::tr1::tuple< |
| 12523 |
typename internal::DecayArray<T1>::type, |
| 12524 |
typename internal::DecayArray<T2>::type, |
| 12525 |
typename internal::DecayArray<T3>::type> Args; |
| 12526 |
return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3)); |
| 12527 |
} |
| 12528 |
|
| 12529 |
template <typename T1, typename T2, typename T3, typename T4> |
| 12530 |
inline internal::UnorderedElementsAreMatcher< |
| 12531 |
std::tr1::tuple< |
| 12532 |
typename internal::DecayArray<T1>::type, |
| 12533 |
typename internal::DecayArray<T2>::type, |
| 12534 |
typename internal::DecayArray<T3>::type, |
| 12535 |
typename internal::DecayArray<T4>::type> > |
| 12536 |
UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4) { |
| 12537 |
typedef std::tr1::tuple< |
| 12538 |
typename internal::DecayArray<T1>::type, |
| 12539 |
typename internal::DecayArray<T2>::type, |
| 12540 |
typename internal::DecayArray<T3>::type, |
| 12541 |
typename internal::DecayArray<T4>::type> Args; |
| 12542 |
return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4)); |
| 12543 |
} |
| 12544 |
|
| 12545 |
template <typename T1, typename T2, typename T3, typename T4, typename T5> |
| 12546 |
inline internal::UnorderedElementsAreMatcher< |
| 12547 |
std::tr1::tuple< |
| 12548 |
typename internal::DecayArray<T1>::type, |
| 12549 |
typename internal::DecayArray<T2>::type, |
| 12550 |
typename internal::DecayArray<T3>::type, |
| 12551 |
typename internal::DecayArray<T4>::type, |
| 12552 |
typename internal::DecayArray<T5>::type> > |
| 12553 |
UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, |
| 12554 |
const T5& e5) { |
| 12555 |
typedef std::tr1::tuple< |
| 12556 |
typename internal::DecayArray<T1>::type, |
| 12557 |
typename internal::DecayArray<T2>::type, |
| 12558 |
typename internal::DecayArray<T3>::type, |
| 12559 |
typename internal::DecayArray<T4>::type, |
| 12560 |
typename internal::DecayArray<T5>::type> Args; |
| 12561 |
return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5)); |
| 12562 |
} |
| 12563 |
|
| 12564 |
template <typename T1, typename T2, typename T3, typename T4, typename T5, |
| 12565 |
typename T6> |
| 12566 |
inline internal::UnorderedElementsAreMatcher< |
| 12567 |
std::tr1::tuple< |
| 12568 |
typename internal::DecayArray<T1>::type, |
| 12569 |
typename internal::DecayArray<T2>::type, |
| 12570 |
typename internal::DecayArray<T3>::type, |
| 12571 |
typename internal::DecayArray<T4>::type, |
| 12572 |
typename internal::DecayArray<T5>::type, |
| 12573 |
typename internal::DecayArray<T6>::type> > |
| 12574 |
UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, |
| 12575 |
const T5& e5, const T6& e6) { |
| 12576 |
typedef std::tr1::tuple< |
| 12577 |
typename internal::DecayArray<T1>::type, |
| 12578 |
typename internal::DecayArray<T2>::type, |
| 12579 |
typename internal::DecayArray<T3>::type, |
| 12580 |
typename internal::DecayArray<T4>::type, |
| 12581 |
typename internal::DecayArray<T5>::type, |
| 12582 |
typename internal::DecayArray<T6>::type> Args; |
| 12583 |
return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, |
| 12584 |
e6)); |
| 12585 |
} |
| 12586 |
|
| 12587 |
template <typename T1, typename T2, typename T3, typename T4, typename T5, |
| 12588 |
typename T6, typename T7> |
| 12589 |
inline internal::UnorderedElementsAreMatcher< |
| 12590 |
std::tr1::tuple< |
| 12591 |
typename internal::DecayArray<T1>::type, |
| 12592 |
typename internal::DecayArray<T2>::type, |
| 12593 |
typename internal::DecayArray<T3>::type, |
| 12594 |
typename internal::DecayArray<T4>::type, |
| 12595 |
typename internal::DecayArray<T5>::type, |
| 12596 |
typename internal::DecayArray<T6>::type, |
| 12597 |
typename internal::DecayArray<T7>::type> > |
| 12598 |
UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, |
| 12599 |
const T5& e5, const T6& e6, const T7& e7) { |
| 12600 |
typedef std::tr1::tuple< |
| 12601 |
typename internal::DecayArray<T1>::type, |
| 12602 |
typename internal::DecayArray<T2>::type, |
| 12603 |
typename internal::DecayArray<T3>::type, |
| 12604 |
typename internal::DecayArray<T4>::type, |
| 12605 |
typename internal::DecayArray<T5>::type, |
| 12606 |
typename internal::DecayArray<T6>::type, |
| 12607 |
typename internal::DecayArray<T7>::type> Args; |
| 12608 |
return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, |
| 12609 |
e6, e7)); |
| 12610 |
} |
| 12611 |
|
| 12612 |
template <typename T1, typename T2, typename T3, typename T4, typename T5, |
| 12613 |
typename T6, typename T7, typename T8> |
| 12614 |
inline internal::UnorderedElementsAreMatcher< |
| 12615 |
std::tr1::tuple< |
| 12616 |
typename internal::DecayArray<T1>::type, |
| 12617 |
typename internal::DecayArray<T2>::type, |
| 12618 |
typename internal::DecayArray<T3>::type, |
| 12619 |
typename internal::DecayArray<T4>::type, |
| 12620 |
typename internal::DecayArray<T5>::type, |
| 12621 |
typename internal::DecayArray<T6>::type, |
| 12622 |
typename internal::DecayArray<T7>::type, |
| 12623 |
typename internal::DecayArray<T8>::type> > |
| 12624 |
UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, |
| 12625 |
const T5& e5, const T6& e6, const T7& e7, const T8& e8) { |
| 12626 |
typedef std::tr1::tuple< |
| 12627 |
typename internal::DecayArray<T1>::type, |
| 12628 |
typename internal::DecayArray<T2>::type, |
| 12629 |
typename internal::DecayArray<T3>::type, |
| 12630 |
typename internal::DecayArray<T4>::type, |
| 12631 |
typename internal::DecayArray<T5>::type, |
| 12632 |
typename internal::DecayArray<T6>::type, |
| 12633 |
typename internal::DecayArray<T7>::type, |
| 12634 |
typename internal::DecayArray<T8>::type> Args; |
| 12635 |
return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, |
| 12636 |
e6, e7, e8)); |
| 12637 |
} |
| 12638 |
|
| 12639 |
template <typename T1, typename T2, typename T3, typename T4, typename T5, |
| 12640 |
typename T6, typename T7, typename T8, typename T9> |
| 12641 |
inline internal::UnorderedElementsAreMatcher< |
| 12642 |
std::tr1::tuple< |
| 12643 |
typename internal::DecayArray<T1>::type, |
| 12644 |
typename internal::DecayArray<T2>::type, |
| 12645 |
typename internal::DecayArray<T3>::type, |
| 12646 |
typename internal::DecayArray<T4>::type, |
| 12647 |
typename internal::DecayArray<T5>::type, |
| 12648 |
typename internal::DecayArray<T6>::type, |
| 12649 |
typename internal::DecayArray<T7>::type, |
| 12650 |
typename internal::DecayArray<T8>::type, |
| 12651 |
typename internal::DecayArray<T9>::type> > |
| 12652 |
UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, |
| 12653 |
const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9) { |
| 12654 |
typedef std::tr1::tuple< |
| 12655 |
typename internal::DecayArray<T1>::type, |
| 12656 |
typename internal::DecayArray<T2>::type, |
| 12657 |
typename internal::DecayArray<T3>::type, |
| 12658 |
typename internal::DecayArray<T4>::type, |
| 12659 |
typename internal::DecayArray<T5>::type, |
| 12660 |
typename internal::DecayArray<T6>::type, |
| 12661 |
typename internal::DecayArray<T7>::type, |
| 12662 |
typename internal::DecayArray<T8>::type, |
| 12663 |
typename internal::DecayArray<T9>::type> Args; |
| 12664 |
return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, |
| 12665 |
e6, e7, e8, e9)); |
| 12666 |
} |
| 12667 |
|
| 12668 |
template <typename T1, typename T2, typename T3, typename T4, typename T5, |
| 12669 |
typename T6, typename T7, typename T8, typename T9, typename T10> |
| 12670 |
inline internal::UnorderedElementsAreMatcher< |
| 12671 |
std::tr1::tuple< |
| 12672 |
typename internal::DecayArray<T1>::type, |
| 12673 |
typename internal::DecayArray<T2>::type, |
| 12674 |
typename internal::DecayArray<T3>::type, |
| 12675 |
typename internal::DecayArray<T4>::type, |
| 12676 |
typename internal::DecayArray<T5>::type, |
| 12677 |
typename internal::DecayArray<T6>::type, |
| 12678 |
typename internal::DecayArray<T7>::type, |
| 12679 |
typename internal::DecayArray<T8>::type, |
| 12680 |
typename internal::DecayArray<T9>::type, |
| 12681 |
typename internal::DecayArray<T10>::type> > |
| 12682 |
UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, |
| 12683 |
const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9, |
| 12684 |
const T10& e10) { |
| 12685 |
typedef std::tr1::tuple< |
| 12686 |
typename internal::DecayArray<T1>::type, |
| 12687 |
typename internal::DecayArray<T2>::type, |
| 12688 |
typename internal::DecayArray<T3>::type, |
| 12689 |
typename internal::DecayArray<T4>::type, |
| 12690 |
typename internal::DecayArray<T5>::type, |
| 12691 |
typename internal::DecayArray<T6>::type, |
| 12692 |
typename internal::DecayArray<T7>::type, |
| 12693 |
typename internal::DecayArray<T8>::type, |
| 12694 |
typename internal::DecayArray<T9>::type, |
| 12695 |
typename internal::DecayArray<T10>::type> Args; |
| 12696 |
return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, |
| 12697 |
e6, e7, e8, e9, e10)); |
| 12698 |
} |
| 12699 |
|
| 12700 |
|
| 12701 |
|
| 12702 |
|
| 12703 |
template <typename M1, typename M2> |
| 12704 |
inline typename internal::AllOfResult2<M1, M2>::type |
| 12705 |
AllOf(M1 m1, M2 m2) { |
| 12706 |
return typename internal::AllOfResult2<M1, M2>::type( |
| 12707 |
m1, |
| 12708 |
m2); |
| 12709 |
} |
| 12710 |
|
| 12711 |
template <typename M1, typename M2, typename M3> |
| 12712 |
inline typename internal::AllOfResult3<M1, M2, M3>::type |
| 12713 |
AllOf(M1 m1, M2 m2, M3 m3) { |
| 12714 |
return typename internal::AllOfResult3<M1, M2, M3>::type( |
| 12715 |
m1, |
| 12716 |
::testing::AllOf(m2, m3)); |
| 12717 |
} |
| 12718 |
|
| 12719 |
template <typename M1, typename M2, typename M3, typename M4> |
| 12720 |
inline typename internal::AllOfResult4<M1, M2, M3, M4>::type |
| 12721 |
AllOf(M1 m1, M2 m2, M3 m3, M4 m4) { |
| 12722 |
return typename internal::AllOfResult4<M1, M2, M3, M4>::type( |
| 12723 |
::testing::AllOf(m1, m2), |
| 12724 |
::testing::AllOf(m3, m4)); |
| 12725 |
} |
| 12726 |
|
| 12727 |
template <typename M1, typename M2, typename M3, typename M4, typename M5> |
| 12728 |
inline typename internal::AllOfResult5<M1, M2, M3, M4, M5>::type |
| 12729 |
AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5) { |
| 12730 |
return typename internal::AllOfResult5<M1, M2, M3, M4, M5>::type( |
| 12731 |
::testing::AllOf(m1, m2), |
| 12732 |
::testing::AllOf(m3, m4, m5)); |
| 12733 |
} |
| 12734 |
|
| 12735 |
template <typename M1, typename M2, typename M3, typename M4, typename M5, |
| 12736 |
typename M6> |
| 12737 |
inline typename internal::AllOfResult6<M1, M2, M3, M4, M5, M6>::type |
| 12738 |
AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6) { |
| 12739 |
return typename internal::AllOfResult6<M1, M2, M3, M4, M5, M6>::type( |
| 12740 |
::testing::AllOf(m1, m2, m3), |
| 12741 |
::testing::AllOf(m4, m5, m6)); |
| 12742 |
} |
| 12743 |
|
| 12744 |
template <typename M1, typename M2, typename M3, typename M4, typename M5, |
| 12745 |
typename M6, typename M7> |
| 12746 |
inline typename internal::AllOfResult7<M1, M2, M3, M4, M5, M6, M7>::type |
| 12747 |
AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7) { |
| 12748 |
return typename internal::AllOfResult7<M1, M2, M3, M4, M5, M6, M7>::type( |
| 12749 |
::testing::AllOf(m1, m2, m3), |
| 12750 |
::testing::AllOf(m4, m5, m6, m7)); |
| 12751 |
} |
| 12752 |
|
| 12753 |
template <typename M1, typename M2, typename M3, typename M4, typename M5, |
| 12754 |
typename M6, typename M7, typename M8> |
| 12755 |
inline typename internal::AllOfResult8<M1, M2, M3, M4, M5, M6, M7, M8>::type |
| 12756 |
AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8) { |
| 12757 |
return typename internal::AllOfResult8<M1, M2, M3, M4, M5, M6, M7, M8>::type( |
| 12758 |
::testing::AllOf(m1, m2, m3, m4), |
| 12759 |
::testing::AllOf(m5, m6, m7, m8)); |
| 12760 |
} |
| 12761 |
|
| 12762 |
template <typename M1, typename M2, typename M3, typename M4, typename M5, |
| 12763 |
typename M6, typename M7, typename M8, typename M9> |
| 12764 |
inline typename internal::AllOfResult9<M1, M2, M3, M4, M5, M6, M7, M8, M9>::type |
| 12765 |
AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9) { |
| 12766 |
return typename internal::AllOfResult9<M1, M2, M3, M4, M5, M6, M7, M8, |
| 12767 |
M9>::type( |
| 12768 |
::testing::AllOf(m1, m2, m3, m4), |
| 12769 |
::testing::AllOf(m5, m6, m7, m8, m9)); |
| 12770 |
} |
| 12771 |
|
| 12772 |
template <typename M1, typename M2, typename M3, typename M4, typename M5, |
| 12773 |
typename M6, typename M7, typename M8, typename M9, typename M10> |
| 12774 |
inline typename internal::AllOfResult10<M1, M2, M3, M4, M5, M6, M7, M8, M9, |
| 12775 |
M10>::type |
| 12776 |
AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) { |
| 12777 |
return typename internal::AllOfResult10<M1, M2, M3, M4, M5, M6, M7, M8, M9, |
| 12778 |
M10>::type( |
| 12779 |
::testing::AllOf(m1, m2, m3, m4, m5), |
| 12780 |
::testing::AllOf(m6, m7, m8, m9, m10)); |
| 12781 |
} |
| 12782 |
|
| 12783 |
|
| 12784 |
|
| 12785 |
|
| 12786 |
template <typename M1, typename M2> |
| 12787 |
inline typename internal::AnyOfResult2<M1, M2>::type |
| 12788 |
AnyOf(M1 m1, M2 m2) { |
| 12789 |
return typename internal::AnyOfResult2<M1, M2>::type( |
| 12790 |
m1, |
| 12791 |
m2); |
| 12792 |
} |
| 12793 |
|
| 12794 |
template <typename M1, typename M2, typename M3> |
| 12795 |
inline typename internal::AnyOfResult3<M1, M2, M3>::type |
| 12796 |
AnyOf(M1 m1, M2 m2, M3 m3) { |
| 12797 |
return typename internal::AnyOfResult3<M1, M2, M3>::type( |
| 12798 |
m1, |
| 12799 |
::testing::AnyOf(m2, m3)); |
| 12800 |
} |
| 12801 |
|
| 12802 |
template <typename M1, typename M2, typename M3, typename M4> |
| 12803 |
inline typename internal::AnyOfResult4<M1, M2, M3, M4>::type |
| 12804 |
AnyOf(M1 m1, M2 m2, M3 m3, M4 m4) { |
| 12805 |
return typename internal::AnyOfResult4<M1, M2, M3, M4>::type( |
| 12806 |
::testing::AnyOf(m1, m2), |
| 12807 |
::testing::AnyOf(m3, m4)); |
| 12808 |
} |
| 12809 |
|
| 12810 |
template <typename M1, typename M2, typename M3, typename M4, typename M5> |
| 12811 |
inline typename internal::AnyOfResult5<M1, M2, M3, M4, M5>::type |
| 12812 |
AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5) { |
| 12813 |
return typename internal::AnyOfResult5<M1, M2, M3, M4, M5>::type( |
| 12814 |
::testing::AnyOf(m1, m2), |
| 12815 |
::testing::AnyOf(m3, m4, m5)); |
| 12816 |
} |
| 12817 |
|
| 12818 |
template <typename M1, typename M2, typename M3, typename M4, typename M5, |
| 12819 |
typename M6> |
| 12820 |
inline typename internal::AnyOfResult6<M1, M2, M3, M4, M5, M6>::type |
| 12821 |
AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6) { |
| 12822 |
return typename internal::AnyOfResult6<M1, M2, M3, M4, M5, M6>::type( |
| 12823 |
::testing::AnyOf(m1, m2, m3), |
| 12824 |
::testing::AnyOf(m4, m5, m6)); |
| 12825 |
} |
| 12826 |
|
| 12827 |
template <typename M1, typename M2, typename M3, typename M4, typename M5, |
| 12828 |
typename M6, typename M7> |
| 12829 |
inline typename internal::AnyOfResult7<M1, M2, M3, M4, M5, M6, M7>::type |
| 12830 |
AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7) { |
| 12831 |
return typename internal::AnyOfResult7<M1, M2, M3, M4, M5, M6, M7>::type( |
| 12832 |
::testing::AnyOf(m1, m2, m3), |
| 12833 |
::testing::AnyOf(m4, m5, m6, m7)); |
| 12834 |
} |
| 12835 |
|
| 12836 |
template <typename M1, typename M2, typename M3, typename M4, typename M5, |
| 12837 |
typename M6, typename M7, typename M8> |
| 12838 |
inline typename internal::AnyOfResult8<M1, M2, M3, M4, M5, M6, M7, M8>::type |
| 12839 |
AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8) { |
| 12840 |
return typename internal::AnyOfResult8<M1, M2, M3, M4, M5, M6, M7, M8>::type( |
| 12841 |
::testing::AnyOf(m1, m2, m3, m4), |
| 12842 |
::testing::AnyOf(m5, m6, m7, m8)); |
| 12843 |
} |
| 12844 |
|
| 12845 |
template <typename M1, typename M2, typename M3, typename M4, typename M5, |
| 12846 |
typename M6, typename M7, typename M8, typename M9> |
| 12847 |
inline typename internal::AnyOfResult9<M1, M2, M3, M4, M5, M6, M7, M8, M9>::type |
| 12848 |
AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9) { |
| 12849 |
return typename internal::AnyOfResult9<M1, M2, M3, M4, M5, M6, M7, M8, |
| 12850 |
M9>::type( |
| 12851 |
::testing::AnyOf(m1, m2, m3, m4), |
| 12852 |
::testing::AnyOf(m5, m6, m7, m8, m9)); |
| 12853 |
} |
| 12854 |
|
| 12855 |
template <typename M1, typename M2, typename M3, typename M4, typename M5, |
| 12856 |
typename M6, typename M7, typename M8, typename M9, typename M10> |
| 12857 |
inline typename internal::AnyOfResult10<M1, M2, M3, M4, M5, M6, M7, M8, M9, |
| 12858 |
M10>::type |
| 12859 |
AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) { |
| 12860 |
return typename internal::AnyOfResult10<M1, M2, M3, M4, M5, M6, M7, M8, M9, |
| 12861 |
M10>::type( |
| 12862 |
::testing::AnyOf(m1, m2, m3, m4, m5), |
| 12863 |
::testing::AnyOf(m6, m7, m8, m9, m10)); |
| 12864 |
} |
| 12865 |
|
| 12866 |
} |
| 12867 |
|
| 12868 |
|
| 12869 |
|
| 12870 |
|
| 12871 |
|
| 12872 |
|
| 12873 |
|
| 12874 |
|
| 12875 |
|
| 12876 |
|
| 12877 |
|
| 12878 |
|
| 12879 |
|
| 12880 |
|
| 12881 |
|
| 12882 |
|
| 12883 |
|
| 12884 |
|
| 12885 |
|
| 12886 |
|
| 12887 |
|
| 12888 |
|
| 12889 |
|
| 12890 |
|
| 12891 |
|
| 12892 |
|
| 12893 |
|
| 12894 |
|
| 12895 |
|
| 12896 |
|
| 12897 |
|
| 12898 |
|
| 12899 |
|
| 12900 |
|
| 12901 |
|
| 12902 |
|
| 12903 |
|
| 12904 |
|
| 12905 |
|
| 12906 |
|
| 12907 |
|
| 12908 |
|
| 12909 |
|
| 12910 |
|
| 12911 |
|
| 12912 |
|
| 12913 |
|
| 12914 |
|
| 12915 |
|
| 12916 |
|
| 12917 |
|
| 12918 |
|
| 12919 |
|
| 12920 |
|
| 12921 |
|
| 12922 |
|
| 12923 |
|
| 12924 |
|
| 12925 |
|
| 12926 |
|
| 12927 |
|
| 12928 |
|
| 12929 |
|
| 12930 |
|
| 12931 |
|
| 12932 |
|
| 12933 |
|
| 12934 |
|
| 12935 |
|
| 12936 |
|
| 12937 |
|
| 12938 |
|
| 12939 |
|
| 12940 |
|
| 12941 |
|
| 12942 |
|
| 12943 |
|
| 12944 |
|
| 12945 |
|
| 12946 |
|
| 12947 |
|
| 12948 |
|
| 12949 |
|
| 12950 |
|
| 12951 |
|
| 12952 |
|
| 12953 |
|
| 12954 |
|
| 12955 |
|
| 12956 |
|
| 12957 |
|
| 12958 |
|
| 12959 |
|
| 12960 |
|
| 12961 |
|
| 12962 |
|
| 12963 |
|
| 12964 |
|
| 12965 |
|
| 12966 |
|
| 12967 |
|
| 12968 |
|
| 12969 |
|
| 12970 |
|
| 12971 |
|
| 12972 |
|
| 12973 |
|
| 12974 |
|
| 12975 |
|
| 12976 |
|
| 12977 |
|
| 12978 |
|
| 12979 |
|
| 12980 |
|
| 12981 |
|
| 12982 |
|
| 12983 |
|
| 12984 |
|
| 12985 |
|
| 12986 |
|
| 12987 |
|
| 12988 |
|
| 12989 |
|
| 12990 |
|
| 12991 |
|
| 12992 |
|
| 12993 |
|
| 12994 |
|
| 12995 |
|
| 12996 |
|
| 12997 |
|
| 12998 |
|
| 12999 |
|
| 13000 |
|
| 13001 |
|
| 13002 |
|
| 13003 |
|
| 13004 |
|
| 13005 |
|
| 13006 |
|
| 13007 |
|
| 13008 |
|
| 13009 |
|
| 13010 |
|
| 13011 |
|
| 13012 |
|
| 13013 |
|
| 13014 |
|
| 13015 |
|
| 13016 |
|
| 13017 |
|
| 13018 |
|
| 13019 |
|
| 13020 |
|
| 13021 |
|
| 13022 |
|
| 13023 |
|
| 13024 |
|
| 13025 |
|
| 13026 |
|
| 13027 |
|
| 13028 |
|
| 13029 |
|
| 13030 |
|
| 13031 |
|
| 13032 |
|
| 13033 |
|
| 13034 |
|
| 13035 |
|
| 13036 |
|
| 13037 |
|
| 13038 |
|
| 13039 |
|
| 13040 |
|
| 13041 |
|
| 13042 |
|
| 13043 |
|
| 13044 |
|
| 13045 |
|
| 13046 |
|
| 13047 |
|
| 13048 |
|
| 13049 |
|
| 13050 |
|
| 13051 |
|
| 13052 |
|
| 13053 |
|
| 13054 |
|
| 13055 |
|
| 13056 |
|
| 13057 |
|
| 13058 |
|
| 13059 |
|
| 13060 |
|
| 13061 |
|
| 13062 |
|
| 13063 |
|
| 13064 |
|
| 13065 |
|
| 13066 |
|
| 13067 |
|
| 13068 |
|
| 13069 |
|
| 13070 |
|
| 13071 |
|
| 13072 |
|
| 13073 |
|
| 13074 |
|
| 13075 |
|
| 13076 |
|
| 13077 |
|
| 13078 |
|
| 13079 |
|
| 13080 |
|
| 13081 |
|
| 13082 |
|
| 13083 |
|
| 13084 |
#define MATCHER(name, description)\ |
| 13085 |
class name##Matcher {\ |
| 13086 |
public:\ |
| 13087 |
template <typename arg_type>\ |
| 13088 |
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ |
| 13089 |
public:\ |
| 13090 |
gmock_Impl()\ |
| 13091 |
{}\ |
| 13092 |
virtual bool MatchAndExplain(\ |
| 13093 |
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ |
| 13094 |
virtual void DescribeTo(::std::ostream* gmock_os) const {\ |
| 13095 |
*gmock_os << FormatDescription(false);\ |
| 13096 |
}\ |
| 13097 |
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ |
| 13098 |
*gmock_os << FormatDescription(true);\ |
| 13099 |
}\ |
| 13100 |
private:\ |
| 13101 |
::testing::internal::string FormatDescription(bool negation) const {\ |
| 13102 |
const ::testing::internal::string gmock_description = (description);\ |
| 13103 |
if (!gmock_description.empty())\ |
| 13104 |
return gmock_description;\ |
| 13105 |
return ::testing::internal::FormatMatcherDescription(\ |
| 13106 |
negation, #name, \ |
| 13107 |
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ |
| 13108 |
::std::tr1::tuple<>()));\ |
| 13109 |
}\ |
| 13110 |
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
| 13111 |
};\ |
| 13112 |
template <typename arg_type>\ |
| 13113 |
operator ::testing::Matcher<arg_type>() const {\ |
| 13114 |
return ::testing::Matcher<arg_type>(\ |
| 13115 |
new gmock_Impl<arg_type>());\ |
| 13116 |
}\ |
| 13117 |
name##Matcher() {\ |
| 13118 |
}\ |
| 13119 |
private:\ |
| 13120 |
GTEST_DISALLOW_ASSIGN_(name##Matcher);\ |
| 13121 |
};\ |
| 13122 |
inline name##Matcher name() {\ |
| 13123 |
return name##Matcher();\ |
| 13124 |
}\ |
| 13125 |
template <typename arg_type>\ |
| 13126 |
bool name##Matcher::gmock_Impl<arg_type>::MatchAndExplain(\ |
| 13127 |
arg_type arg, \ |
| 13128 |
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ |
| 13129 |
const |
| 13130 |
|
| 13131 |
#define MATCHER_P(name, p0, description)\ |
| 13132 |
template <typename p0##_type>\ |
| 13133 |
class name##MatcherP {\ |
| 13134 |
public:\ |
| 13135 |
template <typename arg_type>\ |
| 13136 |
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ |
| 13137 |
public:\ |
| 13138 |
explicit gmock_Impl(p0##_type gmock_p0)\ |
| 13139 |
: p0(gmock_p0) {}\ |
| 13140 |
virtual bool MatchAndExplain(\ |
| 13141 |
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ |
| 13142 |
virtual void DescribeTo(::std::ostream* gmock_os) const {\ |
| 13143 |
*gmock_os << FormatDescription(false);\ |
| 13144 |
}\ |
| 13145 |
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ |
| 13146 |
*gmock_os << FormatDescription(true);\ |
| 13147 |
}\ |
| 13148 |
p0##_type p0;\ |
| 13149 |
private:\ |
| 13150 |
::testing::internal::string FormatDescription(bool negation) const {\ |
| 13151 |
const ::testing::internal::string gmock_description = (description);\ |
| 13152 |
if (!gmock_description.empty())\ |
| 13153 |
return gmock_description;\ |
| 13154 |
return ::testing::internal::FormatMatcherDescription(\ |
| 13155 |
negation, #name, \ |
| 13156 |
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ |
| 13157 |
::std::tr1::tuple<p0##_type>(p0)));\ |
| 13158 |
}\ |
| 13159 |
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
| 13160 |
};\ |
| 13161 |
template <typename arg_type>\ |
| 13162 |
operator ::testing::Matcher<arg_type>() const {\ |
| 13163 |
return ::testing::Matcher<arg_type>(\ |
| 13164 |
new gmock_Impl<arg_type>(p0));\ |
| 13165 |
}\ |
| 13166 |
name##MatcherP(p0##_type gmock_p0) : p0(gmock_p0) {\ |
| 13167 |
}\ |
| 13168 |
p0##_type p0;\ |
| 13169 |
private:\ |
| 13170 |
GTEST_DISALLOW_ASSIGN_(name##MatcherP);\ |
| 13171 |
};\ |
| 13172 |
template <typename p0##_type>\ |
| 13173 |
inline name##MatcherP<p0##_type> name(p0##_type p0) {\ |
| 13174 |
return name##MatcherP<p0##_type>(p0);\ |
| 13175 |
}\ |
| 13176 |
template <typename p0##_type>\ |
| 13177 |
template <typename arg_type>\ |
| 13178 |
bool name##MatcherP<p0##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ |
| 13179 |
arg_type arg, \ |
| 13180 |
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ |
| 13181 |
const |
| 13182 |
|
| 13183 |
#define MATCHER_P2(name, p0, p1, description)\ |
| 13184 |
template <typename p0##_type, typename p1##_type>\ |
| 13185 |
class name##MatcherP2 {\ |
| 13186 |
public:\ |
| 13187 |
template <typename arg_type>\ |
| 13188 |
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ |
| 13189 |
public:\ |
| 13190 |
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1)\ |
| 13191 |
: p0(gmock_p0), p1(gmock_p1) {}\ |
| 13192 |
virtual bool MatchAndExplain(\ |
| 13193 |
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ |
| 13194 |
virtual void DescribeTo(::std::ostream* gmock_os) const {\ |
| 13195 |
*gmock_os << FormatDescription(false);\ |
| 13196 |
}\ |
| 13197 |
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ |
| 13198 |
*gmock_os << FormatDescription(true);\ |
| 13199 |
}\ |
| 13200 |
p0##_type p0;\ |
| 13201 |
p1##_type p1;\ |
| 13202 |
private:\ |
| 13203 |
::testing::internal::string FormatDescription(bool negation) const {\ |
| 13204 |
const ::testing::internal::string gmock_description = (description);\ |
| 13205 |
if (!gmock_description.empty())\ |
| 13206 |
return gmock_description;\ |
| 13207 |
return ::testing::internal::FormatMatcherDescription(\ |
| 13208 |
negation, #name, \ |
| 13209 |
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ |
| 13210 |
::std::tr1::tuple<p0##_type, p1##_type>(p0, p1)));\ |
| 13211 |
}\ |
| 13212 |
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
| 13213 |
};\ |
| 13214 |
template <typename arg_type>\ |
| 13215 |
operator ::testing::Matcher<arg_type>() const {\ |
| 13216 |
return ::testing::Matcher<arg_type>(\ |
| 13217 |
new gmock_Impl<arg_type>(p0, p1));\ |
| 13218 |
}\ |
| 13219 |
name##MatcherP2(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \ |
| 13220 |
p1(gmock_p1) {\ |
| 13221 |
}\ |
| 13222 |
p0##_type p0;\ |
| 13223 |
p1##_type p1;\ |
| 13224 |
private:\ |
| 13225 |
GTEST_DISALLOW_ASSIGN_(name##MatcherP2);\ |
| 13226 |
};\ |
| 13227 |
template <typename p0##_type, typename p1##_type>\ |
| 13228 |
inline name##MatcherP2<p0##_type, p1##_type> name(p0##_type p0, \ |
| 13229 |
p1##_type p1) {\ |
| 13230 |
return name##MatcherP2<p0##_type, p1##_type>(p0, p1);\ |
| 13231 |
}\ |
| 13232 |
template <typename p0##_type, typename p1##_type>\ |
| 13233 |
template <typename arg_type>\ |
| 13234 |
bool name##MatcherP2<p0##_type, \ |
| 13235 |
p1##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ |
| 13236 |
arg_type arg, \ |
| 13237 |
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ |
| 13238 |
const |
| 13239 |
|
| 13240 |
#define MATCHER_P3(name, p0, p1, p2, description)\ |
| 13241 |
template <typename p0##_type, typename p1##_type, typename p2##_type>\ |
| 13242 |
class name##MatcherP3 {\ |
| 13243 |
public:\ |
| 13244 |
template <typename arg_type>\ |
| 13245 |
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ |
| 13246 |
public:\ |
| 13247 |
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2)\ |
| 13248 |
: p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\ |
| 13249 |
virtual bool MatchAndExplain(\ |
| 13250 |
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ |
| 13251 |
virtual void DescribeTo(::std::ostream* gmock_os) const {\ |
| 13252 |
*gmock_os << FormatDescription(false);\ |
| 13253 |
}\ |
| 13254 |
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ |
| 13255 |
*gmock_os << FormatDescription(true);\ |
| 13256 |
}\ |
| 13257 |
p0##_type p0;\ |
| 13258 |
p1##_type p1;\ |
| 13259 |
p2##_type p2;\ |
| 13260 |
private:\ |
| 13261 |
::testing::internal::string FormatDescription(bool negation) const {\ |
| 13262 |
const ::testing::internal::string gmock_description = (description);\ |
| 13263 |
if (!gmock_description.empty())\ |
| 13264 |
return gmock_description;\ |
| 13265 |
return ::testing::internal::FormatMatcherDescription(\ |
| 13266 |
negation, #name, \ |
| 13267 |
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ |
| 13268 |
::std::tr1::tuple<p0##_type, p1##_type, p2##_type>(p0, p1, \ |
| 13269 |
p2)));\ |
| 13270 |
}\ |
| 13271 |
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
| 13272 |
};\ |
| 13273 |
template <typename arg_type>\ |
| 13274 |
operator ::testing::Matcher<arg_type>() const {\ |
| 13275 |
return ::testing::Matcher<arg_type>(\ |
| 13276 |
new gmock_Impl<arg_type>(p0, p1, p2));\ |
| 13277 |
}\ |
| 13278 |
name##MatcherP3(p0##_type gmock_p0, p1##_type gmock_p1, \ |
| 13279 |
p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {\ |
| 13280 |
}\ |
| 13281 |
p0##_type p0;\ |
| 13282 |
p1##_type p1;\ |
| 13283 |
p2##_type p2;\ |
| 13284 |
private:\ |
| 13285 |
GTEST_DISALLOW_ASSIGN_(name##MatcherP3);\ |
| 13286 |
};\ |
| 13287 |
template <typename p0##_type, typename p1##_type, typename p2##_type>\ |
| 13288 |
inline name##MatcherP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \ |
| 13289 |
p1##_type p1, p2##_type p2) {\ |
| 13290 |
return name##MatcherP3<p0##_type, p1##_type, p2##_type>(p0, p1, p2);\ |
| 13291 |
}\ |
| 13292 |
template <typename p0##_type, typename p1##_type, typename p2##_type>\ |
| 13293 |
template <typename arg_type>\ |
| 13294 |
bool name##MatcherP3<p0##_type, p1##_type, \ |
| 13295 |
p2##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ |
| 13296 |
arg_type arg, \ |
| 13297 |
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ |
| 13298 |
const |
| 13299 |
|
| 13300 |
#define MATCHER_P4(name, p0, p1, p2, p3, description)\ |
| 13301 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 13302 |
typename p3##_type>\ |
| 13303 |
class name##MatcherP4 {\ |
| 13304 |
public:\ |
| 13305 |
template <typename arg_type>\ |
| 13306 |
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ |
| 13307 |
public:\ |
| 13308 |
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
| 13309 |
p3##_type gmock_p3)\ |
| 13310 |
: p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3) {}\ |
| 13311 |
virtual bool MatchAndExplain(\ |
| 13312 |
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ |
| 13313 |
virtual void DescribeTo(::std::ostream* gmock_os) const {\ |
| 13314 |
*gmock_os << FormatDescription(false);\ |
| 13315 |
}\ |
| 13316 |
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ |
| 13317 |
*gmock_os << FormatDescription(true);\ |
| 13318 |
}\ |
| 13319 |
p0##_type p0;\ |
| 13320 |
p1##_type p1;\ |
| 13321 |
p2##_type p2;\ |
| 13322 |
p3##_type p3;\ |
| 13323 |
private:\ |
| 13324 |
::testing::internal::string FormatDescription(bool negation) const {\ |
| 13325 |
const ::testing::internal::string gmock_description = (description);\ |
| 13326 |
if (!gmock_description.empty())\ |
| 13327 |
return gmock_description;\ |
| 13328 |
return ::testing::internal::FormatMatcherDescription(\ |
| 13329 |
negation, #name, \ |
| 13330 |
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ |
| 13331 |
::std::tr1::tuple<p0##_type, p1##_type, p2##_type, \ |
| 13332 |
p3##_type>(p0, p1, p2, p3)));\ |
| 13333 |
}\ |
| 13334 |
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
| 13335 |
};\ |
| 13336 |
template <typename arg_type>\ |
| 13337 |
operator ::testing::Matcher<arg_type>() const {\ |
| 13338 |
return ::testing::Matcher<arg_type>(\ |
| 13339 |
new gmock_Impl<arg_type>(p0, p1, p2, p3));\ |
| 13340 |
}\ |
| 13341 |
name##MatcherP4(p0##_type gmock_p0, p1##_type gmock_p1, \ |
| 13342 |
p2##_type gmock_p2, p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), \ |
| 13343 |
p2(gmock_p2), p3(gmock_p3) {\ |
| 13344 |
}\ |
| 13345 |
p0##_type p0;\ |
| 13346 |
p1##_type p1;\ |
| 13347 |
p2##_type p2;\ |
| 13348 |
p3##_type p3;\ |
| 13349 |
private:\ |
| 13350 |
GTEST_DISALLOW_ASSIGN_(name##MatcherP4);\ |
| 13351 |
};\ |
| 13352 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 13353 |
typename p3##_type>\ |
| 13354 |
inline name##MatcherP4<p0##_type, p1##_type, p2##_type, \ |
| 13355 |
p3##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \ |
| 13356 |
p3##_type p3) {\ |
| 13357 |
return name##MatcherP4<p0##_type, p1##_type, p2##_type, p3##_type>(p0, \ |
| 13358 |
p1, p2, p3);\ |
| 13359 |
}\ |
| 13360 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 13361 |
typename p3##_type>\ |
| 13362 |
template <typename arg_type>\ |
| 13363 |
bool name##MatcherP4<p0##_type, p1##_type, p2##_type, \ |
| 13364 |
p3##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ |
| 13365 |
arg_type arg, \ |
| 13366 |
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ |
| 13367 |
const |
| 13368 |
|
| 13369 |
#define MATCHER_P5(name, p0, p1, p2, p3, p4, description)\ |
| 13370 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 13371 |
typename p3##_type, typename p4##_type>\ |
| 13372 |
class name##MatcherP5 {\ |
| 13373 |
public:\ |
| 13374 |
template <typename arg_type>\ |
| 13375 |
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ |
| 13376 |
public:\ |
| 13377 |
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
| 13378 |
p3##_type gmock_p3, p4##_type gmock_p4)\ |
| 13379 |
: p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ |
| 13380 |
p4(gmock_p4) {}\ |
| 13381 |
virtual bool MatchAndExplain(\ |
| 13382 |
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ |
| 13383 |
virtual void DescribeTo(::std::ostream* gmock_os) const {\ |
| 13384 |
*gmock_os << FormatDescription(false);\ |
| 13385 |
}\ |
| 13386 |
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ |
| 13387 |
*gmock_os << FormatDescription(true);\ |
| 13388 |
}\ |
| 13389 |
p0##_type p0;\ |
| 13390 |
p1##_type p1;\ |
| 13391 |
p2##_type p2;\ |
| 13392 |
p3##_type p3;\ |
| 13393 |
p4##_type p4;\ |
| 13394 |
private:\ |
| 13395 |
::testing::internal::string FormatDescription(bool negation) const {\ |
| 13396 |
const ::testing::internal::string gmock_description = (description);\ |
| 13397 |
if (!gmock_description.empty())\ |
| 13398 |
return gmock_description;\ |
| 13399 |
return ::testing::internal::FormatMatcherDescription(\ |
| 13400 |
negation, #name, \ |
| 13401 |
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ |
| 13402 |
::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 13403 |
p4##_type>(p0, p1, p2, p3, p4)));\ |
| 13404 |
}\ |
| 13405 |
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
| 13406 |
};\ |
| 13407 |
template <typename arg_type>\ |
| 13408 |
operator ::testing::Matcher<arg_type>() const {\ |
| 13409 |
return ::testing::Matcher<arg_type>(\ |
| 13410 |
new gmock_Impl<arg_type>(p0, p1, p2, p3, p4));\ |
| 13411 |
}\ |
| 13412 |
name##MatcherP5(p0##_type gmock_p0, p1##_type gmock_p1, \ |
| 13413 |
p2##_type gmock_p2, p3##_type gmock_p3, \ |
| 13414 |
p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
| 13415 |
p3(gmock_p3), p4(gmock_p4) {\ |
| 13416 |
}\ |
| 13417 |
p0##_type p0;\ |
| 13418 |
p1##_type p1;\ |
| 13419 |
p2##_type p2;\ |
| 13420 |
p3##_type p3;\ |
| 13421 |
p4##_type p4;\ |
| 13422 |
private:\ |
| 13423 |
GTEST_DISALLOW_ASSIGN_(name##MatcherP5);\ |
| 13424 |
};\ |
| 13425 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 13426 |
typename p3##_type, typename p4##_type>\ |
| 13427 |
inline name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 13428 |
p4##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ |
| 13429 |
p4##_type p4) {\ |
| 13430 |
return name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 13431 |
p4##_type>(p0, p1, p2, p3, p4);\ |
| 13432 |
}\ |
| 13433 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 13434 |
typename p3##_type, typename p4##_type>\ |
| 13435 |
template <typename arg_type>\ |
| 13436 |
bool name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 13437 |
p4##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ |
| 13438 |
arg_type arg, \ |
| 13439 |
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ |
| 13440 |
const |
| 13441 |
|
| 13442 |
#define MATCHER_P6(name, p0, p1, p2, p3, p4, p5, description)\ |
| 13443 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 13444 |
typename p3##_type, typename p4##_type, typename p5##_type>\ |
| 13445 |
class name##MatcherP6 {\ |
| 13446 |
public:\ |
| 13447 |
template <typename arg_type>\ |
| 13448 |
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ |
| 13449 |
public:\ |
| 13450 |
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
| 13451 |
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5)\ |
| 13452 |
: p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ |
| 13453 |
p4(gmock_p4), p5(gmock_p5) {}\ |
| 13454 |
virtual bool MatchAndExplain(\ |
| 13455 |
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ |
| 13456 |
virtual void DescribeTo(::std::ostream* gmock_os) const {\ |
| 13457 |
*gmock_os << FormatDescription(false);\ |
| 13458 |
}\ |
| 13459 |
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ |
| 13460 |
*gmock_os << FormatDescription(true);\ |
| 13461 |
}\ |
| 13462 |
p0##_type p0;\ |
| 13463 |
p1##_type p1;\ |
| 13464 |
p2##_type p2;\ |
| 13465 |
p3##_type p3;\ |
| 13466 |
p4##_type p4;\ |
| 13467 |
p5##_type p5;\ |
| 13468 |
private:\ |
| 13469 |
::testing::internal::string FormatDescription(bool negation) const {\ |
| 13470 |
const ::testing::internal::string gmock_description = (description);\ |
| 13471 |
if (!gmock_description.empty())\ |
| 13472 |
return gmock_description;\ |
| 13473 |
return ::testing::internal::FormatMatcherDescription(\ |
| 13474 |
negation, #name, \ |
| 13475 |
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ |
| 13476 |
::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 13477 |
p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5)));\ |
| 13478 |
}\ |
| 13479 |
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
| 13480 |
};\ |
| 13481 |
template <typename arg_type>\ |
| 13482 |
operator ::testing::Matcher<arg_type>() const {\ |
| 13483 |
return ::testing::Matcher<arg_type>(\ |
| 13484 |
new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5));\ |
| 13485 |
}\ |
| 13486 |
name##MatcherP6(p0##_type gmock_p0, p1##_type gmock_p1, \ |
| 13487 |
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ |
| 13488 |
p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
| 13489 |
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {\ |
| 13490 |
}\ |
| 13491 |
p0##_type p0;\ |
| 13492 |
p1##_type p1;\ |
| 13493 |
p2##_type p2;\ |
| 13494 |
p3##_type p3;\ |
| 13495 |
p4##_type p4;\ |
| 13496 |
p5##_type p5;\ |
| 13497 |
private:\ |
| 13498 |
GTEST_DISALLOW_ASSIGN_(name##MatcherP6);\ |
| 13499 |
};\ |
| 13500 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 13501 |
typename p3##_type, typename p4##_type, typename p5##_type>\ |
| 13502 |
inline name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 13503 |
p4##_type, p5##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \ |
| 13504 |
p3##_type p3, p4##_type p4, p5##_type p5) {\ |
| 13505 |
return name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 13506 |
p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5);\ |
| 13507 |
}\ |
| 13508 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 13509 |
typename p3##_type, typename p4##_type, typename p5##_type>\ |
| 13510 |
template <typename arg_type>\ |
| 13511 |
bool name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ |
| 13512 |
p5##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ |
| 13513 |
arg_type arg, \ |
| 13514 |
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ |
| 13515 |
const |
| 13516 |
|
| 13517 |
#define MATCHER_P7(name, p0, p1, p2, p3, p4, p5, p6, description)\ |
| 13518 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 13519 |
typename p3##_type, typename p4##_type, typename p5##_type, \ |
| 13520 |
typename p6##_type>\ |
| 13521 |
class name##MatcherP7 {\ |
| 13522 |
public:\ |
| 13523 |
template <typename arg_type>\ |
| 13524 |
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ |
| 13525 |
public:\ |
| 13526 |
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
| 13527 |
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ |
| 13528 |
p6##_type gmock_p6)\ |
| 13529 |
: p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ |
| 13530 |
p4(gmock_p4), p5(gmock_p5), p6(gmock_p6) {}\ |
| 13531 |
virtual bool MatchAndExplain(\ |
| 13532 |
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ |
| 13533 |
virtual void DescribeTo(::std::ostream* gmock_os) const {\ |
| 13534 |
*gmock_os << FormatDescription(false);\ |
| 13535 |
}\ |
| 13536 |
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ |
| 13537 |
*gmock_os << FormatDescription(true);\ |
| 13538 |
}\ |
| 13539 |
p0##_type p0;\ |
| 13540 |
p1##_type p1;\ |
| 13541 |
p2##_type p2;\ |
| 13542 |
p3##_type p3;\ |
| 13543 |
p4##_type p4;\ |
| 13544 |
p5##_type p5;\ |
| 13545 |
p6##_type p6;\ |
| 13546 |
private:\ |
| 13547 |
::testing::internal::string FormatDescription(bool negation) const {\ |
| 13548 |
const ::testing::internal::string gmock_description = (description);\ |
| 13549 |
if (!gmock_description.empty())\ |
| 13550 |
return gmock_description;\ |
| 13551 |
return ::testing::internal::FormatMatcherDescription(\ |
| 13552 |
negation, #name, \ |
| 13553 |
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ |
| 13554 |
::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 13555 |
p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, \ |
| 13556 |
p6)));\ |
| 13557 |
}\ |
| 13558 |
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
| 13559 |
};\ |
| 13560 |
template <typename arg_type>\ |
| 13561 |
operator ::testing::Matcher<arg_type>() const {\ |
| 13562 |
return ::testing::Matcher<arg_type>(\ |
| 13563 |
new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6));\ |
| 13564 |
}\ |
| 13565 |
name##MatcherP7(p0##_type gmock_p0, p1##_type gmock_p1, \ |
| 13566 |
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ |
| 13567 |
p5##_type gmock_p5, p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), \ |
| 13568 |
p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), \ |
| 13569 |
p6(gmock_p6) {\ |
| 13570 |
}\ |
| 13571 |
p0##_type p0;\ |
| 13572 |
p1##_type p1;\ |
| 13573 |
p2##_type p2;\ |
| 13574 |
p3##_type p3;\ |
| 13575 |
p4##_type p4;\ |
| 13576 |
p5##_type p5;\ |
| 13577 |
p6##_type p6;\ |
| 13578 |
private:\ |
| 13579 |
GTEST_DISALLOW_ASSIGN_(name##MatcherP7);\ |
| 13580 |
};\ |
| 13581 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 13582 |
typename p3##_type, typename p4##_type, typename p5##_type, \ |
| 13583 |
typename p6##_type>\ |
| 13584 |
inline name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 13585 |
p4##_type, p5##_type, p6##_type> name(p0##_type p0, p1##_type p1, \ |
| 13586 |
p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \ |
| 13587 |
p6##_type p6) {\ |
| 13588 |
return name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 13589 |
p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, p6);\ |
| 13590 |
}\ |
| 13591 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 13592 |
typename p3##_type, typename p4##_type, typename p5##_type, \ |
| 13593 |
typename p6##_type>\ |
| 13594 |
template <typename arg_type>\ |
| 13595 |
bool name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ |
| 13596 |
p5##_type, p6##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ |
| 13597 |
arg_type arg, \ |
| 13598 |
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ |
| 13599 |
const |
| 13600 |
|
| 13601 |
#define MATCHER_P8(name, p0, p1, p2, p3, p4, p5, p6, p7, description)\ |
| 13602 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 13603 |
typename p3##_type, typename p4##_type, typename p5##_type, \ |
| 13604 |
typename p6##_type, typename p7##_type>\ |
| 13605 |
class name##MatcherP8 {\ |
| 13606 |
public:\ |
| 13607 |
template <typename arg_type>\ |
| 13608 |
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ |
| 13609 |
public:\ |
| 13610 |
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
| 13611 |
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ |
| 13612 |
p6##_type gmock_p6, p7##_type gmock_p7)\ |
| 13613 |
: p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ |
| 13614 |
p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7) {}\ |
| 13615 |
virtual bool MatchAndExplain(\ |
| 13616 |
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ |
| 13617 |
virtual void DescribeTo(::std::ostream* gmock_os) const {\ |
| 13618 |
*gmock_os << FormatDescription(false);\ |
| 13619 |
}\ |
| 13620 |
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ |
| 13621 |
*gmock_os << FormatDescription(true);\ |
| 13622 |
}\ |
| 13623 |
p0##_type p0;\ |
| 13624 |
p1##_type p1;\ |
| 13625 |
p2##_type p2;\ |
| 13626 |
p3##_type p3;\ |
| 13627 |
p4##_type p4;\ |
| 13628 |
p5##_type p5;\ |
| 13629 |
p6##_type p6;\ |
| 13630 |
p7##_type p7;\ |
| 13631 |
private:\ |
| 13632 |
::testing::internal::string FormatDescription(bool negation) const {\ |
| 13633 |
const ::testing::internal::string gmock_description = (description);\ |
| 13634 |
if (!gmock_description.empty())\ |
| 13635 |
return gmock_description;\ |
| 13636 |
return ::testing::internal::FormatMatcherDescription(\ |
| 13637 |
negation, #name, \ |
| 13638 |
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ |
| 13639 |
::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 13640 |
p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, \ |
| 13641 |
p3, p4, p5, p6, p7)));\ |
| 13642 |
}\ |
| 13643 |
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
| 13644 |
};\ |
| 13645 |
template <typename arg_type>\ |
| 13646 |
operator ::testing::Matcher<arg_type>() const {\ |
| 13647 |
return ::testing::Matcher<arg_type>(\ |
| 13648 |
new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6, p7));\ |
| 13649 |
}\ |
| 13650 |
name##MatcherP8(p0##_type gmock_p0, p1##_type gmock_p1, \ |
| 13651 |
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ |
| 13652 |
p5##_type gmock_p5, p6##_type gmock_p6, \ |
| 13653 |
p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
| 13654 |
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ |
| 13655 |
p7(gmock_p7) {\ |
| 13656 |
}\ |
| 13657 |
p0##_type p0;\ |
| 13658 |
p1##_type p1;\ |
| 13659 |
p2##_type p2;\ |
| 13660 |
p3##_type p3;\ |
| 13661 |
p4##_type p4;\ |
| 13662 |
p5##_type p5;\ |
| 13663 |
p6##_type p6;\ |
| 13664 |
p7##_type p7;\ |
| 13665 |
private:\ |
| 13666 |
GTEST_DISALLOW_ASSIGN_(name##MatcherP8);\ |
| 13667 |
};\ |
| 13668 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 13669 |
typename p3##_type, typename p4##_type, typename p5##_type, \ |
| 13670 |
typename p6##_type, typename p7##_type>\ |
| 13671 |
inline name##MatcherP8<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 13672 |
p4##_type, p5##_type, p6##_type, p7##_type> name(p0##_type p0, \ |
| 13673 |
p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \ |
| 13674 |
p6##_type p6, p7##_type p7) {\ |
| 13675 |
return name##MatcherP8<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 13676 |
p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, p3, p4, p5, \ |
| 13677 |
p6, p7);\ |
| 13678 |
}\ |
| 13679 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 13680 |
typename p3##_type, typename p4##_type, typename p5##_type, \ |
| 13681 |
typename p6##_type, typename p7##_type>\ |
| 13682 |
template <typename arg_type>\ |
| 13683 |
bool name##MatcherP8<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ |
| 13684 |
p5##_type, p6##_type, \ |
| 13685 |
p7##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ |
| 13686 |
arg_type arg, \ |
| 13687 |
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ |
| 13688 |
const |
| 13689 |
|
| 13690 |
#define MATCHER_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, description)\ |
| 13691 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 13692 |
typename p3##_type, typename p4##_type, typename p5##_type, \ |
| 13693 |
typename p6##_type, typename p7##_type, typename p8##_type>\ |
| 13694 |
class name##MatcherP9 {\ |
| 13695 |
public:\ |
| 13696 |
template <typename arg_type>\ |
| 13697 |
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ |
| 13698 |
public:\ |
| 13699 |
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
| 13700 |
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ |
| 13701 |
p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8)\ |
| 13702 |
: p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ |
| 13703 |
p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ |
| 13704 |
p8(gmock_p8) {}\ |
| 13705 |
virtual bool MatchAndExplain(\ |
| 13706 |
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ |
| 13707 |
virtual void DescribeTo(::std::ostream* gmock_os) const {\ |
| 13708 |
*gmock_os << FormatDescription(false);\ |
| 13709 |
}\ |
| 13710 |
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ |
| 13711 |
*gmock_os << FormatDescription(true);\ |
| 13712 |
}\ |
| 13713 |
p0##_type p0;\ |
| 13714 |
p1##_type p1;\ |
| 13715 |
p2##_type p2;\ |
| 13716 |
p3##_type p3;\ |
| 13717 |
p4##_type p4;\ |
| 13718 |
p5##_type p5;\ |
| 13719 |
p6##_type p6;\ |
| 13720 |
p7##_type p7;\ |
| 13721 |
p8##_type p8;\ |
| 13722 |
private:\ |
| 13723 |
::testing::internal::string FormatDescription(bool negation) const {\ |
| 13724 |
const ::testing::internal::string gmock_description = (description);\ |
| 13725 |
if (!gmock_description.empty())\ |
| 13726 |
return gmock_description;\ |
| 13727 |
return ::testing::internal::FormatMatcherDescription(\ |
| 13728 |
negation, #name, \ |
| 13729 |
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ |
| 13730 |
::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 13731 |
p4##_type, p5##_type, p6##_type, p7##_type, \ |
| 13732 |
p8##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8)));\ |
| 13733 |
}\ |
| 13734 |
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
| 13735 |
};\ |
| 13736 |
template <typename arg_type>\ |
| 13737 |
operator ::testing::Matcher<arg_type>() const {\ |
| 13738 |
return ::testing::Matcher<arg_type>(\ |
| 13739 |
new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8));\ |
| 13740 |
}\ |
| 13741 |
name##MatcherP9(p0##_type gmock_p0, p1##_type gmock_p1, \ |
| 13742 |
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ |
| 13743 |
p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \ |
| 13744 |
p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
| 13745 |
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ |
| 13746 |
p8(gmock_p8) {\ |
| 13747 |
}\ |
| 13748 |
p0##_type p0;\ |
| 13749 |
p1##_type p1;\ |
| 13750 |
p2##_type p2;\ |
| 13751 |
p3##_type p3;\ |
| 13752 |
p4##_type p4;\ |
| 13753 |
p5##_type p5;\ |
| 13754 |
p6##_type p6;\ |
| 13755 |
p7##_type p7;\ |
| 13756 |
p8##_type p8;\ |
| 13757 |
private:\ |
| 13758 |
GTEST_DISALLOW_ASSIGN_(name##MatcherP9);\ |
| 13759 |
};\ |
| 13760 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 13761 |
typename p3##_type, typename p4##_type, typename p5##_type, \ |
| 13762 |
typename p6##_type, typename p7##_type, typename p8##_type>\ |
| 13763 |
inline name##MatcherP9<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 13764 |
p4##_type, p5##_type, p6##_type, p7##_type, \ |
| 13765 |
p8##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ |
| 13766 |
p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, \ |
| 13767 |
p8##_type p8) {\ |
| 13768 |
return name##MatcherP9<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 13769 |
p4##_type, p5##_type, p6##_type, p7##_type, p8##_type>(p0, p1, p2, \ |
| 13770 |
p3, p4, p5, p6, p7, p8);\ |
| 13771 |
}\ |
| 13772 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 13773 |
typename p3##_type, typename p4##_type, typename p5##_type, \ |
| 13774 |
typename p6##_type, typename p7##_type, typename p8##_type>\ |
| 13775 |
template <typename arg_type>\ |
| 13776 |
bool name##MatcherP9<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ |
| 13777 |
p5##_type, p6##_type, p7##_type, \ |
| 13778 |
p8##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ |
| 13779 |
arg_type arg, \ |
| 13780 |
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ |
| 13781 |
const |
| 13782 |
|
| 13783 |
#define MATCHER_P10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, description)\ |
| 13784 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 13785 |
typename p3##_type, typename p4##_type, typename p5##_type, \ |
| 13786 |
typename p6##_type, typename p7##_type, typename p8##_type, \ |
| 13787 |
typename p9##_type>\ |
| 13788 |
class name##MatcherP10 {\ |
| 13789 |
public:\ |
| 13790 |
template <typename arg_type>\ |
| 13791 |
class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ |
| 13792 |
public:\ |
| 13793 |
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
| 13794 |
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ |
| 13795 |
p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \ |
| 13796 |
p9##_type gmock_p9)\ |
| 13797 |
: p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ |
| 13798 |
p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ |
| 13799 |
p8(gmock_p8), p9(gmock_p9) {}\ |
| 13800 |
virtual bool MatchAndExplain(\ |
| 13801 |
arg_type arg, ::testing::MatchResultListener* result_listener) const;\ |
| 13802 |
virtual void DescribeTo(::std::ostream* gmock_os) const {\ |
| 13803 |
*gmock_os << FormatDescription(false);\ |
| 13804 |
}\ |
| 13805 |
virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ |
| 13806 |
*gmock_os << FormatDescription(true);\ |
| 13807 |
}\ |
| 13808 |
p0##_type p0;\ |
| 13809 |
p1##_type p1;\ |
| 13810 |
p2##_type p2;\ |
| 13811 |
p3##_type p3;\ |
| 13812 |
p4##_type p4;\ |
| 13813 |
p5##_type p5;\ |
| 13814 |
p6##_type p6;\ |
| 13815 |
p7##_type p7;\ |
| 13816 |
p8##_type p8;\ |
| 13817 |
p9##_type p9;\ |
| 13818 |
private:\ |
| 13819 |
::testing::internal::string FormatDescription(bool negation) const {\ |
| 13820 |
const ::testing::internal::string gmock_description = (description);\ |
| 13821 |
if (!gmock_description.empty())\ |
| 13822 |
return gmock_description;\ |
| 13823 |
return ::testing::internal::FormatMatcherDescription(\ |
| 13824 |
negation, #name, \ |
| 13825 |
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ |
| 13826 |
::std::tr1::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 13827 |
p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \ |
| 13828 |
p9##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)));\ |
| 13829 |
}\ |
| 13830 |
GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
| 13831 |
};\ |
| 13832 |
template <typename arg_type>\ |
| 13833 |
operator ::testing::Matcher<arg_type>() const {\ |
| 13834 |
return ::testing::Matcher<arg_type>(\ |
| 13835 |
new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9));\ |
| 13836 |
}\ |
| 13837 |
name##MatcherP10(p0##_type gmock_p0, p1##_type gmock_p1, \ |
| 13838 |
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ |
| 13839 |
p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \ |
| 13840 |
p8##_type gmock_p8, p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), \ |
| 13841 |
p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ |
| 13842 |
p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {\ |
| 13843 |
}\ |
| 13844 |
p0##_type p0;\ |
| 13845 |
p1##_type p1;\ |
| 13846 |
p2##_type p2;\ |
| 13847 |
p3##_type p3;\ |
| 13848 |
p4##_type p4;\ |
| 13849 |
p5##_type p5;\ |
| 13850 |
p6##_type p6;\ |
| 13851 |
p7##_type p7;\ |
| 13852 |
p8##_type p8;\ |
| 13853 |
p9##_type p9;\ |
| 13854 |
private:\ |
| 13855 |
GTEST_DISALLOW_ASSIGN_(name##MatcherP10);\ |
| 13856 |
};\ |
| 13857 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 13858 |
typename p3##_type, typename p4##_type, typename p5##_type, \ |
| 13859 |
typename p6##_type, typename p7##_type, typename p8##_type, \ |
| 13860 |
typename p9##_type>\ |
| 13861 |
inline name##MatcherP10<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 13862 |
p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \ |
| 13863 |
p9##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ |
| 13864 |
p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \ |
| 13865 |
p9##_type p9) {\ |
| 13866 |
return name##MatcherP10<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 13867 |
p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, p9##_type>(p0, \ |
| 13868 |
p1, p2, p3, p4, p5, p6, p7, p8, p9);\ |
| 13869 |
}\ |
| 13870 |
template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
| 13871 |
typename p3##_type, typename p4##_type, typename p5##_type, \ |
| 13872 |
typename p6##_type, typename p7##_type, typename p8##_type, \ |
| 13873 |
typename p9##_type>\ |
| 13874 |
template <typename arg_type>\ |
| 13875 |
bool name##MatcherP10<p0##_type, p1##_type, p2##_type, p3##_type, \ |
| 13876 |
p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \ |
| 13877 |
p9##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ |
| 13878 |
arg_type arg, \ |
| 13879 |
::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ |
| 13880 |
const |
| 13881 |
|
| 13882 |
#endif |
| 13883 |
|
| 13884 |
|
| 13885 |
|
| 13886 |
|
| 13887 |
|
| 13888 |
|
| 13889 |
|
| 13890 |
|
| 13891 |
|
| 13892 |
|
| 13893 |
|
| 13894 |
|
| 13895 |
|
| 13896 |
|
| 13897 |
|
| 13898 |
|
| 13899 |
|
| 13900 |
|
| 13901 |
|
| 13902 |
|
| 13903 |
|
| 13904 |
|
| 13905 |
|
| 13906 |
|
| 13907 |
|
| 13908 |
|
| 13909 |
|
| 13910 |
|
| 13911 |
|
| 13912 |
|
| 13913 |
|
| 13914 |
|
| 13915 |
|
| 13916 |
|
| 13917 |
|
| 13918 |
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_ |
| 13919 |
#define GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_ |
| 13920 |
|
| 13921 |
#include <algorithm> |
| 13922 |
|
| 13923 |
|
| 13924 |
namespace testing { |
| 13925 |
namespace internal { |
| 13926 |
|
| 13927 |
|
| 13928 |
|
| 13929 |
|
| 13930 |
|
| 13931 |
|
| 13932 |
template <typename FunctionImpl> |
| 13933 |
class InvokeAction { |
| 13934 |
public: |
| 13935 |
|
| 13936 |
|
| 13937 |
explicit InvokeAction(FunctionImpl function_impl) |
| 13938 |
: function_impl_(function_impl) {} |
| 13939 |
|
| 13940 |
template <typename Result, typename ArgumentTuple> |
| 13941 |
Result Perform(const ArgumentTuple& args) { |
| 13942 |
return InvokeHelper<Result, ArgumentTuple>::Invoke(function_impl_, args); |
| 13943 |
} |
| 13944 |
|
| 13945 |
private: |
| 13946 |
FunctionImpl function_impl_; |
| 13947 |
|
| 13948 |
GTEST_DISALLOW_ASSIGN_(InvokeAction); |
| 13949 |
}; |
| 13950 |
|
| 13951 |
|
| 13952 |
template <class Class, typename MethodPtr> |
| 13953 |
class InvokeMethodAction { |
| 13954 |
public: |
| 13955 |
InvokeMethodAction(Class* obj_ptr, MethodPtr method_ptr) |
| 13956 |
: obj_ptr_(obj_ptr), method_ptr_(method_ptr) {} |
| 13957 |
|
| 13958 |
template <typename Result, typename ArgumentTuple> |
| 13959 |
Result Perform(const ArgumentTuple& args) const { |
| 13960 |
return InvokeHelper<Result, ArgumentTuple>::InvokeMethod( |
| 13961 |
obj_ptr_, method_ptr_, args); |
| 13962 |
} |
| 13963 |
|
| 13964 |
private: |
| 13965 |
Class* const obj_ptr_; |
| 13966 |
const MethodPtr method_ptr_; |
| 13967 |
|
| 13968 |
GTEST_DISALLOW_ASSIGN_(InvokeMethodAction); |
| 13969 |
}; |
| 13970 |
|
| 13971 |
} |
| 13972 |
|
| 13973 |
|
| 13974 |
|
| 13975 |
|
| 13976 |
|
| 13977 |
template <typename FunctionImpl> |
| 13978 |
PolymorphicAction<internal::InvokeAction<FunctionImpl> > Invoke( |
| 13979 |
FunctionImpl function_impl) { |
| 13980 |
return MakePolymorphicAction( |
| 13981 |
internal::InvokeAction<FunctionImpl>(function_impl)); |
| 13982 |
} |
| 13983 |
|
| 13984 |
|
| 13985 |
|
| 13986 |
template <class Class, typename MethodPtr> |
| 13987 |
PolymorphicAction<internal::InvokeMethodAction<Class, MethodPtr> > Invoke( |
| 13988 |
Class* obj_ptr, MethodPtr method_ptr) { |
| 13989 |
return MakePolymorphicAction( |
| 13990 |
internal::InvokeMethodAction<Class, MethodPtr>(obj_ptr, method_ptr)); |
| 13991 |
} |
| 13992 |
|
| 13993 |
|
| 13994 |
|
| 13995 |
|
| 13996 |
|
| 13997 |
template <typename InnerAction> |
| 13998 |
inline internal::WithArgsAction<InnerAction> |
| 13999 |
WithoutArgs(const InnerAction& action) { |
| 14000 |
return internal::WithArgsAction<InnerAction>(action); |
| 14001 |
} |
| 14002 |
|
| 14003 |
|
| 14004 |
|
| 14005 |
|
| 14006 |
|
| 14007 |
|
| 14008 |
template <int k, typename InnerAction> |
| 14009 |
inline internal::WithArgsAction<InnerAction, k> |
| 14010 |
WithArg(const InnerAction& action) { |
| 14011 |
return internal::WithArgsAction<InnerAction, k>(action); |
| 14012 |
} |
| 14013 |
|
| 14014 |
|
| 14015 |
|
| 14016 |
|
| 14017 |
|
| 14018 |
|
| 14019 |
#ifdef _MSC_VER |
| 14020 |
# pragma warning(push) |
| 14021 |
# pragma warning(disable:4100) |
| 14022 |
#endif |
| 14023 |
|
| 14024 |
|
| 14025 |
ACTION_TEMPLATE(ReturnArg, |
| 14026 |
HAS_1_TEMPLATE_PARAMS(int, k), |
| 14027 |
AND_0_VALUE_PARAMS()) { |
| 14028 |
return std::tr1::get<k>(args); |
| 14029 |
} |
| 14030 |
|
| 14031 |
|
| 14032 |
|
| 14033 |
ACTION_TEMPLATE(SaveArg, |
| 14034 |
HAS_1_TEMPLATE_PARAMS(int, k), |
| 14035 |
AND_1_VALUE_PARAMS(pointer)) { |
| 14036 |
*pointer = ::std::tr1::get<k>(args); |
| 14037 |
} |
| 14038 |
|
| 14039 |
|
| 14040 |
|
| 14041 |
ACTION_TEMPLATE(SaveArgPointee, |
| 14042 |
HAS_1_TEMPLATE_PARAMS(int, k), |
| 14043 |
AND_1_VALUE_PARAMS(pointer)) { |
| 14044 |
*pointer = *::std::tr1::get<k>(args); |
| 14045 |
} |
| 14046 |
|
| 14047 |
|
| 14048 |
|
| 14049 |
ACTION_TEMPLATE(SetArgReferee, |
| 14050 |
HAS_1_TEMPLATE_PARAMS(int, k), |
| 14051 |
AND_1_VALUE_PARAMS(value)) { |
| 14052 |
typedef typename ::std::tr1::tuple_element<k, args_type>::type argk_type; |
| 14053 |
|
| 14054 |
|
| 14055 |
|
| 14056 |
GTEST_COMPILE_ASSERT_(internal::is_reference<argk_type>::value, |
| 14057 |
SetArgReferee_must_be_used_with_a_reference_argument); |
| 14058 |
::std::tr1::get<k>(args) = value; |
| 14059 |
} |
| 14060 |
|
| 14061 |
|
| 14062 |
|
| 14063 |
|
| 14064 |
|
| 14065 |
|
| 14066 |
ACTION_TEMPLATE(SetArrayArgument, |
| 14067 |
HAS_1_TEMPLATE_PARAMS(int, k), |
| 14068 |
AND_2_VALUE_PARAMS(first, last)) { |
| 14069 |
|
| 14070 |
|
| 14071 |
#ifdef _MSC_VER |
| 14072 |
# pragma warning(push) // Saves the current warning state. |
| 14073 |
# pragma warning(disable:4996) // Temporarily disables warning 4996. |
| 14074 |
#endif |
| 14075 |
::std::copy(first, last, ::std::tr1::get<k>(args)); |
| 14076 |
#ifdef _MSC_VER |
| 14077 |
# pragma warning(pop) // Restores the warning state. |
| 14078 |
#endif |
| 14079 |
} |
| 14080 |
|
| 14081 |
|
| 14082 |
|
| 14083 |
ACTION_TEMPLATE(DeleteArg, |
| 14084 |
HAS_1_TEMPLATE_PARAMS(int, k), |
| 14085 |
AND_0_VALUE_PARAMS()) { |
| 14086 |
delete ::std::tr1::get<k>(args); |
| 14087 |
} |
| 14088 |
|
| 14089 |
|
| 14090 |
ACTION_P(ReturnPointee, pointer) { return *pointer; } |
| 14091 |
|
| 14092 |
|
| 14093 |
|
| 14094 |
#if GTEST_HAS_EXCEPTIONS |
| 14095 |
|
| 14096 |
|
| 14097 |
# ifdef _MSC_VER |
| 14098 |
# pragma warning(push) // Saves the current warning state. |
| 14099 |
# pragma warning(disable:4702) // Temporarily disables warning 4702. |
| 14100 |
# endif |
| 14101 |
ACTION_P(Throw, exception) { throw exception; } |
| 14102 |
# ifdef _MSC_VER |
| 14103 |
# pragma warning(pop) // Restores the warning state. |
| 14104 |
# endif |
| 14105 |
|
| 14106 |
#endif |
| 14107 |
|
| 14108 |
#ifdef _MSC_VER |
| 14109 |
# pragma warning(pop) |
| 14110 |
#endif |
| 14111 |
|
| 14112 |
} |
| 14113 |
|
| 14114 |
#endif |
| 14115 |
|
| 14116 |
|
| 14117 |
|
| 14118 |
|
| 14119 |
|
| 14120 |
|
| 14121 |
|
| 14122 |
|
| 14123 |
|
| 14124 |
|
| 14125 |
|
| 14126 |
|
| 14127 |
|
| 14128 |
|
| 14129 |
|
| 14130 |
|
| 14131 |
|
| 14132 |
|
| 14133 |
|
| 14134 |
|
| 14135 |
|
| 14136 |
|
| 14137 |
|
| 14138 |
|
| 14139 |
|
| 14140 |
|
| 14141 |
|
| 14142 |
|
| 14143 |
|
| 14144 |
|
| 14145 |
|
| 14146 |
|
| 14147 |
|
| 14148 |
|
| 14149 |
|
| 14150 |
|
| 14151 |
|
| 14152 |
|
| 14153 |
#ifndef GMOCK_GMOCK_MORE_MATCHERS_H_ |
| 14154 |
#define GMOCK_GMOCK_MORE_MATCHERS_H_ |
| 14155 |
|
| 14156 |
|
| 14157 |
namespace testing { |
| 14158 |
|
| 14159 |
|
| 14160 |
|
| 14161 |
MATCHER(IsEmpty, negation ? "isn't empty" : "is empty") { |
| 14162 |
if (arg.empty()) { |
| 14163 |
return true; |
| 14164 |
} |
| 14165 |
*result_listener << "whose size is " << arg.size(); |
| 14166 |
return false; |
| 14167 |
} |
| 14168 |
|
| 14169 |
} |
| 14170 |
|
| 14171 |
#endif |
| 14172 |
|
| 14173 |
namespace testing { |
| 14174 |
|
| 14175 |
|
| 14176 |
GMOCK_DECLARE_bool_(catch_leaked_mocks); |
| 14177 |
GMOCK_DECLARE_string_(verbose); |
| 14178 |
|
| 14179 |
|
| 14180 |
|
| 14181 |
|
| 14182 |
|
| 14183 |
|
| 14184 |
|
| 14185 |
|
| 14186 |
|
| 14187 |
|
| 14188 |
|
| 14189 |
|
| 14190 |
GTEST_API_ void InitGoogleMock(int* argc, char** argv); |
| 14191 |
|
| 14192 |
|
| 14193 |
|
| 14194 |
GTEST_API_ void InitGoogleMock(int* argc, wchar_t** argv); |
| 14195 |
|
| 14196 |
} |
| 14197 |
|
| 14198 |
#endif |