tests: add tests demonstrating rending of .NET samples

This commit is contained in:
Willi Ballenthin
2022-06-06 15:13:20 -06:00
parent c73db051c1
commit 0987141970

View File

@@ -11,6 +11,7 @@ import textwrap
import fixtures
from fixtures import *
from fixtures import _1c444_dotnetfile_extractor
import capa.main
import capa.rules
@@ -444,3 +445,13 @@ def test_json_meta(capsys):
for addr, info in std_json["meta"]["analysis"]["layout"]["functions"]:
if addr == ["absolute", 0x10001010]:
assert {"address": ["absolute", 0x10001179]} in info["matched_basic_blocks"]
def test_main_dotnet(_1c444_dotnetfile_extractor):
# tests rules can be loaded successfully and all output modes
path = _1c444_dotnetfile_extractor.path
assert capa.main.main([path, "-vv"]) == 0
assert capa.main.main([path, "-v"]) == 0
assert capa.main.main([path, "-j"]) == 0
assert capa.main.main([path, "-q"]) == 0
assert capa.main.main([path]) == 0