aboutsummaryrefslogtreecommitdiff
path: root/tests/cyn/comp.c
diff options
context:
space:
mode:
authorbonmas14 <bonmas14@gmail.com>2025-09-29 19:58:12 +0300
committerbonmas14 <bonmas14@gmail.com>2025-09-29 19:58:12 +0300
commit51ecf18f6ce5b9e06ec61423548270b4746f379d (patch)
treec2c3ffbbb1fd8ef52fa311851a45ed04ff2bb925 /tests/cyn/comp.c
parent099519b45594827aad7c85f84816ae9b0cdd4698 (diff)
downloadungrateful-51ecf18f6ce5b9e06ec61423548270b4746f379d.tar.gz
ungrateful-51ecf18f6ce5b9e06ec61423548270b4746f379d.zip
Added zlib
Diffstat (limited to 'tests/cyn/comp.c')
-rw-r--r--tests/cyn/comp.c51
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;
+}