Naeem Radi

18 papers B 3C 3Journal 3Unranked 9
YearRankTypeTitle / Venue / Authors
2018 J jnl
Neurocomputing
Abir Jaafar Hussain, Ali Al-Fayadh, Naeem Radi
2018 B conf
CEC
Basma Abdulaimma, Abir Hussain, Paul Fergus, Dhiya Al-Jumeily, Paulo Lisboa, De-Shuang Huang, Naeem Radi
2017 B conf
IJCNN
Casimiro Aday Curbelo Montañez, Paul Fergus, Abir Hussain, Dhiya Al-Jumeily, Basma Abdulaimma, Jade Hind, Naeem Radi
2017 B conf
IJCNN
Raghad Al-Shabandar, Abir Hussain, Andy Laws, Robert Keight, Janet Lunn, Naeem Radi
2016 J jnl
Neurocomputing
Abir Jaafar Hussain, Dhiya Al-Jumeily, Haya Al-Askar, Naeem Radi
2015 conf
ICIC (2)
Mohammed Khalaf, Abir Jaafar Hussain, Dhiya Al-Jumeily, Paul Fergus, Russell Keenan, Naeem Radi
2015 conf
ICIC (2)
Paul Fergus, Abir Jaafar Hussain, John Hearty, Stuart Fairclough, Lynne Boddy, Kelly A. Mackintosh, Gareth Stratton, Nicola D. Ridgers, Naeem Radi
2015 conf
ICIC (2)
Paul Fergus, Abir Jaafar Hussain, Dhiya Al-Jumeily, Naeem Radi
2015 conf
ICIC (3)
Ahmed J. Aljaaf, Dhiya Al-Jumeily, Abir Jaafar Hussain, Paul Fergus, Mohammed Al-Jumaily, Naeem Radi
2015 C conf
DeSE
Abir Jaafar Hussain, Laura Connell, Hulya Francis, Dhiya Al-Jumeily, Paul Fergus, Naeem Radi
2015 conf
IWSSIP
Ahmed J. Aljaaf, Dhiya Al-Jumeily, Abir Jaafar Hussain, Paul Fergus, Mohammed Al-Jumaily, Naeem Radi
2015 J jnl
Neurocomputing
Abir Jaafar Hussain, Dhiya Al-Jumeily, Naeem Radi, Paulo Lisboa
2015 conf
ICIC (2)
Dhiya Al-Jumeily, Abir Jaafar Hussain, Paul Fergus, Naeem Radi
2015 C conf
DeSE
Ursula Lennon, Abir Jaafar Hussain, Hulya Francis, Dhiya Al-Jumeily, Paul Fergus, Mohammed Khalaf, Naeem Radi
2015 conf
ICIC (3)
Abir Jaafar Hussain, Paul Fergus, Dhiya Al-Jumeily, Haya Alaskar, Naeem Radi
2015 conf
IWSSIP
Abir Jaafar Hussain, Dhiya Al-Jumeily, Paul Fergus, Ursula Lennon, Mohammed Khalaf, Naeem Radi
2014 conf
ICIC (3)
Haya Al-Askar, Abir Jaafar Hussain, Dhiya Al-Jumeily, Naeem Radi
2011 C conf
DeSE
Naeem Radi, Abir Jaafar Hussain, Dhiya Al-Jumeily
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