| ... | @@ -528,7 +528,11 @@ fn SimpleCompressor( | ... | @@ -528,7 +528,11 @@ fn SimpleCompressor( |
| 528 | }; | 528 | }; |
| 529 | } | 529 | } |
| 530 | | 530 | |
| | 531 | const builtin = @import("builtin"); |
| | 532 | |
| 531 | test "flate.Deflate tokenization" { | 533 | test "flate.Deflate tokenization" { |
| | 534 | if (builtin.target.cpu.arch == .wasm32) return error.SkipZigTest; |
| | 535 | |
| 532 | const L = Token.initLiteral; | 536 | const L = Token.initLiteral; |
| 533 | const M = Token.initMatch; | 537 | const M = Token.initMatch; |
| 534 | | 538 | |
| ... | @@ -551,6 +555,7 @@ test "flate.Deflate tokenization" { | ... | @@ -551,6 +555,7 @@ test "flate.Deflate tokenization" { |
| 551 | | 555 | |
| 552 | for (cases) |c| { | 556 | for (cases) |c| { |
| 553 | inline for (Container.list) |container| { // for each wrapping | 557 | inline for (Container.list) |container| { // for each wrapping |
| | 558 | |
| 554 | var cw = io.countingWriter(io.null_writer); | 559 | var cw = io.countingWriter(io.null_writer); |
| 555 | const cww = cw.writer(); | 560 | const cww = cw.writer(); |
| 556 | var df = try Deflate(container, @TypeOf(cww), TestTokenWriter).init(cww, .{}); | 561 | var df = try Deflate(container, @TypeOf(cww), TestTokenWriter).init(cww, .{}); |
| ... | @@ -572,9 +577,9 @@ test "flate.Deflate tokenization" { | ... | @@ -572,9 +577,9 @@ test "flate.Deflate tokenization" { |
| 572 | // Tests that tokens writen are equal to expected token list. | 577 | // Tests that tokens writen are equal to expected token list. |
| 573 | const TestTokenWriter = struct { | 578 | const TestTokenWriter = struct { |
| 574 | const Self = @This(); | 579 | const Self = @This(); |
| 575 | //expected: []const Token, | 580 | |
| 576 | pos: usize = 0, | 581 | pos: usize = 0, |
| 577 | actual: [1024]Token = undefined, | 582 | actual: [128]Token = undefined, |
| 578 | | 583 | |
| 579 | pub fn init(_: anytype) Self { | 584 | pub fn init(_: anytype) Self { |
| 580 | return .{}; | 585 | return .{}; |
| ... | @@ -603,6 +608,8 @@ const TestTokenWriter = struct { | ... | @@ -603,6 +608,8 @@ const TestTokenWriter = struct { |
| 603 | }; | 608 | }; |
| 604 | | 609 | |
| 605 | test "flate deflate file tokenization" { | 610 | test "flate deflate file tokenization" { |
| | 611 | if (builtin.target.cpu.arch == .wasm32) return error.SkipZigTest; |
| | 612 | |
| 606 | const levels = [_]Level{ .level_4, .level_5, .level_6, .level_7, .level_8, .level_9 }; | 613 | const levels = [_]Level{ .level_4, .level_5, .level_6, .level_7, .level_8, .level_9 }; |
| 607 | const cases = [_]struct { | 614 | const cases = [_]struct { |
| 608 | data: []const u8, // uncompressed content | 615 | data: []const u8, // uncompressed content |