Commit 99cb201438
Changed files (2)
lib
std
compress
flate
lib/std/compress/flate/deflate.zig
@@ -528,7 +528,11 @@ fn SimpleCompressor(
};
}
+const builtin = @import("builtin");
+
test "flate.Deflate tokenization" {
+ if (builtin.target.cpu.arch == .wasm32) return error.SkipZigTest;
+
const L = Token.initLiteral;
const M = Token.initMatch;
@@ -551,6 +555,7 @@ test "flate.Deflate tokenization" {
for (cases) |c| {
inline for (Container.list) |container| { // for each wrapping
+
var cw = io.countingWriter(io.null_writer);
const cww = cw.writer();
var df = try Deflate(container, @TypeOf(cww), TestTokenWriter).init(cww, .{});
@@ -572,9 +577,9 @@ test "flate.Deflate tokenization" {
// Tests that tokens writen are equal to expected token list.
const TestTokenWriter = struct {
const Self = @This();
- //expected: []const Token,
+
pos: usize = 0,
- actual: [1024]Token = undefined,
+ actual: [128]Token = undefined,
pub fn init(_: anytype) Self {
return .{};
@@ -603,6 +608,8 @@ const TestTokenWriter = struct {
};
test "flate deflate file tokenization" {
+ if (builtin.target.cpu.arch == .wasm32) return error.SkipZigTest;
+
const levels = [_]Level{ .level_4, .level_5, .level_6, .level_7, .level_8, .level_9 };
const cases = [_]struct {
data: []const u8, // uncompressed content
lib/std/compress/flate.zig
@@ -77,6 +77,7 @@ const std = @import("std");
const testing = std.testing;
const fixedBufferStream = std.io.fixedBufferStream;
const print = std.debug.print;
+const builtin = @import("builtin");
test "flate" {
_ = @import("flate/deflate.zig");
@@ -84,6 +85,8 @@ test "flate" {
}
test "flate compress/decompress" {
+ if (builtin.target.cpu.arch == .wasm32) return error.SkipZigTest;
+
var cmp_buf: [64 * 1024]u8 = undefined; // compressed data buffer
var dcm_buf: [64 * 1024]u8 = undefined; // decompressed data buffer
@@ -351,6 +354,8 @@ test "flate gzip header" {
}
test "flate public interface" {
+ if (builtin.target.cpu.arch == .wasm32) return error.SkipZigTest;
+
const plain_data = [_]u8{ 'H', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', 0x0a };
// deflate final stored block, header + plain (stored) data