mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:59:56 +00:00
[ADT] Update SmallVectorTest.EmplaceBack tests after rL356312
rL356312 changed the return type of emplace_back from void to reference. Update the tests to check the behavior. Reviewers: dblaikie Reviewed By: dblaikie Subscribers: dexonsmith, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59809 llvm-svn: 356980
This commit is contained in:
parent
8629275bfb
commit
6799203cd2
@ -908,63 +908,69 @@ TEST(SmallVectorTest, EmplaceBack) {
|
||||
EmplaceableArg<3> A3(true);
|
||||
{
|
||||
SmallVector<Emplaceable, 3> V;
|
||||
V.emplace_back();
|
||||
Emplaceable &back = V.emplace_back();
|
||||
EXPECT_TRUE(&back == &V.back());
|
||||
EXPECT_TRUE(V.size() == 1);
|
||||
EXPECT_TRUE(V.back().State == ES_Emplaced);
|
||||
EXPECT_TRUE(V.back().A0.State == EAS_Defaulted);
|
||||
EXPECT_TRUE(V.back().A1.State == EAS_Defaulted);
|
||||
EXPECT_TRUE(V.back().A2.State == EAS_Defaulted);
|
||||
EXPECT_TRUE(V.back().A3.State == EAS_Defaulted);
|
||||
EXPECT_TRUE(back.State == ES_Emplaced);
|
||||
EXPECT_TRUE(back.A0.State == EAS_Defaulted);
|
||||
EXPECT_TRUE(back.A1.State == EAS_Defaulted);
|
||||
EXPECT_TRUE(back.A2.State == EAS_Defaulted);
|
||||
EXPECT_TRUE(back.A3.State == EAS_Defaulted);
|
||||
}
|
||||
{
|
||||
SmallVector<Emplaceable, 3> V;
|
||||
V.emplace_back(std::move(A0));
|
||||
Emplaceable &back = V.emplace_back(std::move(A0));
|
||||
EXPECT_TRUE(&back == &V.back());
|
||||
EXPECT_TRUE(V.size() == 1);
|
||||
EXPECT_TRUE(V.back().State == ES_Emplaced);
|
||||
EXPECT_TRUE(V.back().A0.State == EAS_RValue);
|
||||
EXPECT_TRUE(V.back().A1.State == EAS_Defaulted);
|
||||
EXPECT_TRUE(V.back().A2.State == EAS_Defaulted);
|
||||
EXPECT_TRUE(V.back().A3.State == EAS_Defaulted);
|
||||
EXPECT_TRUE(back.State == ES_Emplaced);
|
||||
EXPECT_TRUE(back.A0.State == EAS_RValue);
|
||||
EXPECT_TRUE(back.A1.State == EAS_Defaulted);
|
||||
EXPECT_TRUE(back.A2.State == EAS_Defaulted);
|
||||
EXPECT_TRUE(back.A3.State == EAS_Defaulted);
|
||||
}
|
||||
{
|
||||
SmallVector<Emplaceable, 3> V;
|
||||
V.emplace_back(A0);
|
||||
Emplaceable &back = V.emplace_back(A0);
|
||||
EXPECT_TRUE(&back == &V.back());
|
||||
EXPECT_TRUE(V.size() == 1);
|
||||
EXPECT_TRUE(V.back().State == ES_Emplaced);
|
||||
EXPECT_TRUE(V.back().A0.State == EAS_LValue);
|
||||
EXPECT_TRUE(V.back().A1.State == EAS_Defaulted);
|
||||
EXPECT_TRUE(V.back().A2.State == EAS_Defaulted);
|
||||
EXPECT_TRUE(V.back().A3.State == EAS_Defaulted);
|
||||
EXPECT_TRUE(back.State == ES_Emplaced);
|
||||
EXPECT_TRUE(back.A0.State == EAS_LValue);
|
||||
EXPECT_TRUE(back.A1.State == EAS_Defaulted);
|
||||
EXPECT_TRUE(back.A2.State == EAS_Defaulted);
|
||||
EXPECT_TRUE(back.A3.State == EAS_Defaulted);
|
||||
}
|
||||
{
|
||||
SmallVector<Emplaceable, 3> V;
|
||||
V.emplace_back(A0, A1);
|
||||
Emplaceable &back = V.emplace_back(A0, A1);
|
||||
EXPECT_TRUE(&back == &V.back());
|
||||
EXPECT_TRUE(V.size() == 1);
|
||||
EXPECT_TRUE(V.back().State == ES_Emplaced);
|
||||
EXPECT_TRUE(V.back().A0.State == EAS_LValue);
|
||||
EXPECT_TRUE(V.back().A1.State == EAS_LValue);
|
||||
EXPECT_TRUE(V.back().A2.State == EAS_Defaulted);
|
||||
EXPECT_TRUE(V.back().A3.State == EAS_Defaulted);
|
||||
EXPECT_TRUE(back.State == ES_Emplaced);
|
||||
EXPECT_TRUE(back.A0.State == EAS_LValue);
|
||||
EXPECT_TRUE(back.A1.State == EAS_LValue);
|
||||
EXPECT_TRUE(back.A2.State == EAS_Defaulted);
|
||||
EXPECT_TRUE(back.A3.State == EAS_Defaulted);
|
||||
}
|
||||
{
|
||||
SmallVector<Emplaceable, 3> V;
|
||||
V.emplace_back(std::move(A0), std::move(A1));
|
||||
Emplaceable &back = V.emplace_back(std::move(A0), std::move(A1));
|
||||
EXPECT_TRUE(&back == &V.back());
|
||||
EXPECT_TRUE(V.size() == 1);
|
||||
EXPECT_TRUE(V.back().State == ES_Emplaced);
|
||||
EXPECT_TRUE(V.back().A0.State == EAS_RValue);
|
||||
EXPECT_TRUE(V.back().A1.State == EAS_RValue);
|
||||
EXPECT_TRUE(V.back().A2.State == EAS_Defaulted);
|
||||
EXPECT_TRUE(V.back().A3.State == EAS_Defaulted);
|
||||
EXPECT_TRUE(back.State == ES_Emplaced);
|
||||
EXPECT_TRUE(back.A0.State == EAS_RValue);
|
||||
EXPECT_TRUE(back.A1.State == EAS_RValue);
|
||||
EXPECT_TRUE(back.A2.State == EAS_Defaulted);
|
||||
EXPECT_TRUE(back.A3.State == EAS_Defaulted);
|
||||
}
|
||||
{
|
||||
SmallVector<Emplaceable, 3> V;
|
||||
V.emplace_back(std::move(A0), A1, std::move(A2), A3);
|
||||
Emplaceable &back = V.emplace_back(std::move(A0), A1, std::move(A2), A3);
|
||||
EXPECT_TRUE(&back == &V.back());
|
||||
EXPECT_TRUE(V.size() == 1);
|
||||
EXPECT_TRUE(V.back().State == ES_Emplaced);
|
||||
EXPECT_TRUE(V.back().A0.State == EAS_RValue);
|
||||
EXPECT_TRUE(V.back().A1.State == EAS_LValue);
|
||||
EXPECT_TRUE(V.back().A2.State == EAS_RValue);
|
||||
EXPECT_TRUE(V.back().A3.State == EAS_LValue);
|
||||
EXPECT_TRUE(back.State == ES_Emplaced);
|
||||
EXPECT_TRUE(back.A0.State == EAS_RValue);
|
||||
EXPECT_TRUE(back.A1.State == EAS_LValue);
|
||||
EXPECT_TRUE(back.A2.State == EAS_RValue);
|
||||
EXPECT_TRUE(back.A3.State == EAS_LValue);
|
||||
}
|
||||
{
|
||||
SmallVector<int, 1> V;
|
||||
|
Loading…
Reference in New Issue
Block a user