-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a method to check if the data is compressed or not
- Loading branch information
Showing
6 changed files
with
82 additions
and
7 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
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,43 @@ | ||
using System; | ||
using System.Text; | ||
using CachedQuickLz; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace CachedQuickLzTests | ||
{ | ||
[TestClass] | ||
public class CompressionCheckTests | ||
{ | ||
[TestMethod] | ||
public void TestCheckArrayIsCompressed_ImpossibleToCompress() | ||
{ | ||
var numBytes = 100; | ||
|
||
var data = new byte[numBytes]; | ||
new Random().NextBytes(data); | ||
CachedQlz.Compress(ref data, ref numBytes); | ||
|
||
Assert.IsTrue(CachedQlz.IsCompressed(data, numBytes)); | ||
} | ||
|
||
[TestMethod] | ||
public void TestCheckArrayIsCompressed_NoIssues() | ||
{ | ||
var numBytes = 5000; | ||
|
||
var text = Encoding.ASCII.GetBytes(TestCommon.RandomString(numBytes)); | ||
CachedQlz.Compress(ref text, ref numBytes); | ||
|
||
Assert.IsTrue(CachedQlz.IsCompressed(text, numBytes)); | ||
} | ||
|
||
[TestMethod] | ||
public void TestCheckArrayIsNotCompressed() | ||
{ | ||
var data = new byte[100]; | ||
new Random().NextBytes(data); | ||
|
||
Assert.IsFalse(CachedQlz.IsCompressed(data, 100)); | ||
} | ||
} | ||
} |
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