]> git.saurik.com Git - apple/xnu.git/blame - tests/bounded_array_src/size.cpp
xnu-7195.81.3.tar.gz
[apple/xnu.git] / tests / bounded_array_src / size.cpp
CommitLineData
f427ee49
A
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
11struct T { int i; };
12
13template <typename T>
14static void
15tests()
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
29T_DECL(size, "bounded_array.size") {
30 tests<T>();
31}