From bba211d3a5146d67a661639b4d99947fbd1e87ff Mon Sep 17 00:00:00 2001 From: Michael Lee Date: Tue, 1 Mar 2016 12:09:28 -0800 Subject: [PATCH] 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 --- folly/test/FBStringTest.cpp | 3 +++ folly/test/FBVectorTest.cpp | 16 ++-------------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/folly/test/FBStringTest.cpp b/folly/test/FBStringTest.cpp index cfc57728..34858238 100644 --- a/folly/test/FBStringTest.cpp +++ b/folly/test/FBStringTest.cpp @@ -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 RandomList(unsigned int maxSize) { } return lst; } +} //////////////////////////////////////////////////////////////////////////////// // Tests begin here diff --git a/folly/test/FBVectorTest.cpp b/folly/test/FBVectorTest.cpp index ce4fa978..33a164a0 100644 --- a/folly/test/FBVectorTest.cpp +++ b/folly/test/FBVectorTest.cpp @@ -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 RandomList(unsigned int maxSize) { - std::list lst(random(0u, maxSize)); - std::list::iterator i = lst.begin(); - for (; i != lst.end(); ++i) { - *i = random('a', 'z'); - } - return lst; -} - template T randomObject(); template<> int randomObject() { return random(0, 1024); } - -template<> folly::fbstring randomObject() { - folly::fbstring result; - randomString(&result); - return result; } //////////////////////////////////////////////////////////////////////////////// -- 2.34.1