diff options
Diffstat (limited to 'absl/algorithm/container_test.cc')
-rw-r--r-- | absl/algorithm/container_test.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/absl/algorithm/container_test.cc b/absl/algorithm/container_test.cc index 04282b89..86bf9d3e 100644 --- a/absl/algorithm/container_test.cc +++ b/absl/algorithm/container_test.cc @@ -636,6 +636,19 @@ TEST(MutatingTest, Move) { Pointee(5))); } +TEST(MutatingTest, MoveBackward) { + std::vector<std::unique_ptr<int>> actual; + actual.emplace_back(absl::make_unique<int>(1)); + actual.emplace_back(absl::make_unique<int>(2)); + actual.emplace_back(absl::make_unique<int>(3)); + actual.emplace_back(absl::make_unique<int>(4)); + actual.emplace_back(absl::make_unique<int>(5)); + auto subrange = absl::MakeSpan(actual.data(), 3); + absl::c_move_backward(subrange, actual.end()); + EXPECT_THAT(actual, ElementsAre(IsNull(), IsNull(), Pointee(1), Pointee(2), + Pointee(3))); +} + TEST(MutatingTest, MoveWithRvalue) { auto MakeRValueSrc = [] { std::vector<std::unique_ptr<int>> src; |