mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
🐛Move checksum initializers to instance constructors.
This commit is contained in:
@@ -35,7 +35,7 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[TestFixture]
|
||||
public class Crc64
|
||||
{
|
||||
static readonly byte[] ExpectedEmpty = {0x60, 0x6b, 0x70, 0xa2, 0x3e, 0xba, 0xf6, 0xc2};
|
||||
static readonly byte[] ExpectedEmpty = {0x60, 0x6b, 0x70, 0xa2, 0x3e, 0xba, 0xf6, 0xc2};
|
||||
static readonly byte[] ExpectedRandom = {0xbf, 0x09, 0x99, 0x2c, 0xc5, 0xed, 0xe3, 0x8e};
|
||||
|
||||
[Test]
|
||||
@@ -48,9 +48,9 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Crc64EmptyData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
@@ -61,14 +61,13 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Crc64EmptyInstance()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
IChecksum ctx = new Crc64Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
@@ -84,9 +83,9 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Crc64RandomData()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
@@ -97,14 +96,13 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Crc64RandomInstance()
|
||||
{
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
byte[] data = new byte[1048576];
|
||||
FileStream fs = new FileStream(Path.Combine(Consts.TestFilesRoot, "checksums", "random"), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
fs.Read(data, 0, 1048576);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
IChecksum ctx = new Crc64Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
|
||||
Reference in New Issue
Block a user