tests: histogram prevent re-use of local variables

By moving the test to a separate function.

http://tracker.ceph.com/issues/9235 Fixes: #9235

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
This commit is contained in:
Loic Dachary 2014-08-26 21:59:39 +02:00
parent 78cbe11513
commit ee02293ad2

View File

@ -93,15 +93,17 @@ TEST(Histogram, Position) {
ASSERT_EQ(500000u, lb);
ASSERT_EQ(500000u, ub);
}
{
pow2_hist_t h;
h.h.resize(10, 0);
h.h[0] = UINT_MAX;
h.h[5] = UINT_MAX;
uint64_t lb, ub;
ASSERT_EQ(500000u, lb);
ASSERT_EQ(500000u, ub);
}
}
TEST(Histogram, Position2) {
pow2_hist_t h;
h.h.resize(10, 0);
h.h[0] = UINT_MAX;
h.h[5] = UINT_MAX;
uint64_t lb, ub;
h.get_position_micro(4, &lb, &ub);
ASSERT_EQ(500000u, lb);
ASSERT_EQ(500000u, ub);
}
TEST(Histogram, Decay) {