[libcxx-commits] [libcxx] [libc++][test] Add exception tests for vector capacity operations (PR #118141)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Dec 16 07:50:30 PST 2024
================
@@ -125,4 +219,43 @@ inline void check_new_delete_called() {
assert(globalMemCounter.aligned_new_array_called == globalMemCounter.aligned_delete_array_called);
}
+class Rnd {
+public:
+ static void initializeSeed(unsigned int seed = 12345) { std::srand(seed); }
+
+ static std::vector<int> getRandomIntegerInputs(std::size_t N) {
+ std::vector<int> v;
+ v.reserve(N);
+ for (std::size_t i = 0; i < N; ++i)
+ v.push_back(std::rand());
+ return v;
+ }
+
+ static std::vector<std::string> getRandomStringInputsWithLength(std::size_t N, std::size_t len) {
+ std::vector<std::string> v;
+ v.reserve(N);
+ for (std::size_t i = 0; i < N; ++i)
+ v.push_back(getRandomString(len));
+ return v;
+ }
+
+private:
+ static const char Letters[];
----------------
ldionne wrote:
```suggestion
static const std::array<char, N> Letters = {...};
```
That way you don't need `LetterSize`.
https://github.com/llvm/llvm-project/pull/118141
More information about the libcxx-commits
mailing list