Fix copyright lines
[folly.git] / folly / futures / test / CoreTest.cpp
index 4f7c99e9be04f68365b47c490a5fe531c4e478d9..cf0bf8b9528280769d8c1c2171fe6952da1c8745 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 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;
 
-// On android, we see a different way of memory alignment of this structure.
-// Adding some extra padding to make it pass.
-#ifdef __ANDROID_
-constexpr size_t extraPadding = 8;
-#else
-constexpr size_t extraPadding = 0;
-#endif
-
 TEST(Core, size) {
+  static constexpr size_t lambdaBufSize = 8 * sizeof(void*);
   struct Gold {
-    char lambdaBuf_[8 * sizeof(void*)];
+    typename std::aligned_storage<lambdaBufSize>::type lambdaBuf_;
     folly::Optional<Try<Unit>> result_;
     std::function<void(Try<Unit>&&)> callback_;
-    detail::FSM<detail::State> fsm_;
+    futures::detail::FSM<futures::detail::State> fsm_;
     std::atomic<unsigned char> attached_;
     std::atomic<bool> active_;
     std::atomic<bool> interruptHandlerSet_;
@@ -48,5 +40,5 @@ TEST(Core, size) {
   };
   // If this number goes down, it's fine!
   // If it goes up, please seek professional advice ;-)
-  EXPECT_GE(sizeof(Gold) + extraPadding, sizeof(detail::Core<Unit>));
+  EXPECT_GE(sizeof(Gold), sizeof(futures::detail::Core<Unit>));
 }