James R. Campbell

18 papers C 6Journal 12
YearRankTypeTitle / Venue / Authors
2021 J jnl
Remote. Sens.
Tony Christian Landi, Paolo Bonasoni, Michele Brunetti, James R. Campbell, Jared Marquis, Paolo Di Girolamo, Simone Lolli
2021 C conf
IGARSS
James R. Campbell, Erica K. Dolinar, Anne Garnier, Jared W. Marquis, Theodore M. McHardy, Ping Yang, Jasper R. Lewis, Ellsworth J. Welton
2021 C conf
IGARSS
Ellsworth J. Welton, James R. Campbell, Jasper R. Lewis, Simone Lolli, Sebastian A. Stewart, Larry R. Belcher, Brent N. Holben, David M. Giles, Ilya Slutsker
2020 J jnl
Remote. Sens.
Simone Lolli, Kai Qin, James R. Campbell, Sheng-Hsiang Wang
2020 J jnl
Remote. Sens.
Simone Lolli, Gemine Vivone, Jasper R. Lewis, Michaël Sicard, Ellsworth J. Welton, James R. Campbell, Adolfo Comerón, Leo Pio D'Adderio, Ali Tokay, Aldo Giunta, Gelsomina Pappalardo
2019 J jnl
Remote. Sens.
Muhammad Bilal, Majid Nazeer, Janet E. Nichol, Max P. Bleiweiss, Zhongfeng Qiu, Evelyn Jäkel, James R. Campbell, Luqman Atique, Xiaolan Huang, Simone Lolli
2019 J jnl
Remote. Sens.
Muhammad Bilal, Majid Nazeer, Janet E. Nichol, Zhongfeng Qiu, Lunche Wang, Max P. Bleiweiss, Xiaojing Shen, James R. Campbell, Simone Lolli
2018 J jnl
Remote. Sens.
Muhammad Bilal, Zhongfeng Qiu, James R. Campbell, Scott N. Spak, Xiaojing Shen, Majid Nazeer
2018 J jnl
Remote. Sens.
Muhammad Imran Shahzad, Janet Elizabeth Nichol, James R. Campbell, Man Sing Wong
2018 J jnl
IEEE J. Sel. Top. Appl. Earth Obs. Remote. Sens.
Andrew T. Fontenot, Hesham M. El-Askary, Michael J. Garay, James R. Campbell, Olga V. Kalashnikova
2018 J jnl
Remote. Sens.
Simone Lolli, Leo Pio D'Adderio, James R. Campbell, Michaël Sicard, Ellsworth J. Welton, Andrea Binci, Alessandro Rea, Ali Tokay, Adolfo Comerón, Rubén Barragán, José María Baldasano, Sergi Gonzalez, Joan Bech, Nicola Afflitto, Jasper R. Lewis, Fabio Madonna
2017 J jnl
Remote. Sens.
Mika G. Tosca, James R. Campbell, Michael J. Garay, Simone Lolli, Felix C. Seidel, Jared Marquis, Olga V. Kalashnikova
2015 J jnl
Comput. Geosci.
Fei Xiao, Man Sing Wong, Kwon Ho Lee, James R. Campbell, Geoffrey Yu-Kai Shea
2010 J jnl
IEEE J. Sel. Top. Appl. Earth Obs. Remote. Sens.
James R. Campbell, Jeffrey S. Reid, Douglas L. Westphal, Jianglong Zhang, Edward J. Hyer, Ellsworth J. Welton
2004 C conf
IGARSS
Timothy A. Berkoff, Ellsworth J. Welton, James R. Campbell, Sandra Valencia, James D. Spinhirne, Si-Chee Tsay, Brent N. Holben
2003 C conf
IGARSS
Timothy A. Berkoff, Ellsworth J. Welton, James R. Campbell, V. S. Scott, James D. Spinhirne
2002 C conf
IGARSS
Jonathan A. R. Rall, John Cavanaugh, James R. Campbell, James B. Abshire, James D. Spinhirne
2002 C conf
IGARSS
James D. Spinhirne, Timothy A. Berkoff, Ellsworth J. Welton, James R. Campbell
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