File tree Expand file tree Collapse file tree 3 files changed +28
-5
lines changed
tests/beman/inplace_vector Expand file tree Collapse file tree 3 files changed +28
-5
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ add_gtest(triviality)
3838add_gtest(compare)
3939add_gtest(constructors)
4040add_gtest(size_n_data)
41- # add_gtest(erasure)
41+ add_gtest(erasure)
4242# add_gtest(modifiers)
4343
4444if(BEMAN_INPLACE_VECTOR_FREESTANDING_DELETED)
Original file line number Diff line number Diff line change @@ -30,9 +30,9 @@ TYPED_TEST(Erasure, ByValue) {
3030 auto uniques = this ->unique (device.capacity () / 2 );
3131
3232 for (auto i = 0ul ; i < uniques.size (); ++i) {
33- device.push_back (uniques[i]);
33+ device.unchecked_push_back (uniques[i]);
3434 if (device.size () != device.capacity ())
35- device.push_back (duplicates);
35+ device.unchecked_push_back (duplicates);
3636 }
3737
3838 beman::erase (device, duplicates);
@@ -57,7 +57,7 @@ TYPED_TEST(Erasure, ByPred) {
5757 return ;
5858
5959 for (auto i = 0 ; i < static_cast <int >(device.capacity ()); ++i)
60- device.push_back (T{i});
60+ device.unchecked_push_back (T{i});
6161
6262 beman::erase_if (device,
6363 [&](auto &v) { return v.value > (device.capacity () / 2 ); });
Original file line number Diff line number Diff line change @@ -353,9 +353,10 @@ template <typename Param> class IVBasicTest : public ::testing::Test {
353353
354354 // Implements inplace_vector's freestanding constructors for convenience
355355 // testing in a freestanding context
356+
356357 static X vec_of (std::size_t size) {
357358#if !BEMAN_INPLACE_VECTOR_FREESTANDING_DELETED()
358- return IV (size);
359+ return X (size);
359360#else
360361 X vec;
361362 for (auto i = 0 ; i < size; ++i)
@@ -364,6 +365,28 @@ template <typename Param> class IVBasicTest : public ::testing::Test {
364365#endif
365366 }
366367
368+ static X vec_of (std::initializer_list<T> &&il) {
369+ #if !BEMAN_INPLACE_VECTOR_FREESTANDING_DELETED()
370+ return X (il);
371+ #else
372+ X vec;
373+ for (auto &ele : il)
374+ vec.unchecked_push_back (ele);
375+ return vec;
376+ #endif
377+ }
378+
379+ template <typename Itr> static X vec_of (Itr begin, Itr end) {
380+ #if !BEMAN_INPLACE_VECTOR_FREESTANDING_DELETED()
381+ return X (begin, end);
382+ #else
383+ X vec;
384+ for (auto itr = begin; itr != end; ++itr)
385+ vec.unchecked_push_back (*itr);
386+ return vec;
387+ #endif
388+ }
389+
367390 // Returns IV of size n with unique values
368391 static IV unique (typename IV::size_type n = IV::max_size()) {
369392 static T val = T{};
You can’t perform that action at this time.
0 commit comments