@@ 1,6 1,28 @@
// License: MPL-2.0
// (c) 2021 Ember Sawady <ecs@d2evs.net>
+@test fn decompress() void = {
+ for (let i = 1z; i < len(vectors); i += 1) {
+ let in = bufio::fixed(*vectors[i].1, io::mode::READ);
+ let out = bufio::dynamic(io::mode::WRITE);
+ let d = match (decompress(&in)) {
+ case let s: reader =>
+ yield s;
+ case let e: io::error =>
+ fmt::errorln(io::strerror(e))!;
+ abort();
+ };
+ match (io::copy(&out, &d)) {
+ case size => void;
+ case let e: io::error =>
+ fmt::errorfln("vector {}: {}", i, io::strerror(e))!;
+ abort();
+ };
+ let s = bufio::buffer(&out);
+ assert(bytes::equal(s, *vectors[i].0));
+ };
+};
+
const null_in: []u8 = [
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ 159,25 159,3 @@ const reader_vtable: io::vtable = io::vtable {
closer = &close,
...
};
-
-@test fn decompress() void = {
- for (let i = 1z; i < len(vectors); i += 1) {
- let in = bufio::fixed(*vectors[i].1, io::mode::READ);
- let out = bufio::dynamic(io::mode::WRITE);
- let d = match (decompress(&in)) {
- case let s: reader =>
- yield s;
- case let e: io::error =>
- fmt::errorln(io::strerror(e))!;
- abort();
- };
- match (io::copy(&out, &d)) {
- case size => void;
- case let e: io::error =>
- fmt::errorfln("vector {}: {}", i, io::strerror(e))!;
- abort();
- };
- let s = bufio::buffer(&out);
- assert(bytes::equal(s, *vectors[i].0));
- };
-};