Mahdi Fathi

25 papers Journal 24Unranked 1
YearRankTypeTitle / Venue / Authors
2024 J jnl
Int. J. Prod. Res.
Marzieh Khakifirooz, Mahdi Fathi, Alexandre Dolgui, Panos M. Pardalos
2023 J jnl
IEEE Trans. Engineering Management
Mahdi Fathi, Mohammad Marufuzzaman, Randy K. Buchanan, Christina H. Rinaudo, Kayla M. Houte, Linkan Bian
2023 J jnl
Optim. Lett.
Farzaneh Karami, Mahdi Fathi, Panos M. Pardalos
2023 J jnl
Reliab. Eng. Syst. Saf.
Marzieh Khakifirooz, Mahdi Fathi, I-Chen Lee, Sheng-Tsaing Tseng
2023 J jnl
Int. J. Prod. Res.
Maedeh Chaleshigar Kordasiabi, Hadi Gholizadeh, Marzieh Khakifirooz, Mahdi Fathi
2022 J jnl
Reliab. Eng. Syst. Saf.
Kamyar Sabri-Laghaie, Mahdi Fathi, Enrico Zio, Maryam Mazhar
2022 J jnl
Comput. Ind. Eng.
Erfan Amani Bani, Ali Fallahi, Mohsen Varmazyar, Mahdi Fathi
2022 J jnl
Comput. Ind. Eng.
Changyu Chen, Mahdi Fathi, Marzieh Khakifirooz, Kan Wu
2022 J jnl
Comput. Ind. Eng.
Ali Shirzadeh Chaleshtari, Ehsan Elahi, Mahdi Fathi, Marzieh Khakifirooz
2021 J jnl
Comput. Ind. Eng.
Behzad Maleki Vishkaei, Mahdi Fathi, Marzieh Khakifirooz, Pietro De Giovanni
2021 J jnl
IEEE Trans Autom. Sci. Eng.
Marzieh Khakifirooz, Mahdi Fathi, Chen-Fu Chien
2020 J jnl
Appl. Soft Comput.
Ali Shirzadeh Chaleshtarti, Shahram Shadrokh, Marzieh Khakifirooz, Mahdi Fathi, Panos M. Pardalos
2020 J jnl
Int. J. Prod. Res.
Vahid Nooraie, Mahdi Fathi, Masoud Narenji, Mahour Mellat Parast, Panayote M. Pardalos, P. M. Stanfield
2020 J jnl
Int. J. Prod. Res.
Cheng-Feng Wu, Mahdi Fathi, David Ming-Huang Chiang, Panayote M. Pardalos
2020 conf
UbiComp/ISWC Adjunct
Marzieh Khakifirooz, Mahdi Fathi
2020 J jnl
IEEE Trans. Ind. Informatics
Marzieh Khakifirooz, Chen Fu Chien, Mahdi Fathi, Panos M. Pardalos
2020 J jnl
Technometrics
Marzieh Khakifirooz, Sheng-Tsaing Tseng, Mahdi Fathi
2020 J jnl
J. Intell. Fuzzy Syst.
Shadi Dorosti, Mahdi Fathi, Saeid Jafarzadeh Ghoushchi, Marzieh Khakifirooz, Mohammad Khazaeili
2019 J jnl
IEEE Trans Autom. Sci. Eng.
Marzieh Khakifirooz, Chen-Fu Chien, Mahdi Fathi
2019 J jnl
IEEE Access
Marzieh Khakifirooz, Mahdi Fathi, Kan Wu
2019 J jnl
Comput. Ind. Eng.
Seyed Mohsen Mousavi, Panos M. Pardalos, Seyed Taghi Akhavan Niaki, Armin Fügenschuh, Mahdi Fathi
2018 J jnl
Appl. Soft Comput.
Wanzhe Hu, Mahdi Fathi, Panos M. Pardalos
2013 J jnl
Int. J. Strateg. Decis. Sci.
Ebrahim Teimoury, Mahdi Fathi
2011 J jnl
Int. J. Appl. Decis. Sci.
Ebrahim Teimoury, Mohammad Modarres Yazdi, Meysam Haddadi, Mahdi Fathi
2011 J jnl
Int. J. Strateg. Decis. Sci.
Ebrahim Teimoury, Mohammad Modarres Yazdi, Iman Ghaleh Khondabi, Mahdi Fathi
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