Commit 507ab831 authored by Michael Lee's avatar Michael Lee Committed by Facebook Github Bot

Fix various shadowing warnings within tests

Summary: A lot of shadowed variables in tests. Simple renaming should suffice.

Reviewed By: yfeldblum

Differential Revision: D6786138

fbshipit-source-id: 22c1c4d7cac13b367ed534a3f1d20714150b39f9
parent 90866787
...@@ -379,12 +379,12 @@ TEST(ConcurrentHashMap, EraseStressTest) { ...@@ -379,12 +379,12 @@ TEST(ConcurrentHashMap, EraseStressTest) {
exit(0); exit(0);
} }
EXPECT_TRUE(res); EXPECT_TRUE(res);
auto res = m.find(k); auto result = m.find(k);
if (res == m.cend()) { if (result == m.cend()) {
printf("Thread %i lookup fail %li\n", t, k); printf("Thread %i lookup fail %li\n", t, k);
exit(0); exit(0);
} }
EXPECT_EQ(k, res->second); EXPECT_EQ(k, result->second);
} }
} }
})); }));
......
...@@ -366,10 +366,10 @@ TEST(FlatCombining, folly_benchmark) { ...@@ -366,10 +366,10 @@ TEST(FlatCombining, folly_benchmark) {
static uint64_t test( static uint64_t test(
std::string name, std::string name,
bool fc, bool fc_,
bool dedicated, bool dedicated_,
bool tc, bool tc_,
bool syncops, bool syncops_,
uint64_t base) { uint64_t base) {
uint64_t min = UINTMAX_MAX; uint64_t min = UINTMAX_MAX;
uint64_t max = 0; uint64_t max = 0;
...@@ -382,11 +382,11 @@ static uint64_t test( ...@@ -382,11 +382,11 @@ static uint64_t test(
FLAGS_numRecs, FLAGS_numRecs,
FLAGS_work, FLAGS_work,
FLAGS_ops, FLAGS_ops,
fc, fc_,
simple, simple,
dedicated, dedicated_,
tc, tc_,
syncops); syncops_);
sum += dur; sum += dur;
min = std::min(min, dur); min = std::min(min, dur);
max = std::max(max, dur); max = std::max(max, dur);
......
...@@ -1078,8 +1078,8 @@ TEST(Gen, Cycle) { ...@@ -1078,8 +1078,8 @@ TEST(Gen, Cycle) {
s | cycle | take(4) | as<vector>()); s | cycle | take(4) | as<vector>());
} }
{ {
int count = 3; int c = 3;
int* pcount = &count; int* pcount = &c;
auto countdown = GENERATOR(int) { auto countdown = GENERATOR(int) {
ASSERT_GE(*pcount, 0) ASSERT_GE(*pcount, 0)
<< "Cycle should have stopped when it didnt' get values!"; << "Cycle should have stopped when it didnt' get values!";
......
...@@ -496,12 +496,12 @@ TEST(BucketedTimeSeries, avgTypeConversion) { ...@@ -496,12 +496,12 @@ TEST(BucketedTimeSeries, avgTypeConversion) {
} }
TEST(BucketedTimeSeries, forEachBucket) { TEST(BucketedTimeSeries, forEachBucket) {
typedef BucketedTimeSeries<int64_t>::Bucket Bucket; typedef BucketedTimeSeries<int64_t>::Bucket BucketSeries;
struct BucketInfo { struct BucketInfo {
BucketInfo(const Bucket* b, TimePoint s, TimePoint ns) BucketInfo(const BucketSeries* b, TimePoint s, TimePoint ns)
: bucket(b), start(s), nextStart(ns) {} : bucket(b), start(s), nextStart(ns) {}
const Bucket* bucket; const BucketSeries* bucket;
TimePoint start; TimePoint start;
TimePoint nextStart; TimePoint nextStart;
}; };
...@@ -510,7 +510,7 @@ TEST(BucketedTimeSeries, forEachBucket) { ...@@ -510,7 +510,7 @@ TEST(BucketedTimeSeries, forEachBucket) {
BucketedTimeSeries<int64_t> ts(data.numBuckets, seconds(data.duration)); BucketedTimeSeries<int64_t> ts(data.numBuckets, seconds(data.duration));
vector<BucketInfo> info; vector<BucketInfo> info;
auto fn = [&](const Bucket& bucket, auto fn = [&](const BucketSeries& bucket,
TimePoint bucketStart, TimePoint bucketStart,
TimePoint bucketEnd) -> bool { TimePoint bucketEnd) -> bool {
info.emplace_back(&bucket, bucketStart, bucketEnd); info.emplace_back(&bucket, bucketStart, bucketEnd);
......
...@@ -27,8 +27,6 @@ using namespace folly; ...@@ -27,8 +27,6 @@ using namespace folly;
using namespace folly::test; using namespace folly::test;
using folly::detail::EmulatedFutexAtomic; using folly::detail::EmulatedFutexAtomic;
typedef DeterministicSchedule DSched;
BENCHMARK(baton_pingpong_blocking, iters) { BENCHMARK(baton_pingpong_blocking, iters) {
run_pingpong_test<true, std::atomic>(iters); run_pingpong_test<true, std::atomic>(iters);
} }
......
...@@ -772,10 +772,10 @@ TEST(Ahm, erase_after_insert_race) { ...@@ -772,10 +772,10 @@ TEST(Ahm, erase_after_insert_race) {
// Repro for a bug when iterator didn't skip empty submaps. // Repro for a bug when iterator didn't skip empty submaps.
TEST(Ahm, iterator_skips_empty_submaps) { TEST(Ahm, iterator_skips_empty_submaps) {
AtomicHashMap<uint64_t, uint64_t>::Config config; AtomicHashMap<uint64_t, uint64_t>::Config conf;
config.growthFactor = 1; conf.growthFactor = 1;
AtomicHashMap<uint64_t, uint64_t> map(1, config); AtomicHashMap<uint64_t, uint64_t> map(1, conf);
map.insert(1, 1); map.insert(1, 1);
map.insert(2, 2); map.insert(2, 2);
......
...@@ -338,7 +338,7 @@ TEST(Poly, NullablePointer) { ...@@ -338,7 +338,7 @@ TEST(Poly, NullablePointer) {
Poly<INullablePointer> r = 42; Poly<INullablePointer> r = 42;
Poly<INullablePointer&> s = r; Poly<INullablePointer&> s = r;
static_assert(!poly_empty(s), ""); static_assert(!poly_empty(s), "");
EXPECT_THROW(Poly<INullablePointer&> r(q), BadPolyAccess); EXPECT_THROW(Poly<INullablePointer&> r_(q), BadPolyAccess);
} }
namespace { namespace {
......
...@@ -103,12 +103,12 @@ void initDelims(int len) { ...@@ -103,12 +103,12 @@ void initDelims(int len) {
if (n == 8) { if (n == 8) {
n = 32; n = 32;
} }
auto s = generateString(n); auto s_ = generateString(n);
if (rnd() % 2) { if (rnd() % 2) {
// ~half of tests will find a hit // ~half of tests will find a hit
s[rnd() % s.size()] = 'a'; // yes, this could mean 'a' is a duplicate s_[rnd() % s_.size()] = 'a'; // yes, this could mean 'a' is a duplicate
} }
ffoDelim.push_back(s); ffoDelim.push_back(s_);
} }
} }
......
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