]>
git.saurik.com Git - apple/xnu.git/blob - tests/bounded_array_ref_src/begin_end.cpp
3 // iterator begin() const;
4 // iterator end() const;
7 #include <libkern/c++/bounded_array_ref.h>
8 #include "test_policy.h"
9 #include <darwintest.h>
10 #include <type_traits>
18 using AR
= test_bounded_array_ref
<T
>;
20 // Check begin()/end() for a non-null array ref
22 T array
[5] = {T
{0}, T
{1}, T
{2}, T
{3}, T
{4}};
24 test_bounded_ptr
<T
> begin
= view
.begin();
25 test_bounded_ptr
<T
> end
= view
.end();
26 CHECK(begin
.discard_bounds() == &array
[0]);
27 CHECK(end
.unsafe_discard_bounds() == &array
[5]);
30 // Check begin()/end() for a null array ref
33 test_bounded_ptr
<T
> begin
= view
.begin();
34 test_bounded_ptr
<T
> end
= view
.end();
35 CHECK(begin
.unsafe_discard_bounds() == nullptr);
36 CHECK(end
.unsafe_discard_bounds() == nullptr);
39 // Check associated types
41 static_assert(std::is_same_v
<typename
AR::iterator
, test_bounded_ptr
<T
> >);
45 T_DECL(begin_end
, "bounded_array_ref.begin_end") {