Vikas Agrawal

16 papers A 2C 1Misc 1Journal 10Unranked 2
YearRankTypeTitle / Venue / Authors
2021 A conf
Interspeech
Hardik B. Sailor, Kiran Praveen, Vikas Agrawal, Abhinav Jain, Abhishek Pandey
2021 A conf
Interspeech
Vikas Agrawal, Shashi Kumar, Shakti P. Rath
2018 conf
DSN Workshops
Vikas Agrawal, Marcel Frueh, Oliver Bringmann, Wolfgang Rosenstiel
2017 J jnl
Soft Comput.
Vikas Agrawal, Constance A. Lightner, Carin A. Lightner-Laws, Neal Wagner
2016 J jnl
Int. J. Intell. Comput. Cybern.
Carin A. Lightner-Laws, Vikas Agrawal, Constance A. Lightner, Neal Wagner
2015 J jnl
AI Mag.
Christopher W. Geib, Vikas Agrawal, Gita Sukthankar, Lokendra Shastri, Hung Bui
2014 J jnl
Expert Syst. Appl.
Neal Wagner, Vikas Agrawal
2013 J jnl
AI Mag.
Vikas Agrawal, Christopher Archibald, Mehul Bhatt, Hung Bui, Diane J. Cook, Juan Cortés, Christopher W. Geib, Vibhav Gogate, Hans W. Guesgen, Dietmar Jannach, Michael Johanson, Kristian Kersting, George Dimitri Konidaris, Lars Kotthoff, Martin Michalowski, Sriraam Natarajan, Barry O'Sullivan, Marc Pickett, Vedran Podobnik, David Poole, Lokendra Shastri, Amarda Shehu, Gita Sukthankar
2013 J jnl
Int. J. Intell. Inf. Database Syst.
Neal Wagner, Vikas Agrawal
2012 C conf
ISI
Neal Wagner, Vikas Agrawal
2012 J jnl
AI Mag.
Noa Agmon, Vikas Agrawal, David W. Aha, Yiannis Aloimonos, Donagh Buckley, Prashant Doshi, Christopher W. Geib, Floriana Grasso, Nancy L. Green, Benjamin Johnston, Burt Kaliski, Christopher Kiekintveld, Edith Law, Henry Lieberman, Ole J. Mengshoel, Ted Metzler, Joseph Modayil, Douglas W. Oard, Nilufer Onder, Barry O'Sullivan, Katerina Pastra, Doina Precup, Sowmya Ramachandran, Chris Reed, Sanem Sariel Talay, Ted Selker, Lokendra Shastri, Stephen F. Smith, Satinder Singh, Siddharth Srivastava, Gita Sukthankar, David C. Uthus, Mary-Anne Williams
2012 J jnl
AI Mag.
Vikas Agrawal, Jorge A. Baier, Kostas E. Bekris, Yiling Chen, Artur S. d'Avila Garcez, Pascal Hitzler, Patrik Haslum, Dietmar Jannach, Edith Law, Freddy Lécué, Luís C. Lamb, Cynthia Matuszek, Héctor Palacios, Biplav Srivastava, Lokendra Shastri, Nathan R. Sturtevant, Roni Stern, Stefanie Tellex, Stavros Vassos
2007 J jnl
Int. J. Data Warehous. Min.
Mesbah U. Ahmed, Vikas Agrawal, Udayan Nandkeolyar, P. S. Sundararaghavan
2007 J jnl
J. Database Manag.
Vikas Agrawal, P. S. Sundararaghavan, Mesbah U. Ahmed, Udayan Nandkeolyar
2005 conf
ISMB (Supplement of Bioinformatics)
Henrik Jönsson, Marcus Heisler, G. Venugopala Reddy, Vikas Agrawal, Victoria Gor, Bruce E. Shapiro, Eric Mjolsness, Elliot M. Meyerowitz
2001 Misc conf
VLSI Design
Vikas Agrawal, Anand Pande, Mahesh Mehendale
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