Update to next version. Stop Zip64 tests from running all the time and some clean up

This commit is contained in:
Adam Hathcock
2017-05-19 10:10:23 +01:00
parent f1809163c7
commit 631578c175
8 changed files with 68 additions and 57 deletions

View File

@@ -3,7 +3,9 @@
<PropertyGroup>
<AssemblyTitle>SharpCompress - Pure C# Decompression/Compression</AssemblyTitle>
<NeutralLanguage>en-US</NeutralLanguage>
<VersionPrefix>0.15.2</VersionPrefix>
<VersionPrefix>0.16.0</VersionPrefix>
<AssemblyVersion>0.16.0.0</AssemblyVersion>
<FileVersion>0.16.0.0</FileVersion>
<Authors>Adam Hathcock</Authors>
<TargetFrameworks>netstandard1.0;netstandard1.3</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
@@ -18,6 +20,7 @@
<PackageLicenseUrl>https://github.com/adamhathcock/sharpcompress/blob/master/LICENSE.txt</PackageLicenseUrl>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<Description>SharpCompress is a compression library for NET Standard 1.0 that can unrar, decompress 7zip, zip/unzip, tar/untar bzip2/unbzip2 and gzip/ungzip with forward-only reading and file random access APIs. Write support for zip/tar/bzip2/gzip is implemented.</Description>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.0' ">

View File

@@ -44,7 +44,7 @@ namespace SharpCompress.Test
{
if (!entry.IsDirectory)
{
Assert.Equal(entry.CompressionType, CompressionType.Rar);
Assert.Equal(CompressionType.Rar, entry.CompressionType);
entry.WriteToDirectory(SCRATCH_FILES_PATH, new ExtractionOptions()
{
ExtractFullPath = true,
@@ -189,7 +189,7 @@ namespace SharpCompress.Test
ResetScratch();
using (var archive = RarArchive.Open(testArchives.Select(s => Path.Combine(TEST_ARCHIVES_PATH, s))
.Select(p => File.OpenRead(p))))
.Select(File.OpenRead)))
{
foreach (var entry in archive.Entries.Where(entry => !entry.IsDirectory))
{

View File

@@ -36,7 +36,7 @@ namespace SharpCompress.Test
VerifyFiles();
}
//[Fact]
[Fact]
public void Rar_Multi_Reader_Encrypted()
{
var testArchives = new string[] { "EncryptedParts.part01.rar",
@@ -149,7 +149,7 @@ namespace SharpCompress.Test
{
if (!reader.Entry.IsDirectory)
{
Assert.Equal(reader.Entry.CompressionType, CompressionType.Rar);
Assert.Equal(CompressionType.Rar, reader.Entry.CompressionType);
reader.WriteEntryToDirectory(SCRATCH_FILES_PATH, new ExtractionOptions()
{
ExtractFullPath = true,
@@ -172,7 +172,7 @@ namespace SharpCompress.Test
{
if (!reader.Entry.IsDirectory)
{
Assert.Equal(reader.Entry.CompressionType, CompressionType.Rar);
Assert.Equal(CompressionType.Rar, reader.Entry.CompressionType);
using (var entryStream = reader.OpenEntryStream())
{
string file = Path.GetFileName(reader.Entry.Key);
@@ -207,7 +207,7 @@ namespace SharpCompress.Test
{
while (reader.MoveToNextEntry())
{
Assert.Equal(reader.Entry.CompressionType, CompressionType.Rar);
Assert.Equal(CompressionType.Rar, reader.Entry.CompressionType);
reader.WriteEntryToDirectory(SCRATCH_FILES_PATH, new ExtractionOptions()
{
ExtractFullPath = true,
@@ -231,7 +231,7 @@ namespace SharpCompress.Test
{
while (reader.MoveToNextEntry())
{
Assert.Equal(reader.Entry.CompressionType, CompressionType.Rar);
Assert.Equal(CompressionType.Rar, reader.Entry.CompressionType);
reader.WriteEntryToDirectory(SCRATCH_FILES_PATH, new ExtractionOptions()
{
ExtractFullPath = true,
@@ -262,7 +262,7 @@ namespace SharpCompress.Test
{
if (reader.Entry.Key.Contains("jpg"))
{
Assert.Equal(reader.Entry.CompressionType, CompressionType.Rar);
Assert.Equal(CompressionType.Rar, reader.Entry.CompressionType);
reader.WriteEntryToDirectory(SCRATCH_FILES_PATH, new ExtractionOptions()
{
ExtractFullPath = true,
@@ -287,7 +287,7 @@ namespace SharpCompress.Test
{
if (reader.Entry.Key.Contains("jpg"))
{
Assert.Equal(reader.Entry.CompressionType, CompressionType.Rar);
Assert.Equal(CompressionType.Rar, reader.Entry.CompressionType);
reader.WriteEntryToDirectory(SCRATCH_FILES_PATH, new ExtractionOptions()
{
ExtractFullPath = true,

View File

@@ -23,25 +23,25 @@ namespace SharpCompress.Test
RewindableStream stream = new RewindableStream(ms);
stream.StartRecording();
BinaryReader br = new BinaryReader(stream);
Assert.Equal(br.ReadInt32(), 1);
Assert.Equal(br.ReadInt32(), 2);
Assert.Equal(br.ReadInt32(), 3);
Assert.Equal(br.ReadInt32(), 4);
Assert.Equal(1, br.ReadInt32());
Assert.Equal(2, br.ReadInt32());
Assert.Equal(3, br.ReadInt32());
Assert.Equal(4, br.ReadInt32());
stream.Rewind(true);
stream.StartRecording();
Assert.Equal(br.ReadInt32(), 1);
Assert.Equal(br.ReadInt32(), 2);
Assert.Equal(br.ReadInt32(), 3);
Assert.Equal(br.ReadInt32(), 4);
Assert.Equal(br.ReadInt32(), 5);
Assert.Equal(br.ReadInt32(), 6);
Assert.Equal(br.ReadInt32(), 7);
Assert.Equal(1, br.ReadInt32());
Assert.Equal(2, br.ReadInt32());
Assert.Equal(3, br.ReadInt32());
Assert.Equal(4, br.ReadInt32());
Assert.Equal(5, br.ReadInt32());
Assert.Equal(6, br.ReadInt32());
Assert.Equal(7, br.ReadInt32());
stream.Rewind(true);
stream.StartRecording();
Assert.Equal(br.ReadInt32(), 1);
Assert.Equal(br.ReadInt32(), 2);
Assert.Equal(br.ReadInt32(), 3);
Assert.Equal(br.ReadInt32(), 4);
Assert.Equal(1, br.ReadInt32());
Assert.Equal(2, br.ReadInt32());
Assert.Equal(3, br.ReadInt32());
Assert.Equal(4, br.ReadInt32());
}
[Fact]
@@ -61,23 +61,23 @@ namespace SharpCompress.Test
RewindableStream stream = new RewindableStream(ms);
stream.StartRecording();
BinaryReader br = new BinaryReader(stream);
Assert.Equal(br.ReadInt32(), 1);
Assert.Equal(br.ReadInt32(), 2);
Assert.Equal(br.ReadInt32(), 3);
Assert.Equal(br.ReadInt32(), 4);
Assert.Equal(1, br.ReadInt32());
Assert.Equal(2, br.ReadInt32());
Assert.Equal(3, br.ReadInt32());
Assert.Equal(4, br.ReadInt32());
stream.Rewind(true);
Assert.Equal(br.ReadInt32(), 1);
Assert.Equal(br.ReadInt32(), 2);
Assert.Equal(1, br.ReadInt32());
Assert.Equal(2, br.ReadInt32());
stream.StartRecording();
Assert.Equal(br.ReadInt32(), 3);
Assert.Equal(br.ReadInt32(), 4);
Assert.Equal(br.ReadInt32(), 5);
Assert.Equal(3, br.ReadInt32());
Assert.Equal(4, br.ReadInt32());
Assert.Equal(5, br.ReadInt32());
stream.Rewind(true);
Assert.Equal(br.ReadInt32(), 3);
Assert.Equal(br.ReadInt32(), 4);
Assert.Equal(br.ReadInt32(), 5);
Assert.Equal(br.ReadInt32(), 6);
Assert.Equal(br.ReadInt32(), 7);
Assert.Equal(3, br.ReadInt32());
Assert.Equal(4, br.ReadInt32());
Assert.Equal(5, br.ReadInt32());
Assert.Equal(6, br.ReadInt32());
Assert.Equal(7, br.ReadInt32());
}
}
}

View File

@@ -17,9 +17,10 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.0-beta2-build1317" />
<PackageReference Include="Microsoft.Extensions.PlatformAbstractions" Version="1.1.0" />
<PackageReference Include="xunit" Version="2.2.0" />
<PackageReference Include="xunit" Version="2.3.0-beta2-build3683" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.0-beta2-build3683" />
</ItemGroup>
<ItemGroup>

View File

@@ -21,42 +21,48 @@ namespace SharpCompress.Test
// 4GiB + 1
const long FOUR_GB_LIMIT = ((long)uint.MaxValue) + 1;
[Fact]
[Fact(Skip = "Takes too long")]
[Trait("format", "zip64")]
public void Zip64_Single_Large_File()
{
// One single file, requires zip64
RunSingleTest(1, FOUR_GB_LIMIT, set_zip64: true, forward_only: false);
}
[Fact]
public void Zip64_Two_Large_Files()
[Fact(Skip = "Takes too long")]
[Trait("format", "zip64")]
public void Zip64_Two_Large_Files()
{
// One single file, requires zip64
RunSingleTest(2, FOUR_GB_LIMIT, set_zip64: true, forward_only: false);
}
}
[Fact]
[Fact(Skip = "Takes too long")]
[Trait("format", "zip64")]
public void Zip64_Two_Small_files()
{
// Multiple files, does not require zip64
RunSingleTest(2, FOUR_GB_LIMIT / 2, set_zip64: false, forward_only: false);
}
[Fact]
[Fact(Skip = "Takes too long")]
[Trait("format", "zip64")]
public void Zip64_Two_Small_files_stream()
{
// Multiple files, does not require zip64, and works with streams
RunSingleTest(2, FOUR_GB_LIMIT / 2, set_zip64: false, forward_only: true);
}
[Fact]
[Fact(Skip = "Takes too long")]
[Trait("format", "zip64")]
public void Zip64_Two_Small_Files_Zip64()
{
// Multiple files, use zip64 even though it is not required
RunSingleTest(2, FOUR_GB_LIMIT / 2, set_zip64: true, forward_only: false);
}
[Fact]
[Fact(Skip = "Takes too long")]
[Trait("format", "zip64")]
public void Zip64_Single_Large_File_Fail()
{
try
@@ -70,7 +76,8 @@ namespace SharpCompress.Test
}
}
[Fact]
[Fact(Skip = "Takes too long")]
[Trait("zip64", "true")]
public void Zip64_Single_Large_File_Zip64_Streaming_Fail()
{
try
@@ -84,7 +91,8 @@ namespace SharpCompress.Test
}
}
[Fact]
[Fact(Skip = "Takes too long")]
[Trait("zip64", "true")]
public void Zip64_Single_Large_File_Streaming_Fail()
{
try

View File

@@ -358,7 +358,7 @@ namespace SharpCompress.Test
count++;
//Prints 3
Assert.Equal(count, 3);
Assert.Equal(3, count);
a.Dispose();
a = ZipArchive.Open(unmodified);
@@ -382,7 +382,7 @@ namespace SharpCompress.Test
foreach (var e in a.Entries)
count3++;
Assert.Equal(count3, 3);
Assert.Equal(3, count3);
}
[Fact]

View File

@@ -100,7 +100,7 @@ namespace SharpCompress.Test
{
if (!reader.Entry.IsDirectory)
{
Assert.Equal(reader.Entry.CompressionType, CompressionType.BZip2);
Assert.Equal(CompressionType.BZip2, reader.Entry.CompressionType);
reader.WriteEntryToDirectory(SCRATCH_FILES_PATH, new ExtractionOptions()
{
ExtractFullPath = true,
@@ -179,8 +179,7 @@ namespace SharpCompress.Test
{
if (!reader.Entry.IsDirectory)
{
Assert.Equal(reader.Entry.CompressionType,
CompressionType.Unknown);
Assert.Equal(CompressionType.Unknown, reader.Entry.CompressionType);
reader.WriteEntryToDirectory(SCRATCH_FILES_PATH,
new ExtractionOptions()
{
@@ -208,7 +207,7 @@ namespace SharpCompress.Test
{
if (!reader.Entry.IsDirectory)
{
Assert.Equal(reader.Entry.CompressionType, CompressionType.Unknown);
Assert.Equal(CompressionType.Unknown, reader.Entry.CompressionType);
reader.WriteEntryToDirectory(SCRATCH_FILES_PATH,
new ExtractionOptions()
{