mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +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:
parent
49e7dd6b8e
commit
6056eecb6d
@ -90,10 +90,23 @@ TEST(ArrayRefTest, ConstConvert) {
|
|||||||
a = ArrayRef<int *>(A);
|
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) {
|
TEST(ArrayRefTest, InitializerList) {
|
||||||
ArrayRef<int> A = { 0, 1, 2, 3, 4 };
|
ArrayRef<int> A = { 0, 1, 2, 3, 4 };
|
||||||
for (int i = 0; i < 5; ++i)
|
for (int i = 0; i < 5; ++i)
|
||||||
EXPECT_EQ(i, A[i]);
|
EXPECT_EQ(i, A[i]);
|
||||||
|
|
||||||
|
A = ReturnTest12();
|
||||||
|
EXPECT_EQ(1, A[0]);
|
||||||
|
EXPECT_EQ(2, A[1]);
|
||||||
|
|
||||||
|
ArgTest12({1, 2});
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
Loading…
Reference in New Issue
Block a user