From 26d55f0e71f925abfb5c90437757460d5e36d492 Mon Sep 17 00:00:00 2001 From: Peter LaFosse Date: Fri, 20 May 2022 08:31:56 -0400 Subject: Add tests for SymbolMapping, TypeMapping, FunctionList, and BinaryViewType --- suite/api_test.py | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 2 deletions(-) diff --git a/suite/api_test.py b/suite/api_test.py index 652307d1..85fc225d 100644 --- a/suite/api_test.py +++ b/suite/api_test.py @@ -2171,7 +2171,6 @@ class TestBinaryView(TestWithBinaryView): func.remove_user_function_tag(tags[0]) bv.update_analysis_and_wait() - assert test.view.name == self.view.name bv.unregister_notification(test) def test_strings(self): @@ -2193,8 +2192,72 @@ class TestBinaryView(TestWithBinaryView): ai = self.bv.analysis_info assert repr(ai) == "" + def test_symbolmapping(self): + syms = self.bv.symbols + assert repr(syms).startswith('" + assert bvt == bvt + assert bvt != bvt2 + assert hash(bvt) != hash(bvt2) + assert bvt.name == "PE" + assert bvt.long_name == "PE" + assert not bvt.is_deprecated + assert bvt2.get_arch(3, Endianness.LittleEndian) == Architecture["x86"] + assert bvt2.get_platform(0, Architecture["x86"]) == Platform["linux-x86"] + with FileApparatus("helloworld") as filename: + with BinaryViewType.get_view_of_file(filename) as bv: + assert bvt2.is_valid_for_data(bv.parent_view) + assert isinstance(bvt2.parse(bv.parent_view), BinaryView) + + -- cgit v1.3.1