Cleanup QOI

This commit is contained in:
Christoffer Lerno
2025-02-08 00:32:48 +01:00
parent 2126be2222
commit 46c7e9aefa
2 changed files with 102 additions and 76 deletions

View File

@@ -14,18 +14,18 @@ fn void test_qoi_all()
QOIDesc test_desc;
// decode the test data
char[] decoded = qoi::decode(TEST_QOI_DATA[..], &test_desc)!!;
char[] decoded = qoi::new_decode(TEST_QOI_DATA[..], &test_desc)!!;
assert(test_desc.width == 340 && test_desc.height == 169, "Expected resolution of 340x169");
// encode the decoded data
char[] encoded = qoi::encode(decoded, &test_desc)!!;
char[] encoded = qoi::new_encode(decoded, &test_desc)!!;
assert(encoded == TEST_QOI_DATA[..], "Encoder output should match the test data");
// encode and write the decoded data to a file
usz written = qoi::write("unittest.qoi", decoded, &test_desc)!!;
// read and decode the written data
char[] read = qoi::read("unittest.qoi", &test_desc)!!;
char[] read = qoi::new_read("unittest.qoi", &test_desc)!!;
assert(read == decoded, "Read data should match the decoded data");
// cleanup