Revert D6050464: [Folly] Move folly/Hash.h to folly/hash/
[folly.git] / folly / test / AtomicHashArrayTest.cpp
index 92be30da9ae2fcfb9dfb17e53e308a644a2c348d..780076a1abcd402d1caaf600463814bebedb6069 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.
@@ -22,8 +22,8 @@
 #include <folly/Conv.h>
 #include <folly/Hash.h>
 #include <folly/Memory.h>
+#include <folly/portability/GTest.h>
 #include <folly/portability/SysMman.h>
-#include <gtest/gtest.h>
 
 using namespace std;
 using namespace folly;
@@ -73,7 +73,7 @@ class MmapAllocator {
 
   T *allocate(size_t n) {
     void *p = mmap(nullptr, n * sizeof(T), PROT_READ | PROT_WRITE,
-        MAP_SHARED | MAP_ANONYMOUS, -1, 0);
+        MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
     if (p == MAP_FAILED) throw std::bad_alloc();
     return (T *)p;
   }
@@ -83,16 +83,17 @@ class MmapAllocator {
   }
 };
 
-template<class KeyT, class ValueT>
+template <class KeyT, class ValueT>
 pair<KeyT,ValueT> createEntry(int i) {
   return pair<KeyT,ValueT>(to<KeyT>(folly::hash::jenkins_rev_mix32(i) % 1000),
                            to<ValueT>(i + 3));
 }
 
-template <class KeyT,
-          class ValueT,
-          class Allocator = std::allocator<char>,
-          class ProbeFcn = AtomicHashArrayLinearProbeFcn>
+template <
+    class KeyT,
+    class ValueT,
+    class Allocator = std::allocator<char>,
+    class ProbeFcn = AtomicHashArrayLinearProbeFcn>
 void testMap() {
   typedef AtomicHashArray<KeyT, ValueT, std::hash<KeyT>,
                           std::equal_to<KeyT>, Allocator, ProbeFcn> MyArr;
@@ -140,7 +141,9 @@ void testMap() {
   }
 }
 
-template<class KeyT, class ValueT,
+template <
+    class KeyT,
+    class ValueT,
     class Allocator = std::allocator<char>,
     class ProbeFcn = AtomicHashArrayLinearProbeFcn>
 void testNoncopyableMap() {