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 Adler32
|
||||
{
|
||||
static readonly byte[] ExpectedEmpty = {0x00, 0xf0, 0x00, 0x01};
|
||||
static readonly byte[] ExpectedEmpty = {0x00, 0xf0, 0x00, 0x01};
|
||||
static readonly byte[] ExpectedRandom = {0x37, 0x28, 0xd1, 0x86};
|
||||
|
||||
[Test]
|
||||
@@ -48,9 +48,9 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Adler32EmptyData()
|
||||
{
|
||||
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 Adler32EmptyInstance()
|
||||
{
|
||||
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 Adler32Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
@@ -84,9 +83,9 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Adler32RandomData()
|
||||
{
|
||||
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 Adler32RandomInstance()
|
||||
{
|
||||
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 Adler32Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[TestFixture]
|
||||
public class Crc16
|
||||
{
|
||||
static readonly byte[] ExpectedEmpty = {0x00, 0x00};
|
||||
static readonly byte[] ExpectedEmpty = {0x00, 0x00};
|
||||
static readonly byte[] ExpectedRandom = {0x2d, 0x6d};
|
||||
|
||||
[Test]
|
||||
@@ -48,9 +48,9 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Crc16EmptyData()
|
||||
{
|
||||
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 Crc16EmptyInstance()
|
||||
{
|
||||
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 Crc16Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
@@ -84,9 +83,9 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Crc16RandomData()
|
||||
{
|
||||
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 Crc16RandomInstance()
|
||||
{
|
||||
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 Crc16Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[TestFixture]
|
||||
public class Crc32
|
||||
{
|
||||
static readonly byte[] ExpectedEmpty = {0xa7, 0x38, 0xea, 0x1c};
|
||||
static readonly byte[] ExpectedEmpty = {0xa7, 0x38, 0xea, 0x1c};
|
||||
static readonly byte[] ExpectedRandom = {0x2b, 0x6e, 0x68, 0x54};
|
||||
|
||||
[Test]
|
||||
@@ -48,9 +48,9 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Crc32EmptyData()
|
||||
{
|
||||
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 Crc32EmptyInstance()
|
||||
{
|
||||
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 Crc32Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
@@ -84,9 +83,9 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Crc32RandomData()
|
||||
{
|
||||
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 Crc32RandomInstance()
|
||||
{
|
||||
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 Crc32Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -43,23 +43,21 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Md5EmptyFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"));
|
||||
Md5Context ctx = new Md5Context();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"));
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Md5EmptyData()
|
||||
{
|
||||
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();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
ctx.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
@@ -67,14 +65,13 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Md5EmptyInstance()
|
||||
{
|
||||
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 Md5Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
@@ -83,23 +80,21 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Md5RandomFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "random"));
|
||||
Md5Context ctx = new Md5Context();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "random"));
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Md5RandomData()
|
||||
{
|
||||
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();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
ctx.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
@@ -107,14 +102,13 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Md5RandomInstance()
|
||||
{
|
||||
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 Md5Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
|
||||
@@ -49,23 +49,21 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Ripemd160EmptyFile()
|
||||
{
|
||||
Ripemd160Context ctx = new Ripemd160Context();
|
||||
ctx.Init();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"));
|
||||
Ripemd160Context ctx = new Ripemd160Context();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"));
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ripemd160EmptyData()
|
||||
{
|
||||
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();
|
||||
Ripemd160Context ctx = new Ripemd160Context();
|
||||
ctx.Init();
|
||||
ctx.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
@@ -73,14 +71,13 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Ripemd160EmptyInstance()
|
||||
{
|
||||
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 Ripemd160Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
@@ -89,23 +86,21 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Ripemd160RandomFile()
|
||||
{
|
||||
Ripemd160Context ctx = new Ripemd160Context();
|
||||
ctx.Init();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "random"));
|
||||
Ripemd160Context ctx = new Ripemd160Context();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "random"));
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ripemd160RandomData()
|
||||
{
|
||||
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();
|
||||
Ripemd160Context ctx = new Ripemd160Context();
|
||||
ctx.Init();
|
||||
ctx.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
@@ -113,14 +108,13 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Ripemd160RandomInstance()
|
||||
{
|
||||
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 Ripemd160Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
|
||||
@@ -49,23 +49,21 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Sha1EmptyFile()
|
||||
{
|
||||
Sha1Context ctx = new Sha1Context();
|
||||
ctx.Init();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"));
|
||||
Sha1Context ctx = new Sha1Context();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"));
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha1EmptyData()
|
||||
{
|
||||
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();
|
||||
Sha1Context ctx = new Sha1Context();
|
||||
ctx.Init();
|
||||
ctx.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
@@ -73,14 +71,13 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Sha1EmptyInstance()
|
||||
{
|
||||
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 Sha1Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
@@ -89,23 +86,21 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Sha1RandomFile()
|
||||
{
|
||||
Sha1Context ctx = new Sha1Context();
|
||||
ctx.Init();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "random"));
|
||||
Sha1Context ctx = new Sha1Context();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "random"));
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha1RandomData()
|
||||
{
|
||||
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();
|
||||
Sha1Context ctx = new Sha1Context();
|
||||
ctx.Init();
|
||||
ctx.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
@@ -113,14 +108,13 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Sha1RandomInstance()
|
||||
{
|
||||
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 Sha1Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
|
||||
@@ -49,23 +49,21 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Sha256EmptyFile()
|
||||
{
|
||||
Sha256Context ctx = new Sha256Context();
|
||||
ctx.Init();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"));
|
||||
Sha256Context ctx = new Sha256Context();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"));
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha256EmptyData()
|
||||
{
|
||||
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();
|
||||
Sha256Context ctx = new Sha256Context();
|
||||
ctx.Init();
|
||||
ctx.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
@@ -73,14 +71,13 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Sha256EmptyInstance()
|
||||
{
|
||||
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 Sha256Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
@@ -89,23 +86,21 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Sha256RandomFile()
|
||||
{
|
||||
Sha256Context ctx = new Sha256Context();
|
||||
ctx.Init();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "random"));
|
||||
Sha256Context ctx = new Sha256Context();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "random"));
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha256RandomData()
|
||||
{
|
||||
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();
|
||||
Sha256Context ctx = new Sha256Context();
|
||||
ctx.Init();
|
||||
ctx.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
@@ -113,14 +108,13 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Sha256RandomInstance()
|
||||
{
|
||||
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 Sha256Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
|
||||
@@ -51,23 +51,21 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Sha384EmptyFile()
|
||||
{
|
||||
Sha384Context ctx = new Sha384Context();
|
||||
ctx.Init();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"));
|
||||
Sha384Context ctx = new Sha384Context();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"));
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha384EmptyData()
|
||||
{
|
||||
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();
|
||||
Sha384Context ctx = new Sha384Context();
|
||||
ctx.Init();
|
||||
ctx.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
@@ -75,14 +73,13 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Sha384EmptyInstance()
|
||||
{
|
||||
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 Sha384Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
@@ -91,23 +88,21 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Sha384RandomFile()
|
||||
{
|
||||
Sha384Context ctx = new Sha384Context();
|
||||
ctx.Init();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "random"));
|
||||
Sha384Context ctx = new Sha384Context();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "random"));
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha384RandomData()
|
||||
{
|
||||
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();
|
||||
Sha384Context ctx = new Sha384Context();
|
||||
ctx.Init();
|
||||
ctx.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
@@ -115,14 +110,13 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Sha384RandomInstance()
|
||||
{
|
||||
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 Sha384Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
|
||||
@@ -53,23 +53,21 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Sha512EmptyFile()
|
||||
{
|
||||
Sha512Context ctx = new Sha512Context();
|
||||
ctx.Init();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"));
|
||||
Sha512Context ctx = new Sha512Context();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "empty"));
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha512EmptyData()
|
||||
{
|
||||
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();
|
||||
Sha512Context ctx = new Sha512Context();
|
||||
ctx.Init();
|
||||
ctx.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
}
|
||||
@@ -77,14 +75,13 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Sha512EmptyInstance()
|
||||
{
|
||||
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 Sha512Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedEmpty, result);
|
||||
@@ -93,23 +90,21 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Sha512RandomFile()
|
||||
{
|
||||
Sha512Context ctx = new Sha512Context();
|
||||
ctx.Init();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "random"));
|
||||
Sha512Context ctx = new Sha512Context();
|
||||
byte[] result = ctx.File(Path.Combine(Consts.TestFilesRoot, "checksums", "random"));
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Sha512RandomData()
|
||||
{
|
||||
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();
|
||||
Sha512Context ctx = new Sha512Context();
|
||||
ctx.Init();
|
||||
ctx.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
}
|
||||
@@ -117,14 +112,13 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void Sha512RandomInstance()
|
||||
{
|
||||
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 Sha512Context();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
byte[] result = ctx.Final();
|
||||
Assert.AreEqual(ExpectedRandom, result);
|
||||
|
||||
@@ -35,15 +35,15 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[TestFixture]
|
||||
public class SpamSum
|
||||
{
|
||||
const string EXPECTED_EMPTY = "3::";
|
||||
const string EXPECTED_EMPTY = "3::";
|
||||
const string EXPECTED_RANDOM = "24576:3dvzuAsHTQ16pc7O1Q/gS9qze+Swwn9s6IX:8/TQQpaVqze+JN6IX";
|
||||
|
||||
[Test]
|
||||
public void SpamSumEmptyData()
|
||||
{
|
||||
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();
|
||||
@@ -54,14 +54,13 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void SpamSumEmptyInstance()
|
||||
{
|
||||
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 SpamSumContext();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
string result = ctx.End();
|
||||
Assert.AreEqual(EXPECTED_EMPTY, result);
|
||||
@@ -70,9 +69,9 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void SpamSumRandomData()
|
||||
{
|
||||
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();
|
||||
@@ -83,14 +82,13 @@ namespace DiscImageChef.Tests.Checksums
|
||||
[Test]
|
||||
public void SpamSumRandomInstance()
|
||||
{
|
||||
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 SpamSumContext();
|
||||
ctx.Init();
|
||||
ctx.Update(data);
|
||||
string result = ctx.End();
|
||||
Assert.AreEqual(EXPECTED_RANDOM, result);
|
||||
|
||||
@@ -36,30 +36,28 @@ namespace DiscImageChef.Tests.Filters
|
||||
[TestFixture]
|
||||
public class AppleDoubleDave
|
||||
{
|
||||
const string EXPECTED_FILE = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_SIDECAR = "7b0c25bf8cb70f6fb1a15eca31585250";
|
||||
const string EXPECTED_CONTENTS = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_RESOURCE = "a972d27c44193a7587b21416c0953cc3";
|
||||
const string EXPECTED_FILE = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_SIDECAR = "7b0c25bf8cb70f6fb1a15eca31585250";
|
||||
const string EXPECTED_CONTENTS = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_RESOURCE = "a972d27c44193a7587b21416c0953cc3";
|
||||
readonly string location;
|
||||
readonly string sidecar;
|
||||
|
||||
public AppleDoubleDave()
|
||||
{
|
||||
location = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "dave", "DOS_720.dmg");
|
||||
sidecar = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "dave", "resource.frk",
|
||||
"DOS_720.dmg");
|
||||
sidecar = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "dave", "resource.frk",
|
||||
"DOS_720.dmg");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.File(location, out _);
|
||||
Assert.AreEqual(EXPECTED_FILE, result);
|
||||
|
||||
ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
ctx = new Md5Context();
|
||||
result = ctx.File(sidecar, out _);
|
||||
Assert.AreEqual(EXPECTED_SIDECAR, result);
|
||||
}
|
||||
@@ -76,7 +74,7 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new AppleDouble();
|
||||
filter.Open(location);
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(737280, filter.GetDataForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
||||
Assert.AreEqual(286, filter.GetResourceForkLength());
|
||||
@@ -90,15 +88,14 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new AppleDouble();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetDataForkStream();
|
||||
Stream str = filter.GetDataForkStream();
|
||||
byte[] data = new byte[737280];
|
||||
str.Read(data, 0, 737280);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
||||
}
|
||||
|
||||
@@ -107,15 +104,14 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new AppleDouble();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
byte[] data = new byte[286];
|
||||
str.Read(data, 0, 286);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,29 +36,27 @@ namespace DiscImageChef.Tests.Filters
|
||||
[TestFixture]
|
||||
public class AppleDoubleDos
|
||||
{
|
||||
const string EXPECTED_FILE = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_SIDECAR = "7b0c25bf8cb70f6fb1a15eca31585250";
|
||||
const string EXPECTED_CONTENTS = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_RESOURCE = "a972d27c44193a7587b21416c0953cc3";
|
||||
const string EXPECTED_FILE = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_SIDECAR = "7b0c25bf8cb70f6fb1a15eca31585250";
|
||||
const string EXPECTED_CONTENTS = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_RESOURCE = "a972d27c44193a7587b21416c0953cc3";
|
||||
readonly string location;
|
||||
readonly string sidecar;
|
||||
|
||||
public AppleDoubleDos()
|
||||
{
|
||||
location = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "dos", "DOS_720.dmg");
|
||||
sidecar = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "dos", "DOS_720.adf");
|
||||
sidecar = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "dos", "DOS_720.adf");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.File(location, out _);
|
||||
Assert.AreEqual(EXPECTED_FILE, result);
|
||||
|
||||
ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
ctx = new Md5Context();
|
||||
result = ctx.File(sidecar, out _);
|
||||
Assert.AreEqual(EXPECTED_SIDECAR, result);
|
||||
}
|
||||
@@ -75,7 +73,7 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new AppleDouble();
|
||||
filter.Open(location);
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(737280, filter.GetDataForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
||||
Assert.AreEqual(286, filter.GetResourceForkLength());
|
||||
@@ -89,15 +87,14 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new AppleDouble();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetDataForkStream();
|
||||
Stream str = filter.GetDataForkStream();
|
||||
byte[] data = new byte[737280];
|
||||
str.Read(data, 0, 737280);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
||||
}
|
||||
|
||||
@@ -106,15 +103,14 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new AppleDouble();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
byte[] data = new byte[286];
|
||||
str.Read(data, 0, 286);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,30 +36,28 @@ namespace DiscImageChef.Tests.Filters
|
||||
[TestFixture]
|
||||
public class AppleDoubleNetatalk
|
||||
{
|
||||
const string EXPECTED_FILE = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_SIDECAR = "7b0c25bf8cb70f6fb1a15eca31585250";
|
||||
const string EXPECTED_CONTENTS = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_RESOURCE = "a972d27c44193a7587b21416c0953cc3";
|
||||
const string EXPECTED_FILE = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_SIDECAR = "7b0c25bf8cb70f6fb1a15eca31585250";
|
||||
const string EXPECTED_CONTENTS = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_RESOURCE = "a972d27c44193a7587b21416c0953cc3";
|
||||
readonly string location;
|
||||
readonly string sidecar;
|
||||
|
||||
public AppleDoubleNetatalk()
|
||||
{
|
||||
location = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "netatalk", "DOS_720.dmg");
|
||||
sidecar = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "netatalk", ".AppleDouble",
|
||||
"DOS_720.dmg");
|
||||
sidecar = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "netatalk", ".AppleDouble",
|
||||
"DOS_720.dmg");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.File(location, out _);
|
||||
Assert.AreEqual(EXPECTED_FILE, result);
|
||||
|
||||
ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
ctx = new Md5Context();
|
||||
result = ctx.File(sidecar, out _);
|
||||
Assert.AreEqual(EXPECTED_SIDECAR, result);
|
||||
}
|
||||
@@ -76,7 +74,7 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new AppleDouble();
|
||||
filter.Open(location);
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(737280, filter.GetDataForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
||||
Assert.AreEqual(286, filter.GetResourceForkLength());
|
||||
@@ -90,15 +88,14 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new AppleDouble();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetDataForkStream();
|
||||
Stream str = filter.GetDataForkStream();
|
||||
byte[] data = new byte[737280];
|
||||
str.Read(data, 0, 737280);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
||||
}
|
||||
|
||||
@@ -107,15 +104,14 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new AppleDouble();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
byte[] data = new byte[286];
|
||||
str.Read(data, 0, 286);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,29 +36,27 @@ namespace DiscImageChef.Tests.Filters
|
||||
[TestFixture]
|
||||
public class AppleDoubleOsX
|
||||
{
|
||||
const string EXPECTED_FILE = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_SIDECAR = "7b0c25bf8cb70f6fb1a15eca31585250";
|
||||
const string EXPECTED_CONTENTS = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_RESOURCE = "a972d27c44193a7587b21416c0953cc3";
|
||||
const string EXPECTED_FILE = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_SIDECAR = "7b0c25bf8cb70f6fb1a15eca31585250";
|
||||
const string EXPECTED_CONTENTS = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_RESOURCE = "a972d27c44193a7587b21416c0953cc3";
|
||||
readonly string location;
|
||||
readonly string sidecar;
|
||||
|
||||
public AppleDoubleOsX()
|
||||
{
|
||||
location = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "osx", "DOS_720.dmg");
|
||||
sidecar = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "osx", "._DOS_720.dmg");
|
||||
sidecar = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "osx", "._DOS_720.dmg");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.File(location, out _);
|
||||
Assert.AreEqual(EXPECTED_FILE, result);
|
||||
|
||||
ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
ctx = new Md5Context();
|
||||
result = ctx.File(sidecar, out _);
|
||||
Assert.AreEqual(EXPECTED_SIDECAR, result);
|
||||
}
|
||||
@@ -75,7 +73,7 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new AppleDouble();
|
||||
filter.Open(location);
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(737280, filter.GetDataForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
||||
Assert.AreEqual(286, filter.GetResourceForkLength());
|
||||
@@ -89,15 +87,14 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new AppleDouble();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetDataForkStream();
|
||||
Stream str = filter.GetDataForkStream();
|
||||
byte[] data = new byte[737280];
|
||||
str.Read(data, 0, 737280);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
||||
}
|
||||
|
||||
@@ -106,15 +103,14 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new AppleDouble();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
byte[] data = new byte[286];
|
||||
str.Read(data, 0, 286);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,29 +36,27 @@ namespace DiscImageChef.Tests.Filters
|
||||
[TestFixture]
|
||||
public class AppleDoubleProDos
|
||||
{
|
||||
const string EXPECTED_FILE = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_SIDECAR = "7b0c25bf8cb70f6fb1a15eca31585250";
|
||||
const string EXPECTED_CONTENTS = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_RESOURCE = "a972d27c44193a7587b21416c0953cc3";
|
||||
const string EXPECTED_FILE = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_SIDECAR = "7b0c25bf8cb70f6fb1a15eca31585250";
|
||||
const string EXPECTED_CONTENTS = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_RESOURCE = "a972d27c44193a7587b21416c0953cc3";
|
||||
readonly string location;
|
||||
readonly string sidecar;
|
||||
|
||||
public AppleDoubleProDos()
|
||||
{
|
||||
location = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "prodos", "DOS_720.dmg");
|
||||
sidecar = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "prodos", "R.DOS_720.dmg");
|
||||
sidecar = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "prodos", "R.DOS_720.dmg");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.File(location, out _);
|
||||
Assert.AreEqual(EXPECTED_FILE, result);
|
||||
|
||||
ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
ctx = new Md5Context();
|
||||
result = ctx.File(sidecar, out _);
|
||||
Assert.AreEqual(EXPECTED_SIDECAR, result);
|
||||
}
|
||||
@@ -75,7 +73,7 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new AppleDouble();
|
||||
filter.Open(location);
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(737280, filter.GetDataForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
||||
Assert.AreEqual(286, filter.GetResourceForkLength());
|
||||
@@ -89,15 +87,14 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new AppleDouble();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetDataForkStream();
|
||||
Stream str = filter.GetDataForkStream();
|
||||
byte[] data = new byte[737280];
|
||||
str.Read(data, 0, 737280);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
||||
}
|
||||
|
||||
@@ -106,15 +103,14 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new AppleDouble();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
byte[] data = new byte[286];
|
||||
str.Read(data, 0, 286);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,29 +36,27 @@ namespace DiscImageChef.Tests.Filters
|
||||
[TestFixture]
|
||||
public class AppleDoubleUnAr
|
||||
{
|
||||
const string EXPECTED_FILE = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_SIDECAR = "7b0c25bf8cb70f6fb1a15eca31585250";
|
||||
const string EXPECTED_CONTENTS = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_RESOURCE = "a972d27c44193a7587b21416c0953cc3";
|
||||
const string EXPECTED_FILE = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_SIDECAR = "7b0c25bf8cb70f6fb1a15eca31585250";
|
||||
const string EXPECTED_CONTENTS = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_RESOURCE = "a972d27c44193a7587b21416c0953cc3";
|
||||
readonly string location;
|
||||
readonly string sidecar;
|
||||
|
||||
public AppleDoubleUnAr()
|
||||
{
|
||||
location = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "unar", "DOS_720.dmg");
|
||||
sidecar = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "unar", "DOS_720.dmg.rsrc");
|
||||
sidecar = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "unar", "DOS_720.dmg.rsrc");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.File(location, out _);
|
||||
Assert.AreEqual(EXPECTED_FILE, result);
|
||||
|
||||
ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
ctx = new Md5Context();
|
||||
result = ctx.File(sidecar, out _);
|
||||
Assert.AreEqual(EXPECTED_SIDECAR, result);
|
||||
}
|
||||
@@ -75,7 +73,7 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new AppleDouble();
|
||||
filter.Open(location);
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(737280, filter.GetDataForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
||||
Assert.AreEqual(286, filter.GetResourceForkLength());
|
||||
@@ -89,15 +87,14 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new AppleDouble();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetDataForkStream();
|
||||
Stream str = filter.GetDataForkStream();
|
||||
byte[] data = new byte[737280];
|
||||
str.Read(data, 0, 737280);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
||||
}
|
||||
|
||||
@@ -106,15 +103,14 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new AppleDouble();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
byte[] data = new byte[286];
|
||||
str.Read(data, 0, 286);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,29 +36,27 @@ namespace DiscImageChef.Tests.Filters
|
||||
[TestFixture]
|
||||
public class AppleDoubleUnix
|
||||
{
|
||||
const string EXPECTED_FILE = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_SIDECAR = "7b0c25bf8cb70f6fb1a15eca31585250";
|
||||
const string EXPECTED_CONTENTS = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_RESOURCE = "a972d27c44193a7587b21416c0953cc3";
|
||||
const string EXPECTED_FILE = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_SIDECAR = "7b0c25bf8cb70f6fb1a15eca31585250";
|
||||
const string EXPECTED_CONTENTS = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_RESOURCE = "a972d27c44193a7587b21416c0953cc3";
|
||||
readonly string location;
|
||||
readonly string sidecar;
|
||||
|
||||
public AppleDoubleUnix()
|
||||
{
|
||||
location = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "unix", "DOS_720.dmg");
|
||||
sidecar = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "unix", "%DOS_720.dmg");
|
||||
sidecar = Path.Combine(Consts.TestFilesRoot, "filters", "appledouble", "unix", "%DOS_720.dmg");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.File(location, out _);
|
||||
Assert.AreEqual(EXPECTED_FILE, result);
|
||||
|
||||
ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
ctx = new Md5Context();
|
||||
result = ctx.File(sidecar, out _);
|
||||
Assert.AreEqual(EXPECTED_SIDECAR, result);
|
||||
}
|
||||
@@ -75,7 +73,7 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new AppleDouble();
|
||||
filter.Open(location);
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(737280, filter.GetDataForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
||||
Assert.AreEqual(286, filter.GetResourceForkLength());
|
||||
@@ -89,15 +87,14 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new AppleDouble();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetDataForkStream();
|
||||
Stream str = filter.GetDataForkStream();
|
||||
byte[] data = new byte[737280];
|
||||
str.Read(data, 0, 737280);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
||||
}
|
||||
|
||||
@@ -106,15 +103,14 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new AppleDouble();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
byte[] data = new byte[286];
|
||||
str.Read(data, 0, 286);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,9 +36,9 @@ namespace DiscImageChef.Tests.Filters
|
||||
[TestFixture]
|
||||
public class AppleSingle
|
||||
{
|
||||
const string EXPECTED_FILE = "7497a3b156dcd0c1046a1ab12e188ab7";
|
||||
const string EXPECTED_CONTENTS = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_RESOURCE = "a972d27c44193a7587b21416c0953cc3";
|
||||
const string EXPECTED_FILE = "7497a3b156dcd0c1046a1ab12e188ab7";
|
||||
const string EXPECTED_CONTENTS = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_RESOURCE = "a972d27c44193a7587b21416c0953cc3";
|
||||
readonly string location;
|
||||
|
||||
public AppleSingle()
|
||||
@@ -49,9 +49,8 @@ namespace DiscImageChef.Tests.Filters
|
||||
[Test]
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.File(location, out _);
|
||||
Assert.AreEqual(EXPECTED_FILE, result);
|
||||
}
|
||||
|
||||
@@ -67,7 +66,7 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new DiscImageChef.Filters.AppleSingle();
|
||||
filter.Open(location);
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(737280, filter.GetDataForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
||||
Assert.AreEqual(286, filter.GetResourceForkLength());
|
||||
@@ -81,15 +80,14 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new DiscImageChef.Filters.AppleSingle();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetDataForkStream();
|
||||
Stream str = filter.GetDataForkStream();
|
||||
byte[] data = new byte[737280];
|
||||
str.Read(data, 0, 737280);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
||||
}
|
||||
|
||||
@@ -98,15 +96,14 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new DiscImageChef.Filters.AppleSingle();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
byte[] data = new byte[286];
|
||||
str.Read(data, 0, 286);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,9 +50,8 @@ namespace DiscImageChef.Tests.Filters
|
||||
[Test]
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
byte[] result = ctx.File(location);
|
||||
Md5Context ctx = new Md5Context();
|
||||
byte[] result = ctx.File(location);
|
||||
Assert.AreEqual(ExpectedFile, result);
|
||||
}
|
||||
|
||||
@@ -68,11 +67,11 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new DiscImageChef.Filters.BZip2();
|
||||
filter.Open(location);
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(1048576, filter.GetDataForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
||||
Assert.AreEqual(0, filter.GetResourceForkLength());
|
||||
Assert.AreEqual(null, filter.GetResourceForkStream());
|
||||
Assert.AreEqual(0, filter.GetResourceForkLength());
|
||||
Assert.AreEqual(null, filter.GetResourceForkStream());
|
||||
Assert.AreEqual(false, filter.HasResourceFork());
|
||||
filter.Close();
|
||||
}
|
||||
@@ -82,14 +81,13 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new DiscImageChef.Filters.BZip2();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetDataForkStream();
|
||||
Stream str = filter.GetDataForkStream();
|
||||
byte[] data = new byte[1048576];
|
||||
str.Read(data, 0, 1048576);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
ctx.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedContents, result);
|
||||
}
|
||||
|
||||
@@ -50,9 +50,8 @@ namespace DiscImageChef.Tests.Filters
|
||||
[Test]
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
byte[] result = ctx.File(location);
|
||||
Md5Context ctx = new Md5Context();
|
||||
byte[] result = ctx.File(location);
|
||||
Assert.AreEqual(ExpectedFile, result);
|
||||
}
|
||||
|
||||
@@ -68,11 +67,11 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new DiscImageChef.Filters.GZip();
|
||||
filter.Open(location);
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(1048576, filter.GetDataForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
||||
Assert.AreEqual(0, filter.GetResourceForkLength());
|
||||
Assert.AreEqual(null, filter.GetResourceForkStream());
|
||||
Assert.AreEqual(0, filter.GetResourceForkLength());
|
||||
Assert.AreEqual(null, filter.GetResourceForkStream());
|
||||
Assert.AreEqual(false, filter.HasResourceFork());
|
||||
filter.Close();
|
||||
}
|
||||
@@ -82,14 +81,13 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new DiscImageChef.Filters.GZip();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetDataForkStream();
|
||||
Stream str = filter.GetDataForkStream();
|
||||
byte[] data = new byte[1048576];
|
||||
str.Read(data, 0, 1048576);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
ctx.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedContents, result);
|
||||
}
|
||||
|
||||
@@ -50,9 +50,8 @@ namespace DiscImageChef.Tests.Filters
|
||||
[Test]
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
byte[] result = ctx.File(location);
|
||||
Md5Context ctx = new Md5Context();
|
||||
byte[] result = ctx.File(location);
|
||||
Assert.AreEqual(ExpectedFile, result);
|
||||
}
|
||||
|
||||
@@ -68,11 +67,11 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new DiscImageChef.Filters.LZip();
|
||||
filter.Open(location);
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(1048576, filter.GetDataForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
||||
Assert.AreEqual(0, filter.GetResourceForkLength());
|
||||
Assert.AreEqual(null, filter.GetResourceForkStream());
|
||||
Assert.AreEqual(0, filter.GetResourceForkLength());
|
||||
Assert.AreEqual(null, filter.GetResourceForkStream());
|
||||
Assert.AreEqual(false, filter.HasResourceFork());
|
||||
filter.Close();
|
||||
}
|
||||
@@ -82,14 +81,13 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new DiscImageChef.Filters.LZip();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetDataForkStream();
|
||||
Stream str = filter.GetDataForkStream();
|
||||
byte[] data = new byte[1048576];
|
||||
str.Read(data, 0, 1048576);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
ctx.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedContents, result);
|
||||
}
|
||||
|
||||
@@ -36,9 +36,9 @@ namespace DiscImageChef.Tests.Filters
|
||||
[TestFixture]
|
||||
public class MacBinary1
|
||||
{
|
||||
const string EXPECTED_FILE = "596c38555bc7ba284648d1ce57700884";
|
||||
const string EXPECTED_CONTENTS = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_RESOURCE = "a972d27c44193a7587b21416c0953cc3";
|
||||
const string EXPECTED_FILE = "596c38555bc7ba284648d1ce57700884";
|
||||
const string EXPECTED_CONTENTS = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_RESOURCE = "a972d27c44193a7587b21416c0953cc3";
|
||||
readonly string location;
|
||||
|
||||
public MacBinary1()
|
||||
@@ -49,9 +49,8 @@ namespace DiscImageChef.Tests.Filters
|
||||
[Test]
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.File(location, out _);
|
||||
Assert.AreEqual(EXPECTED_FILE, result);
|
||||
}
|
||||
|
||||
@@ -67,7 +66,7 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new DiscImageChef.Filters.AppleSingle();
|
||||
filter.Open(location);
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(737280, filter.GetDataForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
||||
Assert.AreEqual(286, filter.GetResourceForkLength());
|
||||
@@ -81,15 +80,14 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new DiscImageChef.Filters.AppleSingle();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetDataForkStream();
|
||||
Stream str = filter.GetDataForkStream();
|
||||
byte[] data = new byte[737280];
|
||||
str.Read(data, 0, 737280);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
||||
}
|
||||
|
||||
@@ -98,15 +96,14 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new DiscImageChef.Filters.AppleSingle();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
byte[] data = new byte[286];
|
||||
str.Read(data, 0, 286);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,9 +36,9 @@ namespace DiscImageChef.Tests.Filters
|
||||
[TestFixture]
|
||||
public class MacBinary2
|
||||
{
|
||||
const string EXPECTED_FILE = "a8daa55a65432353e95dc4c61d42660f";
|
||||
const string EXPECTED_CONTENTS = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_RESOURCE = "a972d27c44193a7587b21416c0953cc3";
|
||||
const string EXPECTED_FILE = "a8daa55a65432353e95dc4c61d42660f";
|
||||
const string EXPECTED_CONTENTS = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_RESOURCE = "a972d27c44193a7587b21416c0953cc3";
|
||||
readonly string location;
|
||||
|
||||
public MacBinary2()
|
||||
@@ -49,9 +49,8 @@ namespace DiscImageChef.Tests.Filters
|
||||
[Test]
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.File(location, out _);
|
||||
Assert.AreEqual(EXPECTED_FILE, result);
|
||||
}
|
||||
|
||||
@@ -67,7 +66,7 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new MacBinary();
|
||||
filter.Open(location);
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(737280, filter.GetDataForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
||||
Assert.AreEqual(286, filter.GetResourceForkLength());
|
||||
@@ -81,15 +80,14 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new MacBinary();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetDataForkStream();
|
||||
Stream str = filter.GetDataForkStream();
|
||||
byte[] data = new byte[737280];
|
||||
str.Read(data, 0, 737280);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
||||
}
|
||||
|
||||
@@ -98,15 +96,14 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new MacBinary();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
byte[] data = new byte[286];
|
||||
str.Read(data, 0, 286);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,9 +36,9 @@ namespace DiscImageChef.Tests.Filters
|
||||
[TestFixture]
|
||||
public class MacBinary3
|
||||
{
|
||||
const string EXPECTED_FILE = "3a7363a6109fb52a264b0b45dfa16694";
|
||||
const string EXPECTED_CONTENTS = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_RESOURCE = "a972d27c44193a7587b21416c0953cc3";
|
||||
const string EXPECTED_FILE = "3a7363a6109fb52a264b0b45dfa16694";
|
||||
const string EXPECTED_CONTENTS = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_RESOURCE = "a972d27c44193a7587b21416c0953cc3";
|
||||
readonly string location;
|
||||
|
||||
public MacBinary3()
|
||||
@@ -49,9 +49,8 @@ namespace DiscImageChef.Tests.Filters
|
||||
[Test]
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(location, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.File(location, out _);
|
||||
Assert.AreEqual(EXPECTED_FILE, result);
|
||||
}
|
||||
|
||||
@@ -67,7 +66,7 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new MacBinary();
|
||||
filter.Open(location);
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(737280, filter.GetDataForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
||||
Assert.AreEqual(286, filter.GetResourceForkLength());
|
||||
@@ -81,15 +80,14 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new MacBinary();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetDataForkStream();
|
||||
Stream str = filter.GetDataForkStream();
|
||||
byte[] data = new byte[737280];
|
||||
str.Read(data, 0, 737280);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
||||
}
|
||||
|
||||
@@ -98,15 +96,14 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new MacBinary();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
byte[] data = new byte[286];
|
||||
str.Read(data, 0, 286);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,9 +36,9 @@ namespace DiscImageChef.Tests.Filters
|
||||
[TestFixture]
|
||||
public class PcExchange
|
||||
{
|
||||
const string EXPECTED_FILE = "348825a08fa84766d20b91ed917012b9";
|
||||
const string EXPECTED_CONTENTS = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_RESOURCE = "5cb168d60ce8b2b1b3133c2faaf47165";
|
||||
const string EXPECTED_FILE = "348825a08fa84766d20b91ed917012b9";
|
||||
const string EXPECTED_CONTENTS = "c2be571406cf6353269faa59a4a8c0a4";
|
||||
const string EXPECTED_RESOURCE = "5cb168d60ce8b2b1b3133c2faaf47165";
|
||||
readonly string location;
|
||||
|
||||
public PcExchange()
|
||||
@@ -49,9 +49,9 @@ namespace DiscImageChef.Tests.Filters
|
||||
[Test]
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.File(Path.Combine(Consts.TestFilesRoot, "filters", "pcexchange", "FINDER.DAT"), out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.File(Path.Combine(Consts.TestFilesRoot, "filters", "pcexchange", "FINDER.DAT"),
|
||||
out _);
|
||||
Assert.AreEqual(EXPECTED_FILE, result);
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new PCExchange();
|
||||
filter.Open(location);
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(737280, filter.GetDataForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
||||
Assert.AreEqual(546, filter.GetResourceForkLength());
|
||||
@@ -81,15 +81,14 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new PCExchange();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetDataForkStream();
|
||||
Stream str = filter.GetDataForkStream();
|
||||
byte[] data = new byte[737280];
|
||||
str.Read(data, 0, 737280);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_CONTENTS, result);
|
||||
}
|
||||
|
||||
@@ -98,15 +97,14 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new PCExchange();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
Stream str = filter.GetResourceForkStream();
|
||||
byte[] data = new byte[546];
|
||||
str.Read(data, 0, 546);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
string result = ctx.Data(data, out _);
|
||||
Md5Context ctx = new Md5Context();
|
||||
string result = ctx.Data(data, out _);
|
||||
Assert.AreEqual(EXPECTED_RESOURCE, result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,9 +50,8 @@ namespace DiscImageChef.Tests.Filters
|
||||
[Test]
|
||||
public void CheckCorrectFile()
|
||||
{
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
byte[] result = ctx.File(location);
|
||||
Md5Context ctx = new Md5Context();
|
||||
byte[] result = ctx.File(location);
|
||||
Assert.AreEqual(ExpectedFile, result);
|
||||
}
|
||||
|
||||
@@ -68,11 +67,11 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new XZ();
|
||||
filter.Open(location);
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(true, filter.IsOpened());
|
||||
Assert.AreEqual(1048576, filter.GetDataForkLength());
|
||||
Assert.AreNotEqual(null, filter.GetDataForkStream());
|
||||
Assert.AreEqual(0, filter.GetResourceForkLength());
|
||||
Assert.AreEqual(null, filter.GetResourceForkStream());
|
||||
Assert.AreEqual(0, filter.GetResourceForkLength());
|
||||
Assert.AreEqual(null, filter.GetResourceForkStream());
|
||||
Assert.AreEqual(false, filter.HasResourceFork());
|
||||
filter.Close();
|
||||
}
|
||||
@@ -82,14 +81,13 @@ namespace DiscImageChef.Tests.Filters
|
||||
{
|
||||
IFilter filter = new XZ();
|
||||
filter.Open(location);
|
||||
Stream str = filter.GetDataForkStream();
|
||||
Stream str = filter.GetDataForkStream();
|
||||
byte[] data = new byte[1048576];
|
||||
str.Read(data, 0, 1048576);
|
||||
str.Close();
|
||||
str.Dispose();
|
||||
filter.Close();
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
ctx.Data(data, out byte[] result);
|
||||
Assert.AreEqual(ExpectedContents, result);
|
||||
}
|
||||
|
||||
@@ -65,21 +65,20 @@ namespace DiscImageChef.Tests.Images
|
||||
{
|
||||
for(int i = 0; i < testfiles.Length; i++)
|
||||
{
|
||||
string location = Path.Combine(Consts.TestFilesRoot, "images", "2mg", testfiles[i]);
|
||||
IFilter filter = new LZip();
|
||||
string location = Path.Combine(Consts.TestFilesRoot, "images", "2mg", testfiles[i]);
|
||||
IFilter filter = new LZip();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new DiscImages.Apple2Mg();
|
||||
Assert.AreEqual(true, image.Open(filter), testfiles[i]);
|
||||
Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]);
|
||||
Assert.AreEqual(true, image.Open(filter), testfiles[i]);
|
||||
Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]);
|
||||
Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]);
|
||||
Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]);
|
||||
Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]);
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
ulong doneSectors = 0;
|
||||
ulong doneSectors = 0;
|
||||
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
|
||||
while(doneSectors < image.Info.Sectors)
|
||||
{
|
||||
@@ -87,13 +86,13 @@ namespace DiscImageChef.Tests.Images
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
|
||||
doneSectors += image.Info.Sectors - doneSectors;
|
||||
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
|
||||
doneSectors += image.Info.Sectors - doneSectors;
|
||||
}
|
||||
|
||||
ctx.Update(sector);
|
||||
|
||||
@@ -69,21 +69,20 @@ namespace DiscImageChef.Tests.Images
|
||||
{
|
||||
for(int i = 0; i < testfiles.Length; i++)
|
||||
{
|
||||
string location = Path.Combine(Consts.TestFilesRoot, "images", "anex86", testfiles[i]);
|
||||
IFilter filter = new LZip();
|
||||
string location = Path.Combine(Consts.TestFilesRoot, "images", "anex86", testfiles[i]);
|
||||
IFilter filter = new LZip();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new DiscImages.Anex86();
|
||||
Assert.AreEqual(true, image.Open(filter), testfiles[i]);
|
||||
Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]);
|
||||
Assert.AreEqual(true, image.Open(filter), testfiles[i]);
|
||||
Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]);
|
||||
Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]);
|
||||
Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]);
|
||||
Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]);
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
ulong doneSectors = 0;
|
||||
ulong doneSectors = 0;
|
||||
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
|
||||
while(doneSectors < image.Info.Sectors)
|
||||
{
|
||||
@@ -91,13 +90,13 @@ namespace DiscImageChef.Tests.Images
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
|
||||
doneSectors += image.Info.Sectors - doneSectors;
|
||||
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
|
||||
doneSectors += image.Info.Sectors - doneSectors;
|
||||
}
|
||||
|
||||
ctx.Update(sector);
|
||||
|
||||
@@ -83,21 +83,20 @@ namespace DiscImageChef.Tests.Images
|
||||
{
|
||||
for(int i = 0; i < testfiles.Length; i++)
|
||||
{
|
||||
string location = Path.Combine(Consts.TestFilesRoot, "images", "ciscopy", testfiles[i]);
|
||||
IFilter filter = new LZip();
|
||||
string location = Path.Combine(Consts.TestFilesRoot, "images", "ciscopy", testfiles[i]);
|
||||
IFilter filter = new LZip();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new DiscImages.CisCopy();
|
||||
Assert.AreEqual(true, image.Open(filter), testfiles[i]);
|
||||
Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]);
|
||||
Assert.AreEqual(true, image.Open(filter), testfiles[i]);
|
||||
Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]);
|
||||
Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]);
|
||||
Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]);
|
||||
Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]);
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
ulong doneSectors = 0;
|
||||
ulong doneSectors = 0;
|
||||
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
|
||||
while(doneSectors < image.Info.Sectors)
|
||||
{
|
||||
@@ -105,13 +104,13 @@ namespace DiscImageChef.Tests.Images
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
|
||||
doneSectors += image.Info.Sectors - doneSectors;
|
||||
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
|
||||
doneSectors += image.Info.Sectors - doneSectors;
|
||||
}
|
||||
|
||||
ctx.Update(sector);
|
||||
|
||||
@@ -71,17 +71,16 @@ namespace DiscImageChef.Tests.Images
|
||||
IFilter filter = new LZip();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new DiscImages.CopyQm();
|
||||
Assert.AreEqual(true, image.Open(filter), testfiles[i]);
|
||||
Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]);
|
||||
Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]);
|
||||
Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]);
|
||||
Assert.AreEqual(true, image.Open(filter), testfiles[i]);
|
||||
Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]);
|
||||
Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]);
|
||||
Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]);
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
ulong doneSectors = 0;
|
||||
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
|
||||
while(doneSectors < image.Info.Sectors)
|
||||
{
|
||||
|
||||
@@ -85,21 +85,20 @@ namespace DiscImageChef.Tests.Images
|
||||
{
|
||||
for(int i = 0; i < testfiles.Length; i++)
|
||||
{
|
||||
string location = Path.Combine(Consts.TestFilesRoot, "images", "d88", testfiles[i]);
|
||||
IFilter filter = new LZip();
|
||||
string location = Path.Combine(Consts.TestFilesRoot, "images", "d88", testfiles[i]);
|
||||
IFilter filter = new LZip();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new DiscImages.D88();
|
||||
Assert.AreEqual(true, image.Open(filter), testfiles[i]);
|
||||
Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]);
|
||||
Assert.AreEqual(true, image.Open(filter), testfiles[i]);
|
||||
Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]);
|
||||
Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]);
|
||||
Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]);
|
||||
Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]);
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
ulong doneSectors = 0;
|
||||
ulong doneSectors = 0;
|
||||
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
|
||||
while(doneSectors < image.Info.Sectors)
|
||||
{
|
||||
@@ -107,13 +106,13 @@ namespace DiscImageChef.Tests.Images
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
|
||||
doneSectors += image.Info.Sectors - doneSectors;
|
||||
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
|
||||
doneSectors += image.Info.Sectors - doneSectors;
|
||||
}
|
||||
|
||||
ctx.Update(sector);
|
||||
|
||||
@@ -66,21 +66,20 @@ namespace DiscImageChef.Tests.Images
|
||||
{
|
||||
for(int i = 0; i < testfiles.Length; i++)
|
||||
{
|
||||
string location = Path.Combine(Consts.TestFilesRoot, "images", "dart", testfiles[i]);
|
||||
IFilter filter = new LZip();
|
||||
string location = Path.Combine(Consts.TestFilesRoot, "images", "dart", testfiles[i]);
|
||||
IFilter filter = new LZip();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new DiscImages.D88();
|
||||
Assert.AreEqual(true, image.Open(filter), testfiles[i]);
|
||||
Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]);
|
||||
Assert.AreEqual(true, image.Open(filter), testfiles[i]);
|
||||
Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]);
|
||||
Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]);
|
||||
Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]);
|
||||
Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]);
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
ulong doneSectors = 0;
|
||||
ulong doneSectors = 0;
|
||||
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
|
||||
while(doneSectors < image.Info.Sectors)
|
||||
{
|
||||
@@ -88,13 +87,13 @@ namespace DiscImageChef.Tests.Images
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
|
||||
doneSectors += image.Info.Sectors - doneSectors;
|
||||
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
|
||||
doneSectors += image.Info.Sectors - doneSectors;
|
||||
}
|
||||
|
||||
ctx.Update(sector);
|
||||
|
||||
@@ -86,21 +86,20 @@ namespace DiscImageChef.Tests.Images
|
||||
{
|
||||
for(int i = 0; i < testfiles.Length; i++)
|
||||
{
|
||||
string location = Path.Combine(Consts.TestFilesRoot, "images", "", testfiles[i]);
|
||||
IFilter filter = new LZip();
|
||||
string location = Path.Combine(Consts.TestFilesRoot, "images", "", testfiles[i]);
|
||||
IFilter filter = new LZip();
|
||||
filter.Open(location);
|
||||
IMediaImage image = new DiscImages.DiskCopy42();
|
||||
Assert.AreEqual(true, image.Open(filter), testfiles[i]);
|
||||
Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]);
|
||||
Assert.AreEqual(true, image.Open(filter), testfiles[i]);
|
||||
Assert.AreEqual(sectors[i], image.Info.Sectors, testfiles[i]);
|
||||
Assert.AreEqual(sectorsize[i], image.Info.SectorSize, testfiles[i]);
|
||||
Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]);
|
||||
Assert.AreEqual(mediatypes[i], image.Info.MediaType, testfiles[i]);
|
||||
|
||||
// How many sectors to read at once
|
||||
const uint SECTORS_TO_READ = 256;
|
||||
ulong doneSectors = 0;
|
||||
ulong doneSectors = 0;
|
||||
|
||||
Md5Context ctx = new Md5Context();
|
||||
ctx.Init();
|
||||
|
||||
while(doneSectors < image.Info.Sectors)
|
||||
{
|
||||
@@ -108,13 +107,13 @@ namespace DiscImageChef.Tests.Images
|
||||
|
||||
if(image.Info.Sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
sector = image.ReadSectors(doneSectors, SECTORS_TO_READ);
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
|
||||
doneSectors += image.Info.Sectors - doneSectors;
|
||||
sector = image.ReadSectors(doneSectors, (uint)(image.Info.Sectors - doneSectors));
|
||||
doneSectors += image.Info.Sectors - doneSectors;
|
||||
}
|
||||
|
||||
ctx.Update(sector);
|
||||
|
||||
Reference in New Issue
Block a user