mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-02-04 05:35:49 +00:00
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:
committed by
GitHub
parent
63a5a25a17
commit
9fee74f2a6
36
BinaryObjectScanner.Test/Packer/CrunchTests.cs
Normal file
36
BinaryObjectScanner.Test/Packer/CrunchTests.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user