blob: b8cac0dc311e50da9166457c743319289135caa4 [file] [log] [blame]
Jun Bum Lim25447882016-03-25 19:28:08 +00001//===- llvm/unittest/ADT/SetVector.cpp ------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// SetVector unit tests.
11//
12//===----------------------------------------------------------------------===//
13
14#include "llvm/ADT/SetVector.h"
15#include "gtest/gtest.h"
16
17using namespace llvm;
18
19TEST(SetVector, EraseTest) {
20 SetVector<int> S;
21 S.insert(0);
22 S.insert(1);
23 S.insert(2);
24
25 auto I = S.erase(std::next(S.begin()));
26
27 // Test that the returned iterator is the expected one-after-erase
28 // and the size/contents is the expected sequence {0, 2}.
29 EXPECT_EQ(std::next(S.begin()), I);
30 EXPECT_EQ(2u, S.size());
31 EXPECT_EQ(0, *S.begin());
32 EXPECT_EQ(2, *std::next(S.begin()));
33}
34