2025-07-23 14:45:33 -04:00
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using SabreTools.IO.Compression.MSZIP;
|
|
|
|
|
using SabreTools.IO.Extensions;
|
|
|
|
|
using Xunit;
|
|
|
|
|
|
2026-03-18 15:47:44 -04:00
|
|
|
namespace SabreTools.IO.Compression.Test
|
2025-07-23 14:45:33 -04:00
|
|
|
{
|
|
|
|
|
public class MSZIPTests
|
|
|
|
|
{
|
|
|
|
|
[Fact]
|
|
|
|
|
public void DecompressorTest()
|
|
|
|
|
{
|
|
|
|
|
// Testing Note: This is a fake file that has multiple blocks
|
|
|
|
|
// sequentially. In real cabinet files, these are embedded in
|
|
|
|
|
// CFDATA blocks.
|
|
|
|
|
string path = Path.Combine(Environment.CurrentDirectory, "TestData", "test-archive.msz");
|
|
|
|
|
byte[] inputBytes = File.ReadAllBytes(path);
|
2025-11-13 08:56:30 -05:00
|
|
|
var input = new MemoryStream(inputBytes);
|
|
|
|
|
var output = new MemoryStream();
|
2025-07-23 14:45:33 -04:00
|
|
|
|
|
|
|
|
var decompressor = Decompressor.Create();
|
|
|
|
|
input.SeekIfPossible(0x0000);
|
|
|
|
|
decompressor.CopyTo(input, output);
|
|
|
|
|
input.SeekIfPossible(0x3969);
|
|
|
|
|
decompressor.CopyTo(input, output);
|
|
|
|
|
|
2025-12-04 09:34:44 -05:00
|
|
|
Assert.Equal(65536, output.Length);
|
2025-07-23 14:45:33 -04:00
|
|
|
}
|
|
|
|
|
}
|
2025-11-13 08:56:30 -05:00
|
|
|
}
|