Files
ni-leakdetector/test/nileakdetector_test.c

27 lines
504 B
C
Raw Normal View History

#define NILEAKDETECTOR_VERBOSE true
#include "../nileakdetector.h"
#include <stdio.h>
void
test_malloc()
{
int *x = malloc(sizeof(int));
*x = 10;
printf("X = %d\n", *x); // Should print the right value of X
printf("\nAt this point the summary should indicate leaks...\n");
nileakdetector_print_summary();
printf("\nAfter this free it should be all good...\n");
free(x);
nileakdetector_print_summary();
}
int
main()
{
test_malloc();
printf("== TESTS SUCCESSFUL ==\n");
return 0;
}