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

Function CheckMove

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

Source from the content-addressed store, hash-verified

401
402 template <size_t N>
403 void CheckMove(bool expect_overflow) {
404 IntVectorType<N> ints = MakeVector<N>({4, 5, 6, 7, 8});
405
406 IntVectorType<N> moved_ints(std::move(ints));
407 ASSERT_EQ(moved_ints.size(), 5);
408 EXPECT_THAT(moved_ints, ElementsAre(4, 5, 6, 7, 8));
409 ASSERT_EQ(UsesStaticStorage(moved_ints), !expect_overflow);
410 ASSERT_TRUE(UsesStaticStorage(ints));
411
412 IntVectorType<N> moved_moved_ints = std::move(moved_ints);
413 ASSERT_EQ(moved_moved_ints.size(), 5);
414 EXPECT_THAT(moved_moved_ints, ElementsAre(4, 5, 6, 7, 8));
415
416 // Move into itself
417 moved_moved_ints = std::move(moved_moved_ints);
418 ASSERT_EQ(moved_moved_ints.size(), 5);
419 EXPECT_THAT(moved_moved_ints, ElementsAre(4, 5, 6, 7, 8));
420 }
421
422 void TestMove() {
423 CheckMove<Traits::TestSizeFor(5)>(/*expect_overflow=*/Traits::CanOverflow());

Callers

nothing calls this directly

Calls 2

UsesStaticStorageFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected