rockbox/apps/plugins/pdbox/dbestfit-3.3/mytest.c
Peter D'Hoye 526b5580da Cut the files in half and it might work better (note to self: check your tree is really clean before patching)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21070 a1c6a512-1295-4272-9138-f99709370657
2009-05-24 21:28:16 +00:00

69 lines
1.2 KiB
C

#include <stdio.h>
#include <stdlib.h>
#include "bmalloc.h"
int main(int argc, char **argv)
{
void *pointers[5];
int i;
void *area;
for(i=0; i<5; i++)
pointers[i] = malloc(8000);
if(argc>1) {
switch(argv[1][0]) {
case '1':
for(i=0; i<5; i++) {
add_pool(pointers[i], 4000);
add_pool((char *)pointers[i]+4000, 4000);
}
break;
case '2':
area = malloc(20000);
add_pool(area, 3000);
add_pool((char *)area+6000, 3000);
add_pool((char *)area+3000, 3000);
add_pool((char *)area+12000, 3000);
add_pool((char *)area+9000, 3000);
break;
case '3':
{
void *ptr[10];
area = malloc(20000);
add_pool(area, 20000);
printf(" ** TEST USAGE\n");
for(i=0; i<9; i++)
ptr[i]=bmalloc(200);
print_lists();
for(i=0; i<9; i++)
bfree(ptr[i]);
printf(" ** END OF TEST USAGE\n");
}
break;
case '4':
{
void *ptr[10];
area = malloc(20000);
add_pool(area, 20000);
ptr[0]=bmalloc(4080);
print_lists();
bfree(ptr[0]);
printf(" ** END OF TEST USAGE\n");
}
break;
}
}
else
for(i=4; i>=0; i--)
add_pool(pointers[i], 8000-i*100);
print_lists();
return 0;
}