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