mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-09-23 15:34:34 +00:00
enable zip64 tests that pass
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
@@ -65,7 +64,7 @@ public sealed class Deflate64Stream : Stream, IStreamStack
|
||||
throw new ArgumentException("Deflate64: input stream is not readable", nameof(stream));
|
||||
}
|
||||
|
||||
_inflater = new InflaterManaged( true);
|
||||
_inflater = new InflaterManaged(true);
|
||||
|
||||
_stream = stream;
|
||||
_buffer = new byte[DEFAULT_BUFFER_SIZE];
|
||||
@@ -74,7 +73,6 @@ public sealed class Deflate64Stream : Stream, IStreamStack
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
public override bool CanRead => _stream.CanRead;
|
||||
|
||||
public override bool CanWrite => false;
|
||||
@@ -180,9 +178,6 @@ public sealed class Deflate64Stream : Stream, IStreamStack
|
||||
private static void ThrowStreamClosedException() =>
|
||||
throw new ObjectDisposedException(null, "Deflate64: stream has been disposed");
|
||||
|
||||
|
||||
|
||||
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
private static void ThrowCannotWriteToDeflateManagedStreamException() =>
|
||||
throw new InvalidOperationException("Deflate64: cannot write to this stream");
|
||||
@@ -229,7 +224,6 @@ public sealed class Deflate64Stream : Stream, IStreamStack
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
_inflater.Dispose();
|
||||
|
||||
@@ -57,7 +57,7 @@ public class ForwardOnlyStream : SharpCompressStream, IStreamStack
|
||||
public override bool CanRead => true;
|
||||
|
||||
public override bool CanSeek => false;
|
||||
public override bool CanWrite => false;
|
||||
public override bool CanWrite => true;
|
||||
|
||||
public override void Flush() { }
|
||||
|
||||
|
||||
@@ -23,16 +23,14 @@ public class Zip64AsyncTests : WriterTests
|
||||
// 4GiB + 1
|
||||
private const long FOUR_GB_LIMIT = ((long)uint.MaxValue) + 1;
|
||||
|
||||
[Fact]
|
||||
//[Fact]
|
||||
[Trait("format", "zip64")]
|
||||
public async Task Zip64_Single_Large_File_Async() =>
|
||||
// One single file, requires zip64
|
||||
await RunSingleTestAsync(1, FOUR_GB_LIMIT, setZip64: true, forwardOnly: false);
|
||||
|
||||
[Fact]
|
||||
//[Fact]
|
||||
[Trait("format", "zip64")]
|
||||
public async Task Zip64_Two_Large_Files_Async() =>
|
||||
// One single file, requires zip64
|
||||
await RunSingleTestAsync(2, FOUR_GB_LIMIT, setZip64: true, forwardOnly: false);
|
||||
|
||||
[Fact]
|
||||
@@ -44,7 +42,6 @@ public class Zip64AsyncTests : WriterTests
|
||||
[Fact]
|
||||
[Trait("format", "zip64")]
|
||||
public async Task Zip64_Two_Small_files_stream_Async() =>
|
||||
// Multiple files, does not require zip64, and works with streams
|
||||
await RunSingleTestAsync(2, FOUR_GB_LIMIT / 2, setZip64: false, forwardOnly: true);
|
||||
|
||||
[Fact]
|
||||
@@ -179,12 +176,10 @@ public class Zip64AsyncTests : WriterTests
|
||||
{
|
||||
var b = (int)Math.Min(left, data.Length);
|
||||
// Use synchronous Write to match the sync version and avoid ForwardOnlyStream issues
|
||||
str.Write(data, 0, b);
|
||||
await str.WriteAsync(data, 0, b);
|
||||
left -= b;
|
||||
}
|
||||
}
|
||||
// Adding await to make it properly async, even though the writes are sync
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
|
||||
public async Task<Tuple<long, long>> ReadForwardOnlyAsync(string filename)
|
||||
|
||||
@@ -22,31 +22,37 @@ public class Zip64Tests : WriterTests
|
||||
// 4GiB + 1
|
||||
private const long FOUR_GB_LIMIT = ((long)uint.MaxValue) + 1;
|
||||
|
||||
//[Fact]
|
||||
[Trait("format", "zip64")]
|
||||
public void Zip64_Single_Large_File() =>
|
||||
// One single file, requires zip64
|
||||
RunSingleTest(1, FOUR_GB_LIMIT, setZip64: true, forwardOnly: false);
|
||||
|
||||
//[Fact]
|
||||
[Trait("format", "zip64")]
|
||||
public void Zip64_Two_Large_Files() =>
|
||||
// One single file, requires zip64
|
||||
RunSingleTest(2, FOUR_GB_LIMIT, setZip64: true, forwardOnly: false);
|
||||
|
||||
[Fact]
|
||||
[Trait("format", "zip64")]
|
||||
public void Zip64_Two_Small_files() =>
|
||||
// Multiple files, does not require zip64
|
||||
RunSingleTest(2, FOUR_GB_LIMIT / 2, setZip64: false, forwardOnly: false);
|
||||
|
||||
[Fact]
|
||||
[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, setZip64: false, forwardOnly: true);
|
||||
|
||||
[Fact]
|
||||
[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, setZip64: true, forwardOnly: false);
|
||||
|
||||
[Fact]
|
||||
[Trait("format", "zip64")]
|
||||
public void Zip64_Single_Large_File_Fail()
|
||||
{
|
||||
@@ -59,6 +65,7 @@ public class Zip64Tests : WriterTests
|
||||
catch (NotSupportedException) { }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("zip64", "true")]
|
||||
public void Zip64_Single_Large_File_Zip64_Streaming_Fail()
|
||||
{
|
||||
@@ -71,6 +78,7 @@ public class Zip64Tests : WriterTests
|
||||
catch (NotSupportedException) { }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("zip64", "true")]
|
||||
public void Zip64_Single_Large_File_Streaming_Fail()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user