diff options
Diffstat (limited to 'tests/cyn')
-rw-r--r-- | tests/cyn/comp.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/cyn/comp.c b/tests/cyn/comp.c new file mode 100644 index 0000000..65a48f6 --- /dev/null +++ b/tests/cyn/comp.c @@ -0,0 +1,51 @@ +#include <ungrateful.h> +#include <cynic.h> + +#include <stdio.h> + +int main(void) { + + /* + u64 file_size, bytes_read; + Buffer buf, output_buffer; + Allocator talloc; + FILE *file; + + un_init(UN_KB(10)); + + talloc = un_alloc_temp_get(); + file = fopen(__FILE__, "rb"); + + if (file) { + fseek(file, 0L, SEEK_END); + file_size = ftell(file); + rewind(file); + + if (file_size == 0) { + fclose(file); + return 100; + } + + buf.size = file_size; + buf.data = un_memory_alloc(buf.size, talloc); + assert(buf.data != NULL); + + bytes_read = fread(buf.data, sizeof(u8), buf.size, file); + + if (bytes_read != buf.size) { + fclose(file); + return 120; + } + + fclose(file); + } else { + return 300; + } + + output_buffer = un_compress(buf, talloc); + + fprintf(stdout, "Compressed: %lluB, Uncompressed: %lluB\n", output_buffer.size, buf.size); + + */ + return 0; +} |