1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

Adding additional tests to ensure that initializer lists created from return values and as function arguments also work as expected.

llvm-svn: 229513
This commit is contained in:
Aaron Ballman 2015-02-17 17:08:08 +00:00
parent 49e7dd6b8e
commit 6056eecb6d

View File

@ -90,10 +90,23 @@ TEST(ArrayRefTest, ConstConvert) {
a = ArrayRef<int *>(A);
}
static ArrayRef<int> ReturnTest12() { return {1, 2}; }
static void ArgTest12(ArrayRef<int> A) {
EXPECT_EQ(2, A.size());
EXPECT_EQ(1, A[0]);
EXPECT_EQ(2, A[1]);
}
TEST(ArrayRefTest, InitializerList) {
ArrayRef<int> A = { 0, 1, 2, 3, 4 };
for (int i = 0; i < 5; ++i)
EXPECT_EQ(i, A[i]);
A = ReturnTest12();
EXPECT_EQ(1, A[0]);
EXPECT_EQ(2, A[1]);
ArgTest12({1, 2});
}
} // end anonymous namespace