Enclose global variables in an anonymous namespace.
authorMichael Lee <mzlee@fb.com>
Tue, 1 Mar 2016 20:09:28 +0000 (12:09 -0800)
committerFacebook Github Bot 3 <facebook-github-bot-3-bot@fb.com>
Tue, 1 Mar 2016 20:20:29 +0000 (12:20 -0800)
Summary: This causes a symbol collision tests are compiled into a library.

Differential Revision: D2991357

fb-gh-sync-id: 912be0df42216004a07213d62b68ff3f4713beb0
shipit-source-id: 912be0df42216004a07213d62b68ff3f4713beb0

folly/test/FBStringTest.cpp
folly/test/FBVectorTest.cpp

index cfc577282cd877b55b211d46f44d3cb05cb3cbf0..34858238839fd65eac72dfffdc81be893d7addf9 100644 (file)
@@ -37,6 +37,8 @@
 using namespace std;
 using namespace folly;
 
+namespace {
+
 static const int seed = folly::randomNumberSeed();
 typedef boost::mt19937 RandomT;
 static RandomT rng(seed);
@@ -73,6 +75,7 @@ std::list<char> RandomList(unsigned int maxSize) {
  }
   return lst;
 }
+}
 
 ////////////////////////////////////////////////////////////////////////////////
 // Tests begin here
index ce4fa978bdcda3041d07e76be8766845c8d41334..33a164a004efe0379dd05ef1c78f570c7556c8c4 100644 (file)
@@ -32,6 +32,8 @@
 using namespace std;
 using namespace folly;
 
+namespace {
+
 auto static const seed = randomNumberSeed();
 typedef boost::mt19937 RandomT;
 static RandomT rng(seed);
@@ -58,25 +60,11 @@ void Num2String(String& str, Integral /* n */) {
   str.resize(strlen(str.c_str()));
 }
 
-std::list<char> RandomList(unsigned int maxSize) {
-  std::list<char> lst(random(0u, maxSize));
-  std::list<char>::iterator i = lst.begin();
-  for (; i != lst.end(); ++i) {
-    *i = random('a', 'z');
-  }
-  return lst;
-}
-
 template<class T> T randomObject();
 
 template<> int randomObject<int>() {
   return random(0, 1024);
 }
-
-template<> folly::fbstring randomObject<folly::fbstring>() {
-  folly::fbstring result;
-  randomString(&result);
-  return result;
 }
 
 ////////////////////////////////////////////////////////////////////////////////