Move Crunch to its own Packer, improve SmartE detection. (#353)

* Move Crunch to its own Packer, improve SmartE detection.

* Fix formatting by removing brackets

Co-authored-by: Matt Nadareski <mnadareski@outlook.com>

* Remove named section checks, minor formatting fixes

* Add newline before summary.

* Remove empty returns.

* Remove unnecessary newline

* Change Crunch to use IExtractableExecutable

* Remove unnecessary whitespace.

* Add tests for Crunch.

---------

Co-authored-by: Matt Nadareski <mnadareski@outlook.com>
This commit is contained in:
HeroponRikiBestest
2025-01-13 23:17:57 -05:00
committed by GitHub
parent 63a5a25a17
commit 9fee74f2a6
3 changed files with 124 additions and 11 deletions

View File

@@ -0,0 +1,36 @@
using System.IO;
using BinaryObjectScanner.Packer;
using Xunit;
namespace BinaryObjectScanner.Test.Packer
{
public class CrunchTests
{
[Fact]
public void CheckPortableExecutableTest()
{
string file = "filename";
SabreTools.Models.PortableExecutable.Executable model = new();
Stream source = new MemoryStream();
SabreTools.Serialization.Wrappers.PortableExecutable pex = new(model, source);
var checker = new Crunch();
string? actual = checker.CheckExecutable(file, pex, includeDebug: false);
Assert.Null(actual);
}
[Fact]
public void ExtractPortableExecutableTest()
{
string file = "filename";
SabreTools.Models.PortableExecutable.Executable model = new();
Stream source = new MemoryStream();
SabreTools.Serialization.Wrappers.PortableExecutable pex = new(model, source);
string outputDir = string.Empty;
var checker = new Crunch();
bool actual = checker.Extract(file, pex, outputDir, includeDebug: false);
Assert.False(actual);
}
}
}