xref: /xnu-10002.1.13/tests/bounded_array_src/test_policy.h (revision 1031c584a5e37aff177559b9f69dbd3c8c3fd30a)
1*1031c584SApple OSS Distributions #ifndef TESTS_BOUNDED_ARRAY_SRC_TEST_POLICY_H
2*1031c584SApple OSS Distributions #define TESTS_BOUNDED_ARRAY_SRC_TEST_POLICY_H
3*1031c584SApple OSS Distributions 
4*1031c584SApple OSS Distributions #include <assert.h>
5*1031c584SApple OSS Distributions #include <darwintest_utils.h>
6*1031c584SApple OSS Distributions #include <libkern/c++/bounded_array.h>
7*1031c584SApple OSS Distributions #include <libkern/c++/bounded_ptr.h>
8*1031c584SApple OSS Distributions #include <stddef.h>
9*1031c584SApple OSS Distributions 
10*1031c584SApple OSS Distributions struct test_policy {
11*1031c584SApple OSS Distributions 	static void
traptest_policy12*1031c584SApple OSS Distributions 	trap(char const*)
13*1031c584SApple OSS Distributions 	{
14*1031c584SApple OSS Distributions 		assert(false);
15*1031c584SApple OSS Distributions 	}
16*1031c584SApple OSS Distributions };
17*1031c584SApple OSS Distributions 
18*1031c584SApple OSS Distributions template <typename T, size_t N>
19*1031c584SApple OSS Distributions using test_bounded_array = libkern::bounded_array<T, N, test_policy>;
20*1031c584SApple OSS Distributions 
21*1031c584SApple OSS Distributions template <typename T>
22*1031c584SApple OSS Distributions using test_bounded_ptr = libkern::bounded_ptr<T, test_policy>;
23*1031c584SApple OSS Distributions 
24*1031c584SApple OSS Distributions #define CHECK(...) T_ASSERT_TRUE((__VA_ARGS__), # __VA_ARGS__)
25*1031c584SApple OSS Distributions 
26*1031c584SApple OSS Distributions #endif // !TESTS_BOUNDED_ARRAY_SRC_TEST_POLICY_H
27