Magnus Strengert

20 papers A 1C 2Journal 5Unranked 11
YearRankTypeTitle / Venue / Authors
2010
Magnus Strengert
2009 J jnl
IEEE Trans. Vis. Comput. Graph.
Christoph Müller, Steffen Frey, Magnus Strengert, Carsten Dachsbacher, Thomas Ertl
2009 conf
ISVC (1)
Steffen Frey, Christoph Müller, Magnus Strengert, Thomas Ertl
2008 conf
EGPGV@Eurographics
Magnus Strengert, Christoph Müller, Carsten Dachsbacher, Thomas Ertl
2008 conf
VMV
Markus Üffinger, Thomas Klein, Magnus Strengert, Thomas Ertl
2007 conf
Graphics Hardware
Magnus Strengert, Thomas Klein, Thomas Ertl
2007 J jnl
Parallel Comput.
Christoph Müller, Magnus Strengert, Thomas Ertl
2007 conf
APVIS
Martin Kraus, Magnus Strengert, Thomas Klein, Thomas Ertl
2007 J jnl
Comput. Graph. Forum
Martin Kraus, Magnus Strengert
2007 conf
SCIA
Martin Kraus, Mike Eissele, Magnus Strengert
2007 conf
GRAPP (GM/R)
Martin Kraus, Magnus Strengert
2007 C conf
EGPGV
Brendan Moloney, Daniel Weiskopf, Torsten Möller, Magnus Strengert
2006 conf
EGPGV@EuroVis/EGVE
Christoph Müller, Magnus Strengert, Thomas Ertl
2006 conf
EGPGV@EuroVis/EGVE
Sven Bachthaler, Magnus Strengert, Daniel Weiskopf, Thomas Ertl
2006 J jnl
Vis. Comput.
Magnus Strengert, Thomas Klein, Ralf Peter Botchen, Simon Stegmaier, Min Chen, Thomas Ertl
2005 conf
VG
Simon Stegmaier, Magnus Strengert, Thomas Klein, Thomas Ertl
2005 A conf
IEEE Visualization
Thomas Klein, Magnus Strengert, Simon Stegmaier, Thomas Ertl
2005 J jnl
Parallel Comput.
Magnus Strengert, Marcelo Magallón, Daniel Weiskopf, Stefan Guthe, Thomas Ertl
2004 C conf
EGPGV
Magnus Strengert, Marcelo Magallón, Daniel Weiskopf, Stefan Guthe, Thomas Ertl
2003 conf
Image-Guided Procedures
Frank Enders, Magnus Strengert, Sabine Iserhardt-Bauer, Usaf E. Aladl, Piotr J. Slomka
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