-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support for stored DEFLATE blocks, fixing #64
- Loading branch information
1 parent
aa3c213
commit c7080fe
Showing
8 changed files
with
144 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
extension LZ77 | ||
{ | ||
enum BlockShape | ||
{ | ||
case dynamic (final:Bool, literals:Int, distances:Int) | ||
case fixed (final:Bool) | ||
case bytes (final:Bool, count:Int) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import LZ77 | ||
import Testing | ||
|
||
extension Main | ||
{ | ||
enum CompressionMicro | ||
{ | ||
} | ||
} | ||
extension Main.CompressionMicro:TestBattery | ||
{ | ||
static | ||
func run(tests:TestGroup) | ||
{ | ||
if let tests:TestGroup = tests / "Empty" | ||
{ | ||
Self.roundtrip(bytes: [], with: tests) | ||
} | ||
if let tests:TestGroup = tests / "OneByte" | ||
{ | ||
Self.roundtrip(bytes: [1], with: tests) | ||
} | ||
if let tests:TestGroup = tests / "TwoBytes" | ||
{ | ||
Self.roundtrip(bytes: [2, 3], with: tests) | ||
} | ||
if let tests:TestGroup = tests / "ThreeBytes" | ||
{ | ||
Self.roundtrip(bytes: [4, 5, 6], with: tests) | ||
} | ||
} | ||
|
||
private static | ||
func roundtrip(bytes:[UInt8], with tests:TestGroup) | ||
{ | ||
let archive:[UInt8] = Gzip.archive(bytes: bytes[...], level: 10) | ||
tests.do | ||
{ | ||
tests.expect(try Gzip.extract(from: archive[...]) ..? bytes) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters