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