]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: histogram prevent re-use of local variables
authorLoic Dachary <loic-201408@dachary.org>
Tue, 26 Aug 2014 19:59:39 +0000 (21:59 +0200)
committerLoic Dachary <ldachary@redhat.com>
Mon, 22 Dec 2014 21:54:19 +0000 (22:54 +0100)
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>
(cherry picked from commit ee02293ad2ef050672fa8c164ba17b10e8d4ceeb)

src/test/common/histogram.cc

index 2fd3cfec2a7af92f7d0d12f17cbca9f5bccb9fbb..2b54e6375133b7261410207972f7b6947bc0c46f 100644 (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) {