Chan Yong Park

13 papers C 4Misc 1Unranked 8
YearRankTypeTitle / Venue / Authors
2019 C conf
ICCE
Chan Yong Park, Han-Gyu Kim, Ho-Jin Choi
2019 conf
BigComp
Young-Jun Lee, Chan Yong Park, Ho-Jin Choi
2018 conf
BigComp
Byungsoo Ko, Chan Yong Park, Dongkeon Lee, Jaewon Kim, Ho-Jin Choi, Dongsoo Han
2018 conf
BigComp
Chan Yong Park, Han-Gyu Kim, Dongkeon Lee, Zhun Li, Seung-Ho Han, Ho-Jin Choi
2018 conf
BigComp
Kyo-Joong Oh, Dongkun Lee, Chan Yong Park, Young-Seob Jeong, Sawook Hong, Sungtae Kwon, Ho-Jin Choi
2017 conf
MedInfo
Seung-Ho Han, Han-Gyu Kim, Chan Yong Park, Ho-Jin Choi
2014 C conf
ICCE
Chan Yong Park, Joon-Ho Lim, Hyung Soo Han
2012 C conf
ICCE
Chan Yong Park, Joon-Ho Lim, Soojin Park
2011 conf
EMBC
Joon-Ho Lim, Chan Yong Park, Soo-Jun Park, Kyu-Chul Lee
2009 C conf
ICOST
Chan Yong Park, Soo-Jun Park
2007 Misc conf
OZCHI
Han-Sol Ryu, Yeo-Jin Yoon, Myeong-Eun Lim, Chan Yong Park, Soo-Jun Park, Soo-Mi Choi
2006 conf
MICAI
Chan Yong Park, Sung-Hee Park, Dae-Hee Kim, Soo-Jun Park, Mankyu Sung, Hong-Ro Lee, Jung-Sub Shin, Chi-Jung Hwang
2005 conf
ICCSA (2)
Sung-Hee Park, Chan Yong Park, Dae-Hee Kim, Seon Hee Park, Jeong Seop Sim
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