Fix copyright lines
[folly.git] / folly / futures / test / WaitTest.cpp
index b2736f12a74d398cf6d306e1007324809697d193..7e3cdf34477a96c84c419b26a01e08c886256f2f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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 <queue>
 
 #include <folly/futures/Future.h>
 #include <folly/io/async/EventBase.h>
-#include <folly/Baton.h>
+#include <folly/portability/GTest.h>
+#include <folly/synchronization/Baton.h>
 
 using namespace folly;
 using std::vector;
@@ -195,3 +196,16 @@ TEST(Wait, waitWithDuration) {
    t.join();
  }
 }
+
+TEST(Wait, multipleWait) {
+  auto f = futures::sleep(milliseconds(100));
+  for (size_t i = 0; i < 5; ++i) {
+    EXPECT_FALSE(f.isReady());
+    f.wait(milliseconds(3));
+  }
+  EXPECT_FALSE(f.isReady());
+  f.wait();
+  EXPECT_TRUE(f.isReady());
+  f.wait();
+  EXPECT_TRUE(f.isReady());
+}