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