22 #include <sys/types.h> 26 extern void*
_test_malloc(
const size_t size,
const char* file,
const int line);
27 extern void*
_test_calloc(
const size_t number_of_elements,
const size_t size,
28 const char* file,
const int line);
29 extern void _test_free(
void*
const ptr,
const char* file,
const int line);
31 #define malloc(size) _test_malloc(size, __FILE__, __LINE__) 32 #define calloc(num, size) _test_calloc(num, size, __FILE__, __LINE__) 33 #define free(ptr) _test_free(ptr, __FILE__, __LINE__) 34 #endif // UNIT_TESTING 41 int *
const temporary = (
int*)
malloc(
sizeof(
int));
46 char *
const memory = (
char*)
malloc(
sizeof(
int));
47 memory[
sizeof(int)] =
'!';
52 char *
const memory = (
char*)
malloc(
sizeof(
int));
void _test_free(void *const ptr, const char *file, const int line)
void * _test_malloc(const size_t size, const char *file, const int line)
void buffer_underflow(void)
void buffer_overflow(void)
void * _test_calloc(const size_t number_of_elements, const size_t size, const char *file, const int line)