Ha Vu Le

15 papers B 2C 1Journal 4Unranked 8
YearRankTypeTitle / Venue / Authors
2024 J jnl
Expert Syst. Appl.
Quang Van Do, Ha Thu Hoang, Nga Van Vu, Danilo Andrade De Jesus, Luisa Sánchez Brea, Hiep Xuan Nguyen, Anh Thi Lan Nguyen, Thanh Ngoc Le, Dung Thi My Dinh, Minh Thi Binh Nguyen, Huu Cong Nguyen, Anh Thi Van Bui, Ha Vu Le, Kelly Gillen, Thom Thi Vu, Ha Manh Luu
2023 J jnl
Comput. Methods Programs Biomed.
Ha Manh Luu, Hong Son Mai, Xuan Loc Pham, Quoc Anh Le, Quoc Khanh Le, Theo van Walsum, Ngoc Ha Le, Daniel Robert Franklin, Ha Vu Le, Adriaan Moelker, Trinh Chu Duc, Nguyen Linh Trung
2020 conf
AIM
Xuan Tuyen Tran, Tran Hiep Dinh, Ha Vu Le, Qiuchen Zhu, Quang Phuc Ha
2013 conf
KDIR/KMIS
Tran Phuong Nhung, Cam-Tu Nguyen, Jinhee Chun, Ha Vu Le, Takeshi Tokuyama
2013 B conf
ICIP
Ha Vu Le, Kazuma Shinoda, Madoka Hasegawa, Shigeo Kato, Yuichi Tanaka
2011 conf
KDIR
Cam-Tu Nguyen, Ha Vu Le, Takeshi Tokuyama
2011 conf
ISBI
Dinh Van Phong, Nguyen Linh-Trung, Tran Duc-Tan, Ha Vu Le, Minh N. Do
2011 C conf
ICICS
Tran Duc-Tan, Ha Vu Le, Nguyen-Linh Trung
2006 J jnl
J. VLSI Signal Process.
Ha Vu Le, Guna Seetharaman
2006 J jnl
Int. J. Distributed Sens. Networks
Guna Seetharaman, Ha Vu Le
2004 conf
3DPVT
Ha Vu Le
2004 B conf
ICIP
Ha Vu Le
2003 conf
FPT
Anant Utgikar, Guna Seetharaman, Ha Vu Le
2002 conf
DCV
Ha Vu Le, Guna Seetharaman
2002 conf
ICVGIP
Ha Vu Le, Guna Seetharaman, Harold Szu
tests/unit/test_decompile_function_type.py
← Index tests/unit/test_decompile_function_type.py python
"""Unit tests for bninja/function_type.py."""
import sys
import pytest
from unittest.mock import MagicMock

# Install binaryninja stubs before importing
from tests.unit.conftest_binja_stubs import install_binja_stubs, SymbolType
install_binja_stubs()

from redb.extractors.decompiler.bninja.function_type import (
    FunctionType,
    FunctionTypeAnalysis,
)


# ============================================================================
# 4a. FunctionType / FunctionTypeAnalysis
# ============================================================================


class TestFunctionTypeEnum:
    def test_function_type_enum_values(self):
        assert FunctionType.USER.value == "USER"
        assert FunctionType.LIBRARY.value == "LIBRARY"
        assert FunctionType.EXTERNAL.value == "EXTERNAL"
        assert FunctionType.THUNK.value == "THUNK"
        assert FunctionType.UNKNOWN.value == "UNKNOWN"


class TestFunctionTypeAnalysis:
    def _make_function(self, symbol_type=None, is_thunk=False, raise_on_symbol=False):
        func = MagicMock()
        func.is_thunk = is_thunk
        if raise_on_symbol:
            type(func).symbol = property(lambda self: (_ for _ in ()).throw(Exception("no symbol")))
        else:
            func.symbol.type = symbol_type if symbol_type is not None else SymbolType.FunctionSymbol
        return func

    def test_user_function_type(self):
        func = self._make_function(symbol_type=SymbolType.FunctionSymbol)
        analysis = FunctionTypeAnalysis(func)
        assert analysis.get_function_type() == FunctionType.USER

    def test_external_function_type(self):
        func = self._make_function(symbol_type=SymbolType.ImportedFunctionSymbol)
        analysis = FunctionTypeAnalysis(func)
        assert analysis.get_function_type() == FunctionType.EXTERNAL

    def test_library_function_type(self):
        func = self._make_function(symbol_type=SymbolType.LibraryFunctionSymbol)
        analysis = FunctionTypeAnalysis(func)
        assert analysis.get_function_type() == FunctionType.LIBRARY

    def test_thunk_function_type(self):
        # Thunk overrides the symbol type
        func = self._make_function(
            symbol_type=SymbolType.FunctionSymbol, is_thunk=True
        )
        analysis = FunctionTypeAnalysis(func)
        assert analysis.get_function_type() == FunctionType.THUNK

    def test_exception_returns_unknown(self):
        func = self._make_function(raise_on_symbol=True)
        analysis = FunctionTypeAnalysis(func)
        assert analysis.get_function_type() == FunctionType.UNKNOWN