feat: initial version, incomplete but functional
This commit is contained in:
26
test/nileakdetector_test.c
Normal file
26
test/nileakdetector_test.c
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user