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 }
32