Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Arker123 committed Dec 24, 2023
1 parent ef13b33 commit ce80cd8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion floss/language/rust/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
find_lea_xrefs,
find_mov_xrefs,
find_push_xrefs,
get_raw_xrefs_rdata_i386,
get_rdata_section,
get_raw_xrefs_rdata_i386,
get_struct_string_candidates,
)

Expand Down
18 changes: 18 additions & 0 deletions tests/test_language_extract_rust.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,21 @@ def test_push(request, string, offset, encoding, rust_strings):
)
def test_mov_jmp(request, string, offset, encoding, rust_strings):
assert StaticString(string=string, offset=offset, encoding=encoding) in request.getfixturevalue(rust_strings)


@pytest.mark.parametrize(
"string,offset,encoding,rust_strings",
[
# .rdata:004BFA48 dd offset unk_4BA13A
# .rdata:004BFA4C dd offset unk_4BA100
pytest.param("Invalid branch target in DWARF expression", 0xB813A, StringEncoding.UTF8, "rust_strings32"),
pytest.param(
"Expected to find an FDE pointer, but found a CIE pointer instead.",
0xB8163,
StringEncoding.UTF8,
"rust_strings32",
),
],
)
def test_raw_xrefs(request, string, offset, encoding, rust_strings):
assert StaticString(string=string, offset=offset, encoding=encoding) in request.getfixturevalue(rust_strings)

0 comments on commit ce80cd8

Please sign in to comment.