Browse Source

Added yatest

main
Titouan Rigoudy 11 years ago
parent
commit
6bba9ea6d8
3 changed files with 45 additions and 0 deletions
  1. +1
    -0
      .gitignore
  2. +18
    -0
      Makefile
  3. +26
    -0
      yatest.c

+ 1
- 0
.gitignore View File

@ -27,6 +27,7 @@
*.i*86 *.i*86
*.x86_64 *.x86_64
*.hex *.hex
yatest
# Fuse hidden files # Fuse hidden files
.fuse* .fuse*

+ 18
- 0
Makefile View File

@ -0,0 +1,18 @@
CC=`which gcc`
CPPFLAGS=-DYA_DEBUG
CFLAGS=--std=c11 -ggdb
all: yatest
test: yatest
./yatest
%.o: %.c
$(CC) -c $^ $(CPPFLAGS) $(CFLAGS)
yatest: yatest.o yamalloc.o
$(CC) -o $@ $^ $(CFLAGS)
clean:
rm -f *.o
rm -f yatest

+ 26
- 0
yatest.c View File

@ -0,0 +1,26 @@
/*
* Yet Another Malloc
* yatest.c
* Author: Titouan Rigoudy
*/
#include <stdio.h>
#include "yamalloc.h"
void *print_malloc(size_t size) {
void *ptr = malloc(size);
printf("malloc(%ld) = %p\n", size, ptr);
return ptr;
}
int main(int argc, char **argv) {
ya_print_blocks();
print_malloc(4);
print_malloc(10);
ya_print_blocks();
print_malloc(10000);
ya_print_blocks();
print_malloc(2000);
ya_print_blocks();
}

Loading…
Cancel
Save