[llvm] r371475 - [llvm][ADT][NFC] Add test for makeArrayRef(std::array)
Jan Korous via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 9 17:29:35 PDT 2019
Author: jkorous
Date: Mon Sep 9 17:29:35 2019
New Revision: 371475
URL: http://llvm.org/viewvc/llvm-project?rev=371475&view=rev
Log:
[llvm][ADT][NFC] Add test for makeArrayRef(std::array)
Modified:
llvm/trunk/unittests/ADT/ArrayRefTest.cpp
Modified: llvm/trunk/unittests/ADT/ArrayRefTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/ArrayRefTest.cpp?rev=371475&r1=371474&r2=371475&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/ArrayRefTest.cpp (original)
+++ llvm/trunk/unittests/ADT/ArrayRefTest.cpp Mon Sep 9 17:29:35 2019
@@ -250,6 +250,16 @@ TEST(ArrayRefTest, OwningArrayRef) {
EXPECT_EQ(A.data(), nullptr);
}
+TEST(ArrayRefTest, makeArrayRefFromStdArray) {
+ std::array<int, 5> A1{42, -5, 0, 1000000, -1000000};
+ ArrayRef<int> A2 = makeArrayRef(A1);
+
+ EXPECT_EQ(A1.size(), A2.size());
+ for (std::size_t i = 0; i < A1.size(); ++i) {
+ EXPECT_EQ(A1[i], A2[i]);
+ }
+}
+
static_assert(is_trivially_copyable<ArrayRef<int>>::value,
"trivially copyable");
More information about the llvm-commits
mailing list