blob: b9fef78d2fdb3f56fcf1d76e56b54a0e62fcea30 [file] [log] [blame]
Jun Bum Lim25447882016-03-25 19:28:08 +00001//===- llvm/unittest/ADT/SetVector.cpp ------------------------------===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Jun Bum Lim25447882016-03-25 19:28:08 +00006//
7//===----------------------------------------------------------------------===//
8//
9// SetVector unit tests.
10//
11//===----------------------------------------------------------------------===//
12
13#include "llvm/ADT/SetVector.h"
14#include "gtest/gtest.h"
15
16using namespace llvm;
17
18TEST(SetVector, EraseTest) {
19 SetVector<int> S;
20 S.insert(0);
21 S.insert(1);
22 S.insert(2);
23
24 auto I = S.erase(std::next(S.begin()));
25
26 // Test that the returned iterator is the expected one-after-erase
27 // and the size/contents is the expected sequence {0, 2}.
28 EXPECT_EQ(std::next(S.begin()), I);
29 EXPECT_EQ(2u, S.size());
30 EXPECT_EQ(0, *S.begin());
31 EXPECT_EQ(2, *std::next(S.begin()));
32}
33