xref: /xnu-12377.81.4/tests/bounded_ptr_src/test_utils.h (revision 043036a2b3718f7f0be807e2870f8f47d3fa0796)
1*043036a2SApple OSS Distributions #ifndef TESTS_BOUNDED_PTR_TEST_UTILS_H
2*043036a2SApple OSS Distributions #define TESTS_BOUNDED_PTR_TEST_UTILS_H
3*043036a2SApple OSS Distributions 
4*043036a2SApple OSS Distributions #include <cassert>
5*043036a2SApple OSS Distributions #include <libkern/c++/bounded_ptr.h>
6*043036a2SApple OSS Distributions 
7*043036a2SApple OSS Distributions namespace {
8*043036a2SApple OSS Distributions struct test_policy {
9*043036a2SApple OSS Distributions 	static void
traptest_policy10*043036a2SApple OSS Distributions 	trap(char const*)
11*043036a2SApple OSS Distributions 	{
12*043036a2SApple OSS Distributions 		assert(false);
13*043036a2SApple OSS Distributions 	}
14*043036a2SApple OSS Distributions };
15*043036a2SApple OSS Distributions 
16*043036a2SApple OSS Distributions template <typename T>
17*043036a2SApple OSS Distributions using test_bounded_ptr = libkern::bounded_ptr<T, test_policy>;
18*043036a2SApple OSS Distributions } // end anonymous namespace
19*043036a2SApple OSS Distributions 
20*043036a2SApple OSS Distributions #endif // !TESTS_BOUNDED_PTR_TEST_UTILS_H
21