|
proxygen
|
#include <folly/Executor.h>#include <folly/Memory.h>#include <folly/Unit.h>#include <folly/dynamic.h>#include <folly/executors/ManualExecutor.h>#include <folly/futures/Future.h>#include <folly/io/async/EventBase.h>#include <folly/portability/GTest.h>#include <folly/synchronization/Baton.h>#include <algorithm>#include <atomic>#include <future>#include <memory>#include <numeric>#include <string>#include <thread>#include <type_traits>Go to the source code of this file.
Macros | |
| #define | EXPECT_TYPE(x, T) EXPECT_TRUE((std::is_same<decltype(x), T>::value)) |
| #define | DOIT(CREATION_EXPR) |
| #define | DOIT(CREATION_EXPR) |
| #define | DOIT(STMT) |
| #define | DOIT(STMT) |
| #define | DOIT(STMT) |
| #define | DOIT(CTOR, STMT) |
| #define | EXPECT_FLAG() |
| #define | EXPECT_NO_FLAG() |
Typedefs | |
| typedef FutureException | eggs_t |
Functions | |
| TEST (SemiFuture, makeEmpty) | |
| TEST (SemiFuture, futureDefaultCtor) | |
| TEST (SemiFuture, makeSemiFutureWithUnit) | |
| TEST (SemiFuture, ctorPostconditionValid) | |
| TEST (SemiFuture, ctorPostconditionInvalid) | |
| TEST (SemiFuture, lacksPreconditionValid) | |
| TEST (SemiFuture, hasPreconditionValid) | |
| TEST (SemiFuture, hasPostconditionValid) | |
| TEST (SemiFuture, hasPostconditionInvalid) | |
| TEST (SemiFuture, special) | |
| TEST (SemiFuture, value) | |
| TEST (SemiFuture, hasException) | |
| TEST (SemiFuture, hasValue) | |
| TEST (SemiFuture, makeSemiFuture) | |
| TEST (SemiFuture, Constructor) | |
| TEST (SemiFuture, ImplicitConstructor) | |
| TEST (SemiFuture, InPlaceConstructor) | |
| TEST (SemiFuture, makeSemiFutureNoThrow) | |
| TEST (SemiFuture, ViaThrowOnNull) | |
| TEST (SemiFuture, ConstructSemiFutureFromEmptyFuture) | |
| TEST (SemiFuture, ConstructSemiFutureFromFutureDefaultCtor) | |
| TEST (SemiFuture, MakeSemiFutureFromFutureWithUnit) | |
| TEST (SemiFuture, MakeSemiFutureFromFutureWithValue) | |
| TEST (SemiFuture, MakeSemiFutureFromReadyFuture) | |
| TEST (SemiFuture, MakeSemiFutureFromNotReadyFuture) | |
| TEST (SemiFuture, MakeFutureFromSemiFuture) | |
| TEST (SemiFuture, MakeFutureFromSemiFutureReturnFuture) | |
| TEST (SemiFuture, MakeFutureFromSemiFutureReturnSemiFuture) | |
| TEST (SemiFuture, MakeFutureFromSemiFutureLValue) | |
| TEST (SemiFuture, SimpleGet) | |
| TEST (SemiFuture, SimpleGetTry) | |
| TEST (SemiFuture, SimpleTimedGet) | |
| TEST (SemiFuture, SimpleTimedGetViaFromSemiFuture) | |
| TEST (SemiFuture, SimpleTimedGetTry) | |
| TEST (SemiFuture, SimpleTimedGetTryViaFromSemiFuture) | |
| TEST (SemiFuture, SimpleValue) | |
| TEST (SemiFuture, SimpleValueThrow) | |
| TEST (SemiFuture, SimpleResult) | |
| TEST (SemiFuture, SimpleResultThrow) | |
| TEST (SemiFuture, SimpleDefer) | |
| TEST (SemiFuture, DeferWithDelayedSetValue) | |
| TEST (SemiFuture, DeferWithViaAndDelayedSetValue) | |
| TEST (SemiFuture, DeferWithGetTimedGet) | |
| TEST (SemiFuture, DeferWithVia) | |
| TEST (SemiFuture, ChainingDefertoThen) | |
| TEST (SemiFuture, SimpleDeferWithValue) | |
| TEST (SemiFuture, SimpleDeferWithValueFunctionReference) | |
| TEST (SemiFuture, ChainingDefertoThenWithValue) | |
| TEST (SemiFuture, MakeSemiFutureFromFutureWithTry) | |
| TEST (SemiFuture, DeferWithinContinuation) | |
| TEST (SemiFuture, onError) | |
| TEST (SemiFuture, makePromiseContract) | |
| TEST (SemiFuture, invokeCallbackWithOriginalCVRef) | |
| TEST (SemiFuture, semiFutureWithinCtxCleanedUpWhenTaskFinishedInTime) | |
| TEST (SemiFuture, semiFutureWithinNoValueReferenceWhenTimeOut) | |
| TEST (SemiFuture, collectAllSemiFutureDeferredWork) | |
| TEST (SemiFuture, DeferWithNestedSemiFuture) | |
Variables | |
| static eggs_t | eggs ("eggs") |
| #define DOIT | ( | CREATION_EXPR | ) |
Referenced by TEST().
| #define DOIT | ( | CREATION_EXPR | ) |
| #define DOIT | ( | STMT | ) |
| #define DOIT | ( | STMT | ) |
| #define DOIT | ( | STMT | ) |
| #define DOIT | ( | CTOR, | |
| STMT | |||
| ) |
| #define EXPECT_FLAG | ( | ) |
Referenced by TEST().
| #define EXPECT_NO_FLAG | ( | ) |
Referenced by TEST().
Definition at line 37 of file SemiFutureTest.cpp.
Referenced by TEST().
| typedef FutureException eggs_t |
Definition at line 39 of file SemiFutureTest.cpp.
| TEST | ( | SemiFuture | , |
| makeEmpty | |||
| ) |
Definition at line 44 of file SemiFutureTest.cpp.
References EXPECT_THROW, f, and folly::SemiFuture< T >::makeEmpty().
| TEST | ( | SemiFuture | , |
| futureDefaultCtor | |||
| ) |
Definition at line 49 of file SemiFutureTest.cpp.
| TEST | ( | SemiFuture | , |
| makeSemiFutureWithUnit | |||
| ) |
Definition at line 53 of file SemiFutureTest.cpp.
References count, EXPECT_EQ, EXPECT_FALSE, EXPECT_TRUE, folly::SemiFuture< T >::makeEmpty(), and folly::makeSemiFutureWith().
| TEST | ( | SemiFuture | , |
| ctorPostconditionValid | |||
| ) |
Definition at line 72 of file SemiFutureTest.cpp.
References DOIT, and folly::makeSemiFuture().
| TEST | ( | SemiFuture | , |
| ctorPostconditionInvalid | |||
| ) |
Definition at line 106 of file SemiFutureTest.cpp.
References DOIT.
| TEST | ( | SemiFuture | , |
| lacksPreconditionValid | |||
| ) |
Definition at line 124 of file SemiFutureTest.cpp.
References folly::copy(), DOIT, f, and folly::gen::move.
| TEST | ( | SemiFuture | , |
| hasPreconditionValid | |||
| ) |
Definition at line 157 of file SemiFutureTest.cpp.
References DOIT, f, and folly::gen::move.
| TEST | ( | SemiFuture | , |
| hasPostconditionValid | |||
| ) |
Definition at line 179 of file SemiFutureTest.cpp.
References DOIT, f, and folly::gen::move.
| TEST | ( | SemiFuture | , |
| hasPostconditionInvalid | |||
| ) |
Definition at line 205 of file SemiFutureTest.cpp.
References DOIT, f, folly::gen::move, and folly::detail::distributed_mutex::wait().
| TEST | ( | SemiFuture | , |
| special | |||
| ) |
Definition at line 266 of file SemiFutureTest.cpp.
References EXPECT_FALSE, EXPECT_TRUE, and folly::value().
| TEST | ( | SemiFuture | , |
| value | |||
| ) |
Definition at line 273 of file SemiFutureTest.cpp.
References eggs, EXPECT_EQ, EXPECT_THROW, EXPECT_TYPE, f, folly::makeSemiFuture(), folly::gen::move, and folly::value().
| TEST | ( | SemiFuture | , |
| hasException | |||
| ) |
Definition at line 286 of file SemiFutureTest.cpp.
References eggs, EXPECT_FALSE, EXPECT_TRUE, and folly::makeSemiFuture().
| TEST | ( | SemiFuture | , |
| hasValue | |||
| ) |
Definition at line 291 of file SemiFutureTest.cpp.
References eggs, EXPECT_FALSE, EXPECT_TRUE, and folly::makeSemiFuture().
| TEST | ( | SemiFuture | , |
| makeSemiFuture | |||
| ) |
Definition at line 296 of file SemiFutureTest.cpp.
References eggs, EXPECT_EQ, EXPECT_NO_THROW, EXPECT_THROW, EXPECT_TYPE, fun(), folly::makeSemiFuture(), folly::makeSemiFutureWith(), and folly::value().
| TEST | ( | SemiFuture | , |
| Constructor | |||
| ) |
Definition at line 328 of file SemiFutureTest.cpp.
References EXPECT_EQ, EXPECT_NO_THROW, and folly::futures::detail::FutureBase< T >::value().
| TEST | ( | SemiFuture | , |
| ImplicitConstructor | |||
| ) |
Definition at line 335 of file SemiFutureTest.cpp.
References EXPECT_EQ.
| TEST | ( | SemiFuture | , |
| InPlaceConstructor | |||
| ) |
Definition at line 340 of file SemiFutureTest.cpp.
References EXPECT_EQ, f, and folly::in_place().
| TEST | ( | SemiFuture | , |
| makeSemiFutureNoThrow | |||
| ) |
Definition at line 345 of file SemiFutureTest.cpp.
References folly::makeSemiFuture().
| TEST | ( | SemiFuture | , |
| ViaThrowOnNull | |||
| ) |
Definition at line 349 of file SemiFutureTest.cpp.
References EXPECT_THROW, folly::makeSemiFuture(), and folly::via().
| TEST | ( | SemiFuture | , |
| ConstructSemiFutureFromEmptyFuture | |||
| ) |
Definition at line 353 of file SemiFutureTest.cpp.
References EXPECT_THROW, f, and folly::Future< T >::makeEmpty().
| TEST | ( | SemiFuture | , |
| ConstructSemiFutureFromFutureDefaultCtor | |||
| ) |
Definition at line 358 of file SemiFutureTest.cpp.
| TEST | ( | SemiFuture | , |
| MakeSemiFutureFromFutureWithUnit | |||
| ) |
Definition at line 362 of file SemiFutureTest.cpp.
References count, EXPECT_EQ, and folly::makeFutureWith().
| TEST | ( | SemiFuture | , |
| MakeSemiFutureFromFutureWithValue | |||
| ) |
Definition at line 368 of file SemiFutureTest.cpp.
References EXPECT_EQ, f, folly::makeFuture(), and folly::gen::move.
| TEST | ( | SemiFuture | , |
| MakeSemiFutureFromReadyFuture | |||
| ) |
Definition at line 375 of file SemiFutureTest.cpp.
References EXPECT_FALSE, EXPECT_TRUE, f, folly::Promise< T >::getSemiFuture(), and folly::Promise< T >::setValue().
| TEST | ( | SemiFuture | , |
| MakeSemiFutureFromNotReadyFuture | |||
| ) |
Definition at line 383 of file SemiFutureTest.cpp.
References EXPECT_THROW, f, and folly::Promise< T >::getSemiFuture().
| TEST | ( | SemiFuture | , |
| MakeFutureFromSemiFuture | |||
| ) |
Definition at line 389 of file SemiFutureTest.cpp.
References ASSERT_EQ, EXPECT_EQ, EXPECT_FALSE, EXPECT_TRUE, f, folly::Promise< T >::getSemiFuture(), folly::EventBase::loopOnce(), folly::gen::move, folly::Promise< T >::setValue(), and folly::value().
| TEST | ( | SemiFuture | , |
| MakeFutureFromSemiFutureReturnFuture | |||
| ) |
Definition at line 408 of file SemiFutureTest.cpp.
References ASSERT_EQ, EXPECT_EQ, EXPECT_FALSE, EXPECT_TRUE, f, folly::Promise< T >::getSemiFuture(), folly::EventBase::loopOnce(), folly::makeFuture(), folly::gen::move, folly::Promise< T >::setValue(), and folly::value().
| TEST | ( | SemiFuture | , |
| MakeFutureFromSemiFutureReturnSemiFuture | |||
| ) |
Definition at line 427 of file SemiFutureTest.cpp.
References ASSERT_EQ, EXPECT_EQ, EXPECT_FALSE, EXPECT_TRUE, f, folly::Promise< T >::getSemiFuture(), folly::EventBase::loopOnce(), folly::makeSemiFuture(), folly::gen::move, folly::Promise< T >::setValue(), and folly::value().
| TEST | ( | SemiFuture | , |
| MakeFutureFromSemiFutureLValue | |||
| ) |
Definition at line 452 of file SemiFutureTest.cpp.
References ASSERT_EQ, EXPECT_EQ, EXPECT_FALSE, EXPECT_TRUE, f, folly::Promise< T >::getSemiFuture(), folly::EventBase::loopOnce(), folly::gen::move, folly::Promise< T >::setValue(), and folly::value().
| TEST | ( | SemiFuture | , |
| SimpleGet | |||
| ) |
Definition at line 471 of file SemiFutureTest.cpp.
References ASSERT_EQ, folly::Promise< T >::getSemiFuture(), folly::gen::move, and folly::Promise< T >::setValue().
| TEST | ( | SemiFuture | , |
| SimpleGetTry | |||
| ) |
Definition at line 480 of file SemiFutureTest.cpp.
References ASSERT_EQ, folly::Promise< T >::getSemiFuture(), folly::gen::move, and folly::Promise< T >::setValue().
| TEST | ( | SemiFuture | , |
| SimpleTimedGet | |||
| ) |
Definition at line 489 of file SemiFutureTest.cpp.
References EXPECT_THROW, folly::Promise< T >::getSemiFuture(), and folly::gen::move.
| TEST | ( | SemiFuture | , |
| SimpleTimedGetViaFromSemiFuture | |||
| ) |
Definition at line 496 of file SemiFutureTest.cpp.
References EXPECT_THROW, folly::Promise< T >::getSemiFuture(), folly::gen::move, and folly::via().
| TEST | ( | SemiFuture | , |
| SimpleTimedGetTry | |||
| ) |
Definition at line 505 of file SemiFutureTest.cpp.
References EXPECT_THROW, folly::Promise< T >::getSemiFuture(), and folly::gen::move.
| TEST | ( | SemiFuture | , |
| SimpleTimedGetTryViaFromSemiFuture | |||
| ) |
Definition at line 512 of file SemiFutureTest.cpp.
References EXPECT_THROW, folly::Promise< T >::getSemiFuture(), folly::gen::move, and folly::via().
| TEST | ( | SemiFuture | , |
| SimpleValue | |||
| ) |
Definition at line 521 of file SemiFutureTest.cpp.
References ASSERT_EQ, folly::Promise< T >::getSemiFuture(), folly::gen::move, and folly::Promise< T >::setValue().
| TEST | ( | SemiFuture | , |
| SimpleValueThrow | |||
| ) |
Definition at line 529 of file SemiFutureTest.cpp.
References EXPECT_THROW, folly::Promise< T >::getSemiFuture(), folly::gen::move, and folly::value().
| TEST | ( | SemiFuture | , |
| SimpleResult | |||
| ) |
Definition at line 535 of file SemiFutureTest.cpp.
References ASSERT_EQ, folly::Promise< T >::getSemiFuture(), folly::gen::move, and folly::Promise< T >::setValue().
| TEST | ( | SemiFuture | , |
| SimpleResultThrow | |||
| ) |
Definition at line 544 of file SemiFutureTest.cpp.
References EXPECT_THROW, folly::Promise< T >::getSemiFuture(), and folly::gen::move.
| TEST | ( | SemiFuture | , |
| SimpleDefer | |||
| ) |
Definition at line 551 of file SemiFutureTest.cpp.
References ASSERT_EQ, f, folly::Promise< T >::getSemiFuture(), folly::gen::move, and folly::Promise< T >::setValue().
| TEST | ( | SemiFuture | , |
| DeferWithDelayedSetValue | |||
| ) |
Definition at line 562 of file SemiFutureTest.cpp.
References ASSERT_EQ, folly::async(), f, folly::Promise< T >::getSemiFuture(), folly::gen::move, and folly::Promise< T >::setValue().
| TEST | ( | SemiFuture | , |
| DeferWithViaAndDelayedSetValue | |||
| ) |
Definition at line 582 of file SemiFutureTest.cpp.
References ASSERT_EQ, folly::async(), f, folly::Promise< T >::getSemiFuture(), folly::EventBase::loopForever(), folly::gen::move, folly::Promise< T >::setValue(), folly::pushmi::detail::t, folly::EventBase::terminateLoopSoon(), and folly::via().
| TEST | ( | SemiFuture | , |
| DeferWithGetTimedGet | |||
| ) |
Definition at line 603 of file SemiFutureTest.cpp.
References ASSERT_EQ, EXPECT_THROW, f, folly::Promise< T >::getSemiFuture(), and folly::gen::move.
| TEST | ( | SemiFuture | , |
| DeferWithVia | |||
| ) |
Definition at line 613 of file SemiFutureTest.cpp.
References ASSERT_EQ, f, folly::Promise< T >::getSemiFuture(), folly::gen::move, and folly::Promise< T >::setValue().
| TEST | ( | SemiFuture | , |
| ChainingDefertoThen | |||
| ) |
Definition at line 626 of file SemiFutureTest.cpp.
References ASSERT_EQ, f, folly::Promise< T >::getSemiFuture(), folly::gen::move, and folly::Promise< T >::setValue().
| TEST | ( | SemiFuture | , |
| SimpleDeferWithValue | |||
| ) |
Definition at line 641 of file SemiFutureTest.cpp.
References a, ASSERT_EQ, f, folly::Promise< T >::getSemiFuture(), folly::gen::move, and folly::Promise< T >::setValue().
| TEST | ( | SemiFuture | , |
| SimpleDeferWithValueFunctionReference | |||
| ) |
Definition at line 658 of file SemiFutureTest.cpp.
References ASSERT_EQ, f, folly::Promise< T >::getSemiFuture(), folly::gen::move, and folly::Promise< T >::setValue().
| TEST | ( | SemiFuture | , |
| ChainingDefertoThenWithValue | |||
| ) |
Definition at line 667 of file SemiFutureTest.cpp.
References a, ASSERT_EQ, f, folly::Promise< T >::getSemiFuture(), folly::gen::move, and folly::Promise< T >::setValue().
| TEST | ( | SemiFuture | , |
| MakeSemiFutureFromFutureWithTry | |||
| ) |
Definition at line 685 of file SemiFutureTest.cpp.
References ASSERT_EQ, eggs, f, folly::Promise< T >::getSemiFuture(), folly::gen::move, folly::Promise< T >::setException(), folly::pushmi::detail::t, and folly::Try< T >::tryGetExceptionObject().
| TEST | ( | SemiFuture | , |
| DeferWithinContinuation | |||
| ) |
Definition at line 706 of file SemiFutureTest.cpp.
References ASSERT_EQ, f, folly::Promise< T >::getSemiFuture(), folly::gen::move, and folly::Promise< T >::setValue().
| TEST | ( | SemiFuture | , |
| onError | |||
| ) |
Definition at line 729 of file SemiFutureTest.cpp.
References eggs, EXPECT_EQ, EXPECT_FLAG, EXPECT_NO_FLAG, EXPECT_NO_THROW, EXPECT_THROW, f, flag, folly::makeSemiFuture(), and folly::gen::move.
| TEST | ( | SemiFuture | , |
| makePromiseContract | |||
| ) |
Definition at line 914 of file SemiFutureTest.cpp.
References testing::_, c, EXPECT_EQ, and folly::gen::move.
| TEST | ( | SemiFuture | , |
| invokeCallbackWithOriginalCVRef | |||
| ) |
Definition at line 921 of file SemiFutureTest.cpp.
References EXPECT_EQ, folly::foo, folly::value(), and folly::detail::distributed_mutex::wait().
| TEST | ( | SemiFuture | , |
| semiFutureWithinCtxCleanedUpWhenTaskFinishedInTime | |||
| ) |
Definition at line 945 of file SemiFutureTest.cpp.
References EXPECT_EQ, folly::Promise< T >::getSemiFuture(), and folly::Promise< T >::setValue().
| TEST | ( | SemiFuture | , |
| semiFutureWithinNoValueReferenceWhenTimeOut | |||
| ) |
Definition at line 967 of file SemiFutureTest.cpp.
References EXPECT_EQ, and folly::Promise< T >::getSemiFuture().
| TEST | ( | SemiFuture | , |
| collectAllSemiFutureDeferredWork | |||
| ) |
Definition at line 978 of file SemiFutureTest.cpp.
References folly::collectAllSemiFuture(), folly::pushmi::executor, EXPECT_EQ, EXPECT_TRUE, folly::Promise< T >::getSemiFuture(), folly::gen::guard(), folly::makeGuard(), folly::gen::move, folly::Promise< T >::setValue(), folly::value(), and x.
| TEST | ( | SemiFuture | , |
| DeferWithNestedSemiFuture | |||
| ) |
Definition at line 1053 of file SemiFutureTest.cpp.
References EXPECT_GE, EXPECT_TRUE, now(), folly::futures::sleep(), and start.