1 | #define BOOST_TEST_MODULE Serialization
|
---|
2 |
|
---|
3 | #include <boost/archive/detail/iserializer.hpp>
|
---|
4 | #include <boost/test/test_tools.hpp>
|
---|
5 | #include <boost/test/included/unit_test.hpp>
|
---|
6 |
|
---|
7 | using namespace boost::archive::detail;
|
---|
8 |
|
---|
9 | class WithOverLoadedNewOperator
|
---|
10 | {
|
---|
11 | public:
|
---|
12 |
|
---|
13 | void *operator new(
|
---|
14 | size_t size
|
---|
15 | )
|
---|
16 | {
|
---|
17 | return ::operator new(size);
|
---|
18 | }
|
---|
19 |
|
---|
20 | void *operator new(
|
---|
21 | size_t size,
|
---|
22 | void *pBase
|
---|
23 | )
|
---|
24 | {
|
---|
25 | return pBase;
|
---|
26 | }
|
---|
27 |
|
---|
28 | void operator delete(
|
---|
29 | void *p
|
---|
30 | )
|
---|
31 | {
|
---|
32 | ::operator delete(p);
|
---|
33 | }
|
---|
34 |
|
---|
35 | void operator delete(
|
---|
36 | void *p,
|
---|
37 | void *pBase
|
---|
38 | )
|
---|
39 | {
|
---|
40 | }
|
---|
41 | };
|
---|
42 |
|
---|
43 | class WithoutOverLoadedNewOperator
|
---|
44 | {
|
---|
45 | };
|
---|
46 |
|
---|
47 | BOOST_AUTO_TEST_SUITE(Serialization)
|
---|
48 |
|
---|
49 | BOOST_AUTO_TEST_CASE(HeapAllocatorOperatorNewOverloadTest)
|
---|
50 | {
|
---|
51 | BOOST_WARN(sizeof(*heap_allocator<WithOverLoadedNewOperator>::hasNewOperator<WithOverLoadedNewOperator>(static_cast<WithOverLoadedNewOperator *>(NULL))) == sizeof(heap_allocator<WithoutOverLoadedNewOperator>::True));
|
---|
52 | BOOST_REQUIRE(sizeof(*heap_allocator<WithoutOverLoadedNewOperator>::hasNewOperator<WithoutOverLoadedNewOperator>(static_cast<WithoutOverLoadedNewOperator *>(NULL))) == sizeof(heap_allocator<WithoutOverLoadedNewOperator>::False));
|
---|
53 | }
|
---|
54 |
|
---|
55 | BOOST_AUTO_TEST_SUITE_END()
|
---|