]> git.saurik.com Git - apple/xnu.git/blob - tests/bounded_array_src/size.cpp
xnu-7195.101.1.tar.gz
[apple/xnu.git] / tests / bounded_array_src / size.cpp
1 //
2 // Tests for
3 // size_t size() const;
4 //
5
6 #include <libkern/c++/bounded_array.h>
7 #include "test_policy.h"
8 #include <darwintest.h>
9 #include <stddef.h>
10
11 struct T { int i; };
12
13 template <typename T>
14 static void
15 tests()
16 {
17 {
18 test_bounded_array<T, 5> const array = {T{0}, T{1}, T{2}, T{3}, T{4}};
19 size_t size = array.size();
20 CHECK(size == 5);
21 }
22 {
23 test_bounded_array<T, 0> const array = {};
24 size_t size = array.size();
25 CHECK(size == 0);
26 }
27 }
28
29 T_DECL(size, "bounded_array.size") {
30 tests<T>();
31 }