/*
- * Copyright 2015 Facebook, Inc.
+ * Copyright 2015-present Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
-#include <gtest/gtest.h>
-
#include <folly/futures/Future.h>
#include <folly/futures/detail/Core.h>
+#include <folly/portability/GTest.h>
using namespace folly;
TEST(Core, size) {
+ static constexpr size_t lambdaBufSize = 8 * sizeof(void*);
+ struct Gold {
+ typename std::aligned_storage<lambdaBufSize>::type lambdaBuf_;
+ folly::Optional<Try<Unit>> result_;
+ std::function<void(Try<Unit>&&)> callback_;
+ futures::detail::FSM<futures::detail::State> fsm_;
+ std::atomic<unsigned char> attached_;
+ std::atomic<bool> active_;
+ std::atomic<bool> interruptHandlerSet_;
+ folly::MicroSpinLock interruptLock_;
+ folly::MicroSpinLock executorLock_;
+ int8_t priority_;
+ Executor* executor_;
+ std::shared_ptr<RequestContext> context_;
+ std::unique_ptr<exception_wrapper> interrupt_;
+ std::function<void(exception_wrapper const&)> interruptHandler_;
+ };
// If this number goes down, it's fine!
// If it goes up, please seek professional advice ;-)
- EXPECT_EQ(192, sizeof(detail::Core<Unit>));
+ EXPECT_GE(sizeof(Gold), sizeof(futures::detail::Core<Unit>));
}