mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-09-23 15:34:34 +00:00
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
@@ -42,14 +42,17 @@ internal class CBZip2InputStream : Stream
|
||||
private static void Cadvise()
|
||||
{
|
||||
//System.out.Println("CRC Error");
|
||||
//throw new CCoruptionError();
|
||||
throw new InvalidOperationException("BZip2 error");
|
||||
}
|
||||
|
||||
private static void BadBGLengths() => Cadvise();
|
||||
|
||||
private static void BitStreamEOF() => Cadvise();
|
||||
|
||||
private static void CompressedStreamEOF() => Cadvise();
|
||||
private static void CompressedStreamEOF()
|
||||
{
|
||||
throw new InvalidOperationException("BZip2 compressed file ends unexpectedly");
|
||||
}
|
||||
|
||||
private void MakeMaps()
|
||||
{
|
||||
|
||||
21
tests/SharpCompress.Test/BZip2/BZip2ReaderTests.cs
Normal file
21
tests/SharpCompress.Test/BZip2/BZip2ReaderTests.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.IO;
|
||||
using SharpCompress.Readers;
|
||||
using SharpCompress.Readers.GZip;
|
||||
using Xunit;
|
||||
|
||||
namespace SharpCompress.Test.BZip2;
|
||||
|
||||
public class BZip2ReaderTests : ReaderTests
|
||||
{
|
||||
[Fact]
|
||||
public void BZip2_Reader_Factory()
|
||||
{
|
||||
Stream stream = new MemoryStream(
|
||||
new byte[] { 0x42, 0x5a, 0x68, 0x34, 0x31, 0x41, 0x59, 0x26, 0x53, 0x59, 0x35 }
|
||||
);
|
||||
Assert.Throws(typeof(InvalidOperationException), () => ReaderFactory.Open(stream));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user