Neil Thompson

20 papers A* 3Journal 16Unranked 1
YearRankTypeTitle / Venue / Authors
2026 J jnl
CoRR
Wensu Li, Atin Aboutorabi, Harry Lyu, Kaizhi Qian, Martin Fleming, Brian C. Goehring, Neil Thompson
2026 J jnl
CoRR
Emanuele Del Sozzo, Martin Fleming, Kenneth Flamm, Neil Thompson
2026 J jnl
CoRR
Matthias Mertens, Natalia Fischl-Lanzoni, Neil Thompson
2025 J jnl
CoRR
Hayden Rome, Jayson Lynch, Jeffery Li, Chirag Falor, Neil Thompson
2025 J jnl
CoRR
Alexander K. Saeri, Sophia Lloyd George, Jess Graham, Clelia D. Lacarriere, Peter Slattery, Michael Noetel, Neil Thompson
2025 J jnl
CoRR
Hans Gundlach, Jayson Lynch, Neil Thompson
2025 J jnl
CoRR
Hans Gundlach, Hrvoje Kukina, Jayson Lynch, Neil Thompson
2025 J jnl
CoRR
Hans Gundlach, Jayson Lynch, Matthias Mertens, Neil Thompson
2024 A* conf
AAAI
Neil Thompson, Martin Fleming, Benny J. Tang, Anna M. Pastwa, Nicholas Borge, Brian C. Goehring, Subhro Das
2024 A* conf
NeurIPS
Anson Ho, Tamay Besiroglu, Ege Erdil, Zifan Carl Guo, David Owen, Robi Rahman, David Atkinson, Neil Thompson, Jaime Sevilla
2024 J jnl
CoRR
Anson Ho, Tamay Besiroglu, Ege Erdil, David Owen, Robi Rahman, Zifan Carl Guo, David Atkinson, Neil Thompson, Jaime Sevilla
2024 J jnl
CoRR
Sebastian Sartor, Neil Thompson
2024 J jnl
CoRR
Peter Slattery, Alexander K. Saeri, Emily A. C. Grundy, Jess Graham, Michael Noetel, Risto Uuk, James Dao, Soroush Pour, Stephen Casper, Neil Thompson
2024 J jnl
CoRR
Tamay Besiroglu, Sage Andrus Bergerson, Amelia Michael, Lennart Heim, Xueyun Luo, Neil Thompson
2023 J jnl
CoRR
Tal Shnitzer, Anthony Ou, Mírian Silva, Kate Soule, Yuekai Sun, Justin Solomon, Neil Thompson, Mikhail Yurochkin
2023 A* conf
NeurIPS
Fraser Mince, Dzung Dinh, Jonas Kgomo, Neil Thompson, Sara Hooker
2023 J jnl
CoRR
Fraser Mince, Dzung Dinh, Jonas Kgomo, Neil Thompson, Sara Hooker
2022 J jnl
CoRR
Misha Teplitskiy, Soya Park, Neil Thompson, David R. Karger
2008 conf
ICST Workshops
Mike Smith, Neil Thompson
2003 J jnl
Softw. Test. Verification Reliab.
Neil Thompson
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