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