summaryrefslogtreecommitdiff
path: root/libcxx/test/std/strings/basic.string/string.capacity/deallocate_size.pass.cpp
AgeCommit message (Collapse)Author
2025-10-31[libc++][test] Make `deallocate_size.pass.cpp` MSVC-friendly (#165162)A. Jiang
This patch contains several changes to `deallocate_size.pass.cpp`: 1. `static_cast`-ing some parameters to `size_t` to avoid narrowing. 2. Changing the type of loop variable `i` to `unsigned int` avoid signedness mismatch with the constructor parameter. 3. Separately counting allocations and deallocations in variables `allocated_` and `deallocated_`, and changing their type to `uint64_t`. 4. Avoiding `assert`-ing count of allocations when a `basic_string` is allocated, just `assert`-ing after destruction instead.
2024-10-30[libc++][test] Augment `test_alloc` in `deallocate_size.pass.cpp` (#113638)A. Jiang
Making it meet the requirements for allocator since C++11. Fixes #113609. This PR doesn't make it meet the C++03 allocator requirements, because that would make the type too verbose and libc++ has backported many C++11 features to the C++03 mode. Drive-by: Removes the `TEST_CONSTEXPR_CXX14` on `allocate`/`dealocate` which is never in effect (and causes IFNDR-ness before C++23), since these functions modify the namespace-scoped variable `allocated_`.
2024-09-30[libc++][string] Add regression test for sized new/delete bug (#110210)Vitaly Buka
This is regression test for #90292. Allocator used in test is very similar to test_allocator. However, reproducer requires size_type of the string to be 64bit, but test_allocator uses 32bit. 32bit size_type makes `sizeof(string::__long)` to be 16, but the alignment issue fixed with #90292 is only triggered with default `sizeof(string::__long)` which is 24. Fixes #92128. --------- Co-authored-by: Louis Dionne <ldionne.2@gmail.com>