mirror of
https://github.com/QuasarApp/pe-parse.git
synced 2025-04-26 04:14:32 +00:00
* tests: add a testcase for #153 * tests: rename testcase, hook up * tests: fix REQUIRE check
This commit is contained in:
parent
baeeb19427
commit
58b254a863
@ -23,6 +23,7 @@ add_executable(tests
|
||||
test_main.cpp
|
||||
simple_test.cpp
|
||||
corkami_test.cpp
|
||||
pr_153_test.cpp
|
||||
|
||||
filesystem_compat.h
|
||||
)
|
||||
|
BIN
tests/assets/pr_153.exe
Normal file
BIN
tests/assets/pr_153.exe
Normal file
Binary file not shown.
17
tests/pr_153_test.cpp
Normal file
17
tests/pr_153_test.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include <pe-parse/parse.h>
|
||||
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
#include "filesystem_compat.h"
|
||||
|
||||
namespace peparse {
|
||||
TEST_CASE("malformed PE (GH#153) does not parse", "[pr_153]") {
|
||||
auto path = fs::path(ASSETS_DIR) / "pr_153.exe";
|
||||
auto *p = ParsePEFromFile(path.string().c_str());
|
||||
|
||||
// pr_153.exe should not parse, and should return an error indicating
|
||||
// that the magic was invalid (masking the underlying PEERR_ADDRESS error).
|
||||
REQUIRE(p == nullptr);
|
||||
REQUIRE(GetPEErr() == PEERR_MAGIC);
|
||||
}
|
||||
} // namespace peparse
|
Loading…
x
Reference in New Issue
Block a user