MCPcopy Create free account
hub / github.com/apache/arrow / CheckAssignFromMovedStdVector

Function CheckAssignFromMovedStdVector

cpp/src/arrow/util/small_vector_test.cc:348–368  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

346 }
347
348 void CheckAssignFromMovedStdVector() {
349 constexpr size_t N = Traits::TestSizeFor(6);
350 {
351 std::vector<IntLike> src;
352 IntVectorType<N> ints = MakeVector<N>({42});
353 ints = std::move(src);
354 ASSERT_EQ(ints.size(), 0);
355 ASSERT_EQ(ints.capacity(), N);
356 }
357 {
358 std::vector<IntLike> src;
359 for (int i = 0; i < 6; ++i) {
360 src.emplace_back(i + 4);
361 }
362 IntVectorType<N> ints = MakeVector<N>({42});
363 ints = std::move(src);
364 ASSERT_EQ(ints.size(), 6);
365 ASSERT_EQ(ints.capacity(), std::max<size_t>(N, 6));
366 EXPECT_THAT(ints, ElementsAre(4, 5, 6, 7, 8, 9));
367 }
368 }
369
370 template <bool IsMoveOnly = Param::IsMoveOnly()>
371 void CheckAssignFromCopiedStdVector(enable_if_t<!IsMoveOnly>* = 0) {

Callers 1

TestAssignFromStdVectorFunction · 0.85

Calls 3

emplace_backMethod · 0.80
sizeMethod · 0.45
capacityMethod · 0.45

Tested by

no test coverage detected