2017
[folly.git] / folly / test / SparseByteSetTest.cpp
index bf92d13fb5e1357a35e564da5217767f9f8e0525..76f489677e643e9f5a620a305eea6674e5bf9d3e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2017 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 <folly/SparseByteSet.h>
+
 #include <cstdint>
 #include <limits>
 #include <random>
 #include <set>
-#include <folly/SparseByteSet.h>
-#include <gtest/gtest.h>
+
+#include <folly/portability/GTest.h>
 
 using namespace std;
 using namespace folly;
@@ -53,10 +55,10 @@ TEST_F(SparseByteSetTest, each) {
 
 TEST_F(SparseByteSetTest, each_random) {
   mt19937 rng;
-  uniform_int_distribution<uint8_t> dist;
+  uniform_int_distribution<uint16_t> dist{lims::min(), lims::max()};
   set<uint8_t> added;
   while (added.size() <= lims::max()) {
-    auto c = dist(rng);
+    auto c = uint8_t(dist(rng));
     EXPECT_EQ(added.count(c), s.contains(c));
     EXPECT_EQ(!added.count(c), s.add(c));
     added.insert(c);