| 1 | /* This file is for emulating allocations in a C++ file. |
| 2 | * It is used simulating the use of the memory leak detector on production code in C++ |
| 3 | */ |
| 4 | #undef new |
| 5 | #include "CppUTest/MemoryLeakDetectorNewMacros.h" |
| 6 | #include "AllocationInCppFile.h" |
| 7 | |
| 8 | char* newAllocation() |
| 9 | { |
| 10 | return new char; |
| 11 | } |
| 12 | |
| 13 | char* newArrayAllocation() |
| 14 | { |
| 15 | return new char[100]; |
| 16 | } |
| 17 | |
| 18 | #undef new |
| 19 | |
| 20 | char* newAllocationWithoutMacro() |
| 21 | { |
| 22 | return new char; |
| 23 | } |
| 24 | |
| 25 | char* newArrayAllocationWithoutMacro() |
| 26 | { |
| 27 | return new char[100]; |
| 28 | } |
| 29 | |
| 30 | #if CPPUTEST_USE_STD_CPP_LIB |
| 31 | |
| 32 | ClassThatThrowsAnExceptionInTheConstructor::ClassThatThrowsAnExceptionInTheConstructor() |
| 33 | { |
| 34 | throw 1; |
| 35 | } |
| 36 | |
| 37 | #endif |