-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e5c1631
commit 432f3d6
Showing
27 changed files
with
368 additions
and
183 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
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
2 changes: 1 addition & 1 deletion
2
src/K4os.Compression.LZ4.Roundtrip/K4os.Compression.LZ4.Roundtrip.csproj
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 |
---|---|---|
@@ -1 +1 @@ | ||
K4os.Hash.xxHash | ||
|
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,60 @@ | ||
using System; | ||
using K4os.Compression.LZ4.Streams.Test.Internal; | ||
using TestHelpers; | ||
using Xunit; | ||
|
||
namespace K4os.Compression.LZ4.Streams.Test; | ||
|
||
public class ChecksumTests | ||
{ | ||
[Theory] | ||
[InlineData(".corpus/mozilla", true, false)] | ||
[InlineData(".corpus/mozilla", false, true)] | ||
[InlineData(".corpus/mozilla", true, true)] | ||
public void ChecksumIsProduced(string filename, bool block, bool content) | ||
{ | ||
var source = Tools.FindFile(filename); | ||
|
||
using var target = TempFile.Create(); | ||
using var decoded = TempFile.Create(); | ||
|
||
var options = new LZ4Settings | ||
{ Chaining = true, BlockChecksum = block, ContentChecksum = content }; | ||
TestedLZ4.Encode(source, target.FileName, 1337, options); | ||
ReferenceLZ4.Decode(target.FileName, decoded.FileName); | ||
Tools.SameFiles(source, decoded.FileName); | ||
} | ||
|
||
[Theory] | ||
[InlineData(".corpus/mozilla", "-B4 -BD -BX")] | ||
[InlineData(".corpus/mozilla", "-B4 -BD -BX --no-frame-crc")] | ||
[InlineData(".corpus/mozilla", "-B4 -BD --no-frame-crc")] | ||
public void ChecksumIsVerified(string filename, string options) | ||
{ | ||
var source = Tools.FindFile(filename); | ||
|
||
using var target = TempFile.Create(); | ||
using var decoded = TempFile.Create(); | ||
|
||
ReferenceLZ4.Encode(options, source, target.FileName); | ||
TestedLZ4.Decode(target.FileName, decoded.FileName, 1337); | ||
Tools.SameFiles(source, decoded.FileName); | ||
} | ||
|
||
[Theory] | ||
[InlineData(".corpus/mozilla", true, false)] | ||
[InlineData(".corpus/mozilla", false, true)] | ||
[InlineData(".corpus/mozilla", true, true)] | ||
public void ChecksumIsVerifiedRoundtrip(string filename, bool block, bool content) | ||
{ | ||
var source = Tools.FindFile(filename); | ||
|
||
using var target = TempFile.Create(); | ||
using var decoded = TempFile.Create(); | ||
|
||
var options = new LZ4Settings { Chaining = true, BlockChecksum = block, ContentChecksum = content }; | ||
TestedLZ4.Encode(source, target.FileName, 1337, options); | ||
TestedLZ4.Decode(target.FileName, decoded.FileName, 1337); | ||
Tools.SameFiles(source, decoded.FileName); | ||
} | ||
} |
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
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
Oops, something went wrong.