|
| 1 | +# Inplace Vector Testing Suite |
| 2 | + |
| 3 | +This folder contains tests for `inplace_vector` implementation. |
| 4 | + |
| 5 | +The aim for the test cases are to keep the implementation in-check with its standing in the latest C++ draft. |
| 6 | + |
| 7 | +You can checkout `inplace_vector`'s current state in C++ draft [here](https://eel.is/c++draft/inplace.vector). |
| 8 | + |
| 9 | +## C++ Draft paragraph to test file |
| 10 | + |
| 11 | +`inplace_vector`'s chapter number in the latest C++ draft is **23.3.14**. |
| 12 | + |
| 13 | +### Overview (23.3.14.1) |
| 14 | + |
| 15 | +[Overview](https://eel.is/c++draft/inplace.vector#overview) has 6 clauses. |
| 16 | + |
| 17 | +#### 6.1 Overview |
| 18 | + |
| 19 | +> An inplace_vector is a contiguous container. Its capacity is fixed and its |
| 20 | +elements are stored within the inplace_vector object itself. |
| 21 | + |
| 22 | +This is not testable. |
| 23 | + |
| 24 | +#### 6.2 Container Requirements |
| 25 | + |
| 26 | +> An inplace_vector meets all of the requirements of a container ([container.reqmts]), |
| 27 | +> of a reversible container ([container.rev.reqmts]), of a contiguous container, |
| 28 | +> and of a sequence container, including most of the optional sequence |
| 29 | +container requirements ([sequence.reqmts]). The exceptions are the push_front, |
| 30 | +> prepend_range, pop_front, and emplace_front member functions, |
| 31 | +> which are not provided. |
| 32 | +> Descriptions are provided here only for operations on inplace_vector that |
| 33 | +> are not described in one of these tables or for operations where there is |
| 34 | +> additional semantic information. |
| 35 | +
|
| 36 | +See [container_requirements.test.cpp](container_requirements.test.cpp). |
| 37 | + |
| 38 | +#### 6.3 Constexpr Iterator |
| 39 | + |
| 40 | +> For any N, `inplace_vector<T, N>::iterator` and |
| 41 | +> `inplace_vector<T, N>::const_iterator` meet the constexpr iterator |
| 42 | +> requirements. |
| 43 | +
|
| 44 | +Not tested for now. |
| 45 | + |
| 46 | +#### 6.4 Constexpr member functions |
| 47 | + |
| 48 | +> For any $N>0$, if T is not trivially copyable or |
| 49 | +> `is_trivially_default_constructible_v<T>` is false, |
| 50 | +> then no `inplace_vector<T, N>` member functions are usable in |
| 51 | +> constant expressions. |
| 52 | +
|
| 53 | +Not tested for now. |
| 54 | + |
| 55 | +#### 6.5 Bad alloc requirement |
| 56 | + |
| 57 | +> Any member function of `inplace_vector<T, N>` that would cause the size to |
| 58 | +> exceed N throws an exception of type bad_alloc. |
| 59 | +
|
| 60 | +These are tested with individual functions. |
| 61 | + |
| 62 | +#### 6.6 Triviality |
| 63 | + |
| 64 | +Let IV denote a specialization of `inplace_vector<T, N>`. |
| 65 | +> If N is zero, then IV is trivially copyable and empty, |
| 66 | +> and std::is_trivially_default_constructible_v<IV> is true. |
| 67 | +> (Sub-clauses omitted) |
| 68 | +
|
| 69 | +See [triviality.test.cpp](triviality.test.cpp) |
| 70 | + |
| 71 | +### Constructors (23.3.14.2) |
| 72 | + |
| 73 | +See [constructors.test.cpp](constructors.test.cpp) |
| 74 | + |
| 75 | +### Size and capacity (23.3.14.3) |
| 76 | + |
| 77 | +See [size_n_data.test.cpp](size_n_data.test.cpp) |
| 78 | + |
| 79 | +### Data (23.3.14.4) |
| 80 | + |
| 81 | +See [size_n_data.test.cpp](size_n_data.test.cpp) |
| 82 | + |
| 83 | +### Modifiers (23.3.14.5) |
| 84 | + |
| 85 | +See [modifiers.test.cpp](modifiers.test.cpp) |
| 86 | + |
| 87 | +### Erasure (23.3.14.6) |
| 88 | + |
| 89 | +See [erasure.test.cpp](erasure.test.cpp) |
| 90 | + |
| 91 | +## Other tests |
| 92 | + |
| 93 | +- [ref_impl.test.cpp](ref_impl.test.cpp): |
| 94 | + Is the test suite imported from reference implementation in |
| 95 | + [P0843R14](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p0843r14.html). |
| 96 | + Originally included [here on godbolt](https://godbolt.org/z/5P78aG5xE). |
| 97 | +- [inplace_vector.test.cpp](inplace_vector.test.cpp): |
| 98 | + A minimal test suite by @Hels15 for their implementation. |
| 99 | + |
| 100 | +## Known Issues/ Missed Tests |
| 101 | + |
| 102 | +- Constexpr related functionalities. |
| 103 | +- Emplacement minimal copy/ construction. |
| 104 | +- Exception safety on mutation. |
| 105 | + |
| 106 | +## Special Thanks |
| 107 | + |
| 108 | +Special thanks to Jan Babst (@jbab) for his contribution at setting up the |
| 109 | +Google Test infrastructure. |
0 commit comments