From 78dedd788a276f18201e1d5c827fb453bb1755a3 Mon Sep 17 00:00:00 2001 From: Mark de Wever Date: Sun, 7 Jul 2024 18:40:49 +0200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Mital Ashok --- .../sequences/vector/vector.capacity/shrink_to_fit.pass.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libcxx/test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp index d0bdf4fddc2251..a2f0900cf8110d 100644 --- a/libcxx/test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp @@ -85,7 +85,7 @@ struct increasing_allocator { if (allocation_amount < min_bytes) allocation_amount = min_bytes; min_bytes += 1000; - return {static_cast(::operator new(allocation_amount)), allocation_amount}; + return {static_cast(::operator new(allocation_amount)), allocation_amount/sizeof(T)}; } T* allocate(std::size_t n) { return allocate_at_least(n).ptr; } void deallocate(T* p, std::size_t) noexcept { ::operator delete(static_cast(p)); } @@ -103,7 +103,7 @@ void test_increasing_allocator() { assert(is_contiguous_container_asan_correct(v)); std::size_t capacity = v.capacity(); v.shrink_to_fit(); - assert(v.capacity() == capacity); + assert(v.capacity() <= capacity); assert(v.size() == 1); assert(is_contiguous_container_asan_correct(v)); }