aboutsummaryrefslogtreecommitdiff
path: root/libc/test
diff options
context:
space:
mode:
authorPiJoules <6019989+PiJoules@users.noreply.github.com>2024-06-25 16:33:36 -0700
committerGitHub <noreply@github.com>2024-06-25 16:33:36 -0700
commit54ca5a800d12bf76dabc957163df02c3ea005627 (patch)
tree56bbb01a38ed402c4234036dc712bcb9c7f3f839 /libc/test
parent0d533665054c3a04681c46f3ed88960f28777be1 (diff)
downloadllvm-54ca5a800d12bf76dabc957163df02c3ea005627.zip
llvm-54ca5a800d12bf76dabc957163df02c3ea005627.tar.gz
llvm-54ca5a800d12bf76dabc957163df02c3ea005627.tar.bz2
[libc][fixedvector] Add const_iterator begin/end (#96714)
Diffstat (limited to 'libc/test')
-rw-r--r--libc/test/src/__support/fixedvector_test.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/libc/test/src/__support/fixedvector_test.cpp b/libc/test/src/__support/fixedvector_test.cpp
index 212e1ae..b73df04 100644
--- a/libc/test/src/__support/fixedvector_test.cpp
+++ b/libc/test/src/__support/fixedvector_test.cpp
@@ -96,3 +96,13 @@ TEST(LlvmLibcFixedVectorTest, ForwardIteration) {
ASSERT_EQ(*it, arr[idx]);
}
}
+
+TEST(LlvmLibcFixedVectorTest, ConstForwardIteration) {
+ const LIBC_NAMESPACE::cpp::array<int, 4> arr{1, 2, 3, 4};
+ const LIBC_NAMESPACE::FixedVector<int, 5> vec(arr.begin(), arr.end());
+ ASSERT_EQ(vec.size(), arr.size());
+ for (auto it = vec.begin(); it != vec.end(); ++it) {
+ auto idx = it - vec.begin();
+ ASSERT_EQ(*it, arr[idx]);
+ }
+}