From 51ecf18f6ce5b9e06ec61423548270b4746f379d Mon Sep 17 00:00:00 2001 From: bonmas14 Date: Mon, 29 Sep 2025 19:58:12 +0300 Subject: Added zlib --- tests/cyn/comp.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 tests/cyn/comp.c (limited to 'tests/cyn/comp.c') 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 +#include + +#include + +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; +} -- cgit v1.2.3-70-g09d2