test: update tests

This commit is contained in:
2025-10-28 15:21:19 +00:00
parent 2d29713f57
commit 6639a84a78
9 changed files with 63 additions and 96 deletions

View File

@@ -1,7 +1,7 @@
#include <assert.h>
#include <blue/compress/compressor.h>
#include <blue/compress/cstream.h>
#include <blue/compress/function.h>
#include <blue/compress/zstd.h>
#include <blue/core/ringbuffer.h>
#include <blue/core/stream.h>
#include <stdio.h>
@@ -26,14 +26,7 @@ int main(int argc, const char **argv)
return -1;
}
const b_compression_function *zstd
= b_compression_function_get_by_id(B_COMPRESSOR_FUNCTION_ZSTD);
if (!zstd) {
fprintf(stderr, "zstd support not enabled\n");
return -1;
}
b_compression_mode mode = B_COMPRESSION_MODE_COMPRESS;
b_compressor_mode mode = B_COMPRESSOR_MODE_COMPRESS;
FILE *out_fp = fopen(argv[1], "wb");
if (!out_fp) {
@@ -43,7 +36,7 @@ int main(int argc, const char **argv)
b_stream *out_stream = b_stream_open_fp(out_fp);
b_cstream *cstream;
b_cstream_open(out_stream, zstd, mode, &cstream);
b_cstream_open(out_stream, B_TYPE_ZSTD_COMPRESSOR, mode, &cstream);
const size_t source_len = strlen(source);
bool compressed = false;
@@ -81,7 +74,7 @@ int main(int argc, const char **argv)
printf("Done\n");
b_cstream_close(cstream);
b_cstream_unref(cstream);
b_stream_unref(out_stream);
fclose(out_fp);