]>
git.saurik.com Git - apple/xnu.git/blob - tests/bounded_array_src/ctor.aggregate_init.cpp
3 // aggregate-initialization of `bounded_array`
6 #include <libkern/c++/bounded_array.h>
7 #include <darwintest.h>
8 #include <darwintest_utils.h>
9 #include "test_policy.h"
20 operator==(T
const& a
, T
const& b
)
31 test_bounded_array
<T
, 5> array
= {T(1), T(2), T(3), T(4), T(5)};
32 CHECK(array
.size() == 5);
33 CHECK(array
[0] == T(1));
34 CHECK(array
[1] == T(2));
35 CHECK(array
[2] == T(3));
36 CHECK(array
[3] == T(4));
37 CHECK(array
[4] == T(5));
41 test_bounded_array
<T
, 5> array
{T(1), T(2), T(3), T(4), T(5)};
42 CHECK(array
.size() == 5);
43 CHECK(array
[0] == T(1));
44 CHECK(array
[1] == T(2));
45 CHECK(array
[2] == T(3));
46 CHECK(array
[3] == T(4));
47 CHECK(array
[4] == T(5));
50 // Check with a 0-sized array
52 test_bounded_array
<T
, 0> array
= {};
53 CHECK(array
.size() == 0);
57 T_DECL(ctor_aggregate_init
, "bounded_array.ctor.aggregate_init") {