1
0
mirror of https://github.com/angr/angr synced 2026-06-08 13:09:39 +00:00
Files
angr-angr/tests/analyses/test_find_objects_static.py
pre-commit-ci[bot] 563fb5f862 [pre-commit.ci] pre-commit autoupdate (#6025)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.14.11 → v0.14.13](https://github.com/astral-sh/ruff-pre-commit/compare/v0.14.11...v0.14.13)
- [github.com/psf/black-pre-commit-mirror: 25.12.0 → 26.1.0](https://github.com/psf/black-pre-commit-mirror/compare/25.12.0...26.1.0)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-01-19 13:37:06 -07:00

37 lines
1.2 KiB
Python
Executable File

#!/usr/bin/env python3
# pylint: disable=missing-class-docstring,disable=no-self-use
from __future__ import annotations
__package__ = __package__ or "tests.analyses" # pylint:disable=redefined-builtin
import os
import unittest
import angr
from tests.common import bin_location
test_location = os.path.join(bin_location, "tests")
class TestFindObjectsStatic(unittest.TestCase):
def test_object_identification_x86_64(self):
p = angr.Project(os.path.join(test_location, "x86_64", "cpp_classes"), auto_load_libs=False)
object_identifier_analysis = p.analyses.StaticObjectFinder()
possible_objects_dict = object_identifier_analysis.possible_objects
possible_constructors = object_identifier_analysis.possible_constructors
class_labels = []
for possible_object in possible_objects_dict.values():
class_labels.append(possible_object.class_name)
assert "C" in class_labels
assert len(possible_objects_dict) == 2
assert len(possible_constructors) == 1
assert 0x401512 in possible_constructors
assert len(possible_constructors[0x401512]) == 2
if __name__ == "__main__":
unittest.main()