Skip to content

Commit dc35d0b

Browse files
committed
expand test structure
1 parent 1897df8 commit dc35d0b

File tree

1 file changed

+198
-3
lines changed

1 file changed

+198
-3
lines changed

tests/beman/inplace_vector/spec.test2.experimental.cpp

Lines changed: 198 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,13 +1113,208 @@ TYPED_TEST(Constructors, CopyRanges) {
11131113
// TODO
11141114

11151115
// 23.3.14.4 Data [inplace.vector.data]
1116-
// TODO
1116+
1117+
template <typename Param> class Data : public BasicTest<Param> {};
1118+
TYPED_TEST_SUITE(Data, AllTypes);
1119+
1120+
TYPED_TEST(Data, Test) {
1121+
// constexpr T* data() noexcept;
1122+
// constexpr const T* data() const noexcept;
1123+
//
1124+
// Returns: A pointer such that [data(), data() + size()) is a valid range.
1125+
// For a non-empty inplace_vector, data() == addressof(front()) is true.
1126+
// Complexity: Constant time.
1127+
1128+
// TODO
1129+
GTEST_SKIP();
1130+
}
11171131

11181132
// 23.3.14.5 Modifiers [inplace.vector.modifiers]
1119-
// TODO
1133+
template <typename Param> class Modifiers : public BasicTest<Param> {};
1134+
TYPED_TEST_SUITE(Modifiers, AllTypes);
1135+
1136+
TYPED_TEST(Modifiers, Insert) {
1137+
// constexpr iterator insert(const_iterator position, const T& x);
1138+
// constexpr iterator insert(const_iterator position, T&& x);
1139+
// constexpr iterator insert(const_iterator position, size_type n, const T&
1140+
// x);
1141+
// template<class InputIterator>
1142+
// constexpr iterator insert(const_iterator position, InputIterator first,
1143+
// InputIterator last);
1144+
// template<container-compatible-range<T> R>
1145+
// constexpr iterator insert_range(const_iterator position, R&& rg);
1146+
// constexpr iterator insert(const_iterator position, initializer_list<T> il);
1147+
// template<class... Args>
1148+
// constexpr iterator emplace(const_iterator position, Args&&... args);
1149+
// template<container-compatible-range<T> R>
1150+
// constexpr void append_range(R&& rg);
1151+
//
1152+
// Let n be the value of size() before this call for the append_range
1153+
// overload, and distance(begin, position) otherwise.
1154+
// Complexity: Linear in the number of elements inserted plus the distance
1155+
// to the end of the vector.
1156+
// Remarks: If an exception is thrown other than by the copy constructor,
1157+
// move constructor, assignment operator, or move assignment operator of T or
1158+
// by any InputIterator operation, there are no effects. Otherwise, if an
1159+
// exception is thrown, then size()  ≥ n and elements in the range begin() +
1160+
// [0, n) are not modified.
1161+
1162+
// TODO
1163+
GTEST_SKIP();
1164+
}
1165+
1166+
TYPED_TEST(Modifiers, PushBack) {
1167+
// constexpr reference push_back(const T& x);
1168+
// constexpr reference push_back(T&& x);
1169+
// template<class... Args>
1170+
// constexpr reference emplace_back(Args&&... args);
1171+
//
1172+
// Returns: back().
1173+
// Throws: bad_alloc or any exception thrown by the initialization of the
1174+
// inserted element.
1175+
// Complexity: Constant.
1176+
// Remarks: If an exception is thrown, there are no effects on *this.
1177+
1178+
// TODO
1179+
GTEST_SKIP();
1180+
}
1181+
1182+
TYPED_TEST(Modifiers, TryPushBack) {
1183+
// template<class... Args>
1184+
// constexpr pointer try_emplace_back(Args&&... args);
1185+
// constexpr pointer try_push_back(const T& x);
1186+
// constexpr pointer try_push_back(T&& x);
1187+
//
1188+
// Let vals denote a pack:
1189+
// (8.1) std::forward<Args>(args)... for the first overload,
1190+
// (8.2) x for the second overload,
1191+
// (8.3) std::move(x) for the third overload.
1192+
//
1193+
// Preconditions: value_type is Cpp17EmplaceConstructible into inplace_vector
1194+
// from vals....
1195+
// Effects: If size() < capacity() is true, appends an object of type T
1196+
// direct-non-list-initialized with vals.... Otherwise, there are no effects.
1197+
// Returns: nullptr if size() == capacity() is true, otherwise
1198+
// addressof(back()).
1199+
// Throws: Nothing unless an exception is thrown by the initialization of the
1200+
// inserted element.
1201+
// Complexity: Constant.
1202+
// Remarks: If an exception is thrown, there are no effects on *this.
1203+
1204+
// TODO
1205+
GTEST_SKIP();
1206+
}
1207+
1208+
TYPED_TEST(Modifiers, TryAppendRanges) {
1209+
// template<container-compatible-range<T> R>
1210+
// constexpr ranges::borrowed_iterator_t<R> try_append_range(R&& rg);
1211+
//
1212+
// Preconditions: value_type is Cpp17EmplaceConstructible into inplace_vector
1213+
// from *ranges::begin(rg).
1214+
//
1215+
// Effects: Appends copies of initial elements
1216+
// in rg before end(), until all elements are inserted or size() == capacity()
1217+
// is true. Each iterator in the range rg is dereferenced at most once.
1218+
//
1219+
// Returns: An iterator pointing to the first element of rg that was not
1220+
// inserted into *this, or ranges::end(rg) if no such element exists.
1221+
// Complexity: Linear in the number of elements inserted.
1222+
//
1223+
// Remarks: Let n be the value of size() prior to this call. If an exception
1224+
// is thrown after the insertion of k elements, then size() equals n + k ,
1225+
// elements in the range begin() + [0, n) are not modified, and elements in
1226+
// the range begin() + [n, n + k) correspond to the inserted elements.
1227+
1228+
// TODO
1229+
GTEST_SKIP();
1230+
}
1231+
1232+
TYPED_TEST(Modifiers, UncheckedEmplacedBack) {
1233+
// template<class... Args>
1234+
// constexpr reference unchecked_emplace_back(Args&&... args);
1235+
//
1236+
// Preconditions: size() < capacity() is true.
1237+
// Effects: Equivalent to: return
1238+
// *try_emplace_back(std::forward<Args>(args)...);
1239+
1240+
// TODO
1241+
GTEST_SKIP();
1242+
}
1243+
1244+
TYPED_TEST(Modifiers, UncheckedPushBack) {
1245+
// constexpr reference unchecked_push_back(const T& x);
1246+
// constexpr reference unchecked_push_back(T&& x);
1247+
// Preconditions: size() < capacity() is true.
1248+
// Effects: Equivalent to: return
1249+
// *try_push_back(std​::​forward<decltype(x)>(x));
1250+
1251+
// TODO
1252+
GTEST_SKIP();
1253+
}
1254+
1255+
TYPED_TEST(Modifiers, ReserveShrink) {
1256+
// static constexpr void reserve(size_type n);
1257+
//
1258+
// Effects: None.
1259+
// Throws: bad_alloc if n > capacity() is true.
1260+
//
1261+
// static constexpr void shrink_to_fit() noexcept;
1262+
// Effects: None.
1263+
1264+
// TODO
1265+
GTEST_SKIP();
1266+
}
1267+
1268+
TYPED_TEST(Modifiers, Erase) {
1269+
// constexpr iterator erase(const_iterator position);
1270+
// constexpr iterator erase(const_iterator first, const_iterator last);
1271+
// constexpr void pop_back();
1272+
//
1273+
// Effects: Invalidates iterators and references at or after the point of the
1274+
// erase.
1275+
// Throws: Nothing unless an exception is thrown by the assignment
1276+
// operator or move assignment operator of T.
1277+
// Complexity: The destructor of T is called the number of times equal to the
1278+
// number of the elements erased, but the assignment operator of T is called
1279+
// the number of times equal to the number of elements after the erased
1280+
// elements.
1281+
1282+
// TODO
1283+
GTEST_SKIP();
1284+
}
11201285

11211286
// 23.3.14.6 Erasure [inplace.vector.erasure]
1122-
// TODO
1287+
1288+
template <typename Param> class Erasure : public BasicTest<Param> {};
1289+
TYPED_TEST_SUITE(Erasure, AllTypes);
1290+
1291+
TYPED_TEST(Erasure, ByValue) {
1292+
// template<class T, size_t N, class U = T>
1293+
// constexpr size_t erase(inplace_vector<T, N>& c, const U& value);
1294+
//
1295+
// Effects: Equivalent to:
1296+
// auto it = remove(c.begin(), c.end(), value);
1297+
// auto r = distance(it, c.end());
1298+
// c.erase(it, c.end());
1299+
// return r;
1300+
1301+
// TODO
1302+
GTEST_SKIP();
1303+
}
1304+
1305+
TYPED_TEST(Erasure, ByPred) {
1306+
// template<class T, size_t N, class Predicate>
1307+
// constexpr size_t erase_if(inplace_vector<T, N>& c, Predicate pred);
1308+
//
1309+
// Effects: Equivalent to:
1310+
// auto it = remove_if(c.begin(), c.end(), pred);
1311+
// auto r = distance(it, c.end());
1312+
// c.erase(it, c.end());
1313+
// return r;
1314+
1315+
// TODO
1316+
GTEST_SKIP();
1317+
}
11231318

11241319
#if 0
11251320

0 commit comments

Comments
 (0)