Karl N. Kirschner

16 papers C 2Journal 12Unranked 1
YearRankTypeTitle / Venue / Authors
2023 J jnl
J. Chem. Inf. Model.
Max Müller, Alexander Hagg, Robin Strickstrock, Marco Hülsmann, Alexander Asteroth, Karl N. Kirschner, Dirk Reith
2023 J jnl
J. Chem. Inf. Model.
Alexander Hagg, Karl N. Kirschner
2022 J jnl
J. Chem. Inf. Model.
Walter Fiedler, Fabian Freisleben, Jasmin Wellbrock, Karl N. Kirschner
2022 J jnl
Comput. Phys. Commun.
Robin Strickstrock, Marco Hülsmann, Dirk Reith, Karl N. Kirschner
2020 C conf
EDUCON
Karl N. Kirschner, Susanne Keil, Katharina Seuser, Christine Siefer
2019 J jnl
SoftwareX
Austen Bernardi, Roland Faller, Dirk Reith, Karl N. Kirschner
2019 C conf
EDUCON
Karl N. Kirschner, Jürgen Bode, Dirk Reith
2017 ch.
Scientific Computing and Algorithms in Industrial Simulations
Thorsten Köddermann, Martin R. Schenk, Marco Hülsmann, Andreas Krämer, Karl N. Kirschner, Dirk Reith
2015 conf
FOMMS
Marco Hülsmann, Karl N. Kirschner, Andreas Krämer, Doron D. Heinrich, Ottmar Krämer-Fuhrmann, Dirk Reith
2014 J jnl
J. Comput. Aided Mol. Des.
Antje Wolf, Sebastian Schoof, Sascha Baumann, Hans-Dieter Arndt, Karl N. Kirschner
2013 J jnl
J. Chem. Inf. Model.
Ottmar Krämer-Fuhrmann, Jens Neisius, Niklas Gehlen, Dirk Reith, Karl N. Kirschner
2012 J jnl
ERCIM News
Dirk Reith, Karl N. Kirschner
2011 J jnl
Comput. Phys. Commun.
Dirk Reith, Karl N. Kirschner
2010 J jnl
ERCIM News
Karl N. Kirschner, Axel Arnold, Astrid Maaß
2009 J jnl
J. Comput. Chem.
Amanda M. Salisburg, Ashley L. Deline, Katrina W. Lexa, George C. Shields, Karl N. Kirschner
1993 J jnl
J. Comput. Chem.
Marcus W. Jurema, Karl N. Kirschner, George C. Shields
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