]>
git.saurik.com Git - apple/xnu.git/blob - tests/bounded_array_ref_src/ctor.begin_end.cpp
3 // explicit bounded_array_ref(T* first, T* last);
6 #include <libkern/c++/bounded_array_ref.h>
7 #include "test_policy.h"
8 #include <darwintest.h>
9 #include <darwintest_utils.h>
13 operator==(T
const& a
, T
const& b
)
22 T array
[5] = {T
{0}, T
{1}, T
{2}, T
{3}, T
{4}};
24 // T{0} T{1} T{2} T{3} T{4} <one-past-last>
31 test_bounded_array_ref
<T
> view(first
, last
);
32 CHECK(view
.data() == &array
[0]);
33 CHECK(view
.size() == 5);
34 CHECK(view
[0] == T
{0});
35 CHECK(view
[1] == T
{1});
36 CHECK(view
[2] == T
{2});
37 CHECK(view
[3] == T
{3});
38 CHECK(view
[4] == T
{4});
41 // T{0} T{1} T{2} T{3} T{4} <one-past-last>
48 test_bounded_array_ref
<T
> view(first
, last
);
49 CHECK(view
.data() == &array
[0]);
50 CHECK(view
.size() == 1);
51 CHECK(view
[0] == T
{0});
54 // T{0} T{1} T{2} T{3} T{4} <one-past-last>
61 test_bounded_array_ref
<T
> view(first
, last
);
62 CHECK(view
.size() == 0);
65 // T{0} T{1} T{2} T{3} T{4} <one-past-last>
72 test_bounded_array_ref
<T
> view(first
, last
);
73 CHECK(view
.size() == 0);
77 T_DECL(ctor_begin_end
, "bounded_array_ref.ctor.begin_end") {