Remove check that depends on malloc implementation.
authorPeter Griess <pgriess@fb.com>
Thu, 10 Oct 2013 17:51:28 +0000 (10:51 -0700)
committerSara Golemon <sgolemon@fb.com>
Thu, 24 Oct 2013 21:53:41 +0000 (14:53 -0700)
Summary:
- The EXPECT_EQ(vec.capacity(), vec2.capacity()) check is implicitly
testing how the platform's malloc() and malloc_usable_size()
implementations interact. We know that small_vector will attempt to
allocate storage for 3 elements via malloc(), but the small_vector
implementation then uses malloc_usable_size() to determine capacity,
which can return more than the size requested by malloc(). As a
result, capacity may grow more than expected depending on how the
malloc implementation works.

Test Plan:
- fbconfig -r folly && fbmake runtests
- ./configure && make check on Ubuntu/FC/Mac

Reviewed By: alandau@fb.com

FB internal diff: D1008922

folly/test/small_vector_test.cpp

index 3df4fb971e5f77e5a402aa9841d4c1e08ab6b338..1f059f47e52a38048042f0c71fd3dc1a8c97d276 100644 (file)
@@ -676,9 +676,6 @@ TEST(small_vector, Capacity) {
   EXPECT_EQ(vec2.size(), 3);
   EXPECT_GT(vec2.capacity(), 2);
 
-  // Both have grown by the minimum amount
-  EXPECT_EQ(vec.capacity(), vec2.capacity());
-
   // Test capacity heapifying logic
   folly::small_vector<unsigned char, 1> vec3;
   const size_t hc_size = 1000000;