Removed file
This commit is contained in:
39
tests/_
39
tests/_
@@ -1,39 +0,0 @@
|
||||
#define DEBUG
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "../include/mem.h"
|
||||
#include <unistd.h>
|
||||
int main(void){
|
||||
size_t count = 20;
|
||||
size_t nbytes = sizeof(int32_t) * count;
|
||||
struct Arena_Type mem = ARENA_TYPE(HARD_FAIL, ARENA_INT_32, count);
|
||||
ASSERTED(mem.buf.beg != NULL);
|
||||
ASSERTED( mem_is_zero(mem.buf.beg, nbytes));
|
||||
ASSERTED( (size_t)(mem.buf.end - mem.buf.beg) == nbytes);
|
||||
size_t size = (size_t)(mem.buf.end - mem.buf.beg);
|
||||
ASSERTED(mem.header.type != arena_id_to_header[ARENA_UINT_32]);
|
||||
ASSERTED(mem.header.type == arena_id_to_header[ARENA_INT_32]);
|
||||
ASSERTED(mem.was_malloc == 1);
|
||||
(void) size;
|
||||
/*
|
||||
printf("Bytes: %ld\t Alignment: %ld\t Type_Size: %ld\t Type_ID: %d\t Type_Header:%c\n",
|
||||
size, size/count, size/count, mem.header.type, mem.header.type);
|
||||
*/
|
||||
unsigned char *ptr = mem.buf.beg;
|
||||
int32_t *arr = ARENA_ALLOC(0, &mem.buf, sizeof(int32_t), sizeof(int32_t), count);
|
||||
for (int i = 0; i < 20; i++){
|
||||
arr[i] = rand();
|
||||
}
|
||||
ASSERTED(ptr != NULL);
|
||||
|
||||
char template[] = "/tmp/intfileXXXXXX";
|
||||
int fd;
|
||||
fd = mkstemp(template);
|
||||
write(fd, ptr, nbytes);
|
||||
lseek(fd,0,SEEK_SET);
|
||||
unsigned char buf[nbytes];
|
||||
ssize_t bytesread = read(fd, buf, nbytes);
|
||||
printf("Read %ld bytes\n",bytesread);
|
||||
free(ptr);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user