Commit bba211d3 authored by Michael Lee's avatar Michael Lee Committed by Facebook Github Bot 3

Enclose global variables in an anonymous namespace.

Summary: This causes a symbol collision tests are compiled into a library.

Differential Revision: D2991357

fb-gh-sync-id: 912be0df42216004a07213d62b68ff3f4713beb0
shipit-source-id: 912be0df42216004a07213d62b68ff3f4713beb0
parent ad1f7851
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
using namespace std; using namespace std;
using namespace folly; using namespace folly;
namespace {
static const int seed = folly::randomNumberSeed(); static const int seed = folly::randomNumberSeed();
typedef boost::mt19937 RandomT; typedef boost::mt19937 RandomT;
static RandomT rng(seed); static RandomT rng(seed);
...@@ -73,6 +75,7 @@ std::list<char> RandomList(unsigned int maxSize) { ...@@ -73,6 +75,7 @@ std::list<char> RandomList(unsigned int maxSize) {
} }
return lst; return lst;
} }
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Tests begin here // Tests begin here
......
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
using namespace std; using namespace std;
using namespace folly; using namespace folly;
namespace {
auto static const seed = randomNumberSeed(); auto static const seed = randomNumberSeed();
typedef boost::mt19937 RandomT; typedef boost::mt19937 RandomT;
static RandomT rng(seed); static RandomT rng(seed);
...@@ -58,25 +60,11 @@ void Num2String(String& str, Integral /* n */) { ...@@ -58,25 +60,11 @@ void Num2String(String& str, Integral /* n */) {
str.resize(strlen(str.c_str())); 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<class T> T randomObject();
template<> int randomObject<int>() { template<> int randomObject<int>() {
return random(0, 1024); return random(0, 1024);
} }
template<> folly::fbstring randomObject<folly::fbstring>() {
folly::fbstring result;
randomString(&result);
return result;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment