Ran Tian

110 papers A* 6A 2B 2C 6Misc 1Journal 68Unranked 25
YearRankTypeTitle / Venue / Authors
2026 J jnl
CoRR
Qianyu Yang, Yang Liu, Jiaqi Li, Jun Bai, Hao Chen, Kaiyuan Chen, Tiliang Duan, Jiayun Dong, Xiaobo Hu, Zixia Jia, Tao Peng, Yixin Ren, Ran Tian, Zaiyuan Wang, Yanglihong Xiao, Gang Yao, Lingyue Yin, Ge Zhang, Chun Zhang, Jianpeng Jiao, Zilong Zheng, Yuan Gong
2026 J jnl
IEEE Trans. Control. Syst. Technol.
Xiaoting Chen, Simone Baldi, Ran Tian, Fanfan Hu, Xiao Wang, Da Yan
2026 J jnl
IEEE Access
Ran Tian, Bo Wang, Meng Lu
2026 J jnl
J. Frankl. Inst.
Ran Tian, Jie Mei, Guangfu Ma
2025 J jnl
Neurocomputing
Zhihui Sun, Ran Tian, Jiarui Wu, Xin Lu, Jinshi Wang
2025 J jnl
CoRR
Sankalp Agrawal, Junwon Seo, Kensuke Nakamura, Ran Tian, Andrea Bajcsy
2025 J jnl
IEEE Trans. Intell. Transp. Syst.
Ran Tian, Bo Wang, Minmin Jiang
2025 J jnl
Expert Syst. Appl.
Ran Tian, Zhihui Sun, Xin Lu, ZhaoBin Li, Longlong Chang
2025 J jnl
IEEE Trans. Vis. Comput. Graph.
Dewen Guo, Ran Tian, Sinuo Liu, Guoping Wang, Sheng Li
2025 J jnl
CoRR
Ran Tian, Kratarth Goel
2025 J jnl
CoRR
Yilin Wu, Ran Tian, Gokul Swamy, Andrea Bajcsy
2025 J jnl
CoRR
Shuhan Tan, Kashyap Chitta, Yuxiao Chen, Ran Tian, Yurong You, Yan Wang, Wenjie Luo, Yulong Cao, Philipp Krähenbühl, Marco Pavone, Boris Ivanovic
2025 J jnl
IEEE Access
Ran Tian, Jinshi Wang, Zhihui Sun, Jiarui Wu, Xin Lu, Longlong Chang
2025 J jnl
Syst. Control. Lett.
Ran Tian, Jie Mei, Guangfu Ma
2025 J jnl
CoRR
Seth Z. Zhao, Huizhi Zhang, Zhaowei Li, Juntong Peng, Anthony Chui, Zewei Zhou, Zonglin Meng, Hao Xiang, Zhiyu Huang, Fujia Wang, Ran Tian, Chenfeng Xu, Bolei Zhou, Jiaqi Ma
2025 J jnl
IEEE Trans. Intell. Transp. Syst.
Ran Tian, Zhihui Sun, Longlong Chang, Jiarui Wu, Xin Lu
2025 J jnl
CoRR
Yuxin Chen, Jianglan Wei, Chenfeng Xu, Boyi Li, Masayoshi Tomizuka, Andrea Bajcsy, Ran Tian
2025 J jnl
IEEE Control. Syst. Lett.
Ke Chen, Ran Tian, Xiangzheng Meng, Jie Mei, Guangfu Ma
2025 J jnl
Trans. Mach. Learn. Res.
Boyi Li, Ligeng Zhu, Ran Tian, Shuhan Tan, Yuxiao Chen, Yao Lu, Yin Cui, Sushant Veer, Max Ehrlich, Jonah Philion, Xinshuo Weng, Fuzhao Xue, Linxi Fan, Yuke Zhu, Jan Kautz, Andrew Tao, Ming-Yu Liu, Sanja Fidler, Boris Ivanovic, Trevor Darrell, Jitendra Malik, Song Han, Marco Pavone
2024 J jnl
CoRR
Kensuke Nakamura, Ran Tian, Andrea Bajcsy
2024 J jnl
Frontiers Inf. Technol. Electron. Eng.
Ran Tian, Pulun Gao, Yanxing Liu
2024 J jnl
IEEE Trans. Syst. Man Cybern. Syst.
Ran Tian, Zhiqiang Zuo, Qiaoni Han, Yijing Wang, Wentao Zhang
2024 J jnl
Comput. Ind. Eng.
Ran Tian, Meng Lu, Haopeng Wang, Bo Wang, Qingxia Tang
2024 J jnl
KSII Trans. Internet Inf. Syst.
Ran Tian, Bo Wang, Chu Wang
2024 J jnl
CoRR
Yuxin Chen, Chen Tang, Chenran Li, Ran Tian, Peter Stone, Masayoshi Tomizuka, Wei Zhan
2024 J jnl
CoRR
Ran Tian, Yilin Wu, Chenfeng Xu, Masayoshi Tomizuka, Jitendra Malik, Andrea Bajcsy
2024 A* conf
ICRA
Abby O'Neill, Abdul Rehman, Abhiram Maddukuri, Abhishek Gupta, Abhishek Padalkar, Abraham Lee, Acorn Pooley, Agrim Gupta, Ajay Mandlekar, Ajinkya Jain, Albert Tung, Alex Bewley, Alexander Herzog, Alex Irpan, Alexander Khazatsky, Anant Rai, Anchit Gupta, Andrew E. Wang, Anikait Singh, Animesh Garg, Aniruddha Kembhavi, Annie Xie, Anthony Brohan, Antonin Raffin, Archit Sharma, Arefeh Yavary, Arhan Jain, Ashwin Balakrishna, Ayzaan Wahid, Ben Burgess-Limerick, Beomjoon Kim, Bernhard Schölkopf, Blake Wulfe, Brian Ichter, Cewu Lu, Charles Xu, Charlotte Le, Chelsea Finn, Chen Wang, Chenfeng Xu, Cheng Chi, Chenguang Huang, Christine Chan, Christopher Agia, Chuer Pan, Chuyuan Fu, Coline Devin, Danfei Xu, Daniel Morton, Danny Driess, Daphne Chen, Deepak Pathak, Dhruv Shah, Dieter Büchler, Dinesh Jayaraman, Dmitry Kalashnikov, Dorsa Sadigh, Edward Johns, Ethan Paul Foster, Fangchen Liu, Federico Ceola, Fei Xia, Feiyu Zhao, Freek Stulp, Gaoyue Zhou, Gaurav S. Sukhatme, Gautam Salhotra, Ge Yan, Gilbert Feng, Giulio Schiavi, Glen Berseth, Gregory Kahn, Guanzhi Wang, Hao Su, Haoshu Fang, Haochen Shi, Henghui Bao, Heni Ben Amor, Henrik I. Christensen, Hiroki Furuta, Homer Walke, Hongjie Fang, Huy Ha, Igor Mordatch, Ilija Radosavovic, Isabel Leal, Jacky Liang, Jad Abou-Chakra, Jaehyung Kim, Jaimyn Drake, Jan Peters, Jan Schneider, Jasmine Hsu, Jeannette Bohg, Jeffrey T. Bingham, Jeffrey Wu, Jensen Gao, Jiaheng Hu, Jiajun Wu, Jialin Wu, Jiankai Sun, Jianlan Luo, Jiayuan Gu, Jie Tan, Jihoon Oh, Jimmy Wu, Jingpei Lu, Jingyun Yang, Jitendra Malik, João Silvério, Joey Hejna, Jonathan Booher, Jonathan Tompson, Jonathan Yang, Jordi Salvador, Joseph J. Lim, Junhyek Han, Kaiyuan Wang, Kanishka Rao, Karl Pertsch, Karol Hausman, Keegan Go, Keerthana Gopalakrishnan, Ken Goldberg, Kendra Byrne, Kenneth Oslund, Kento Kawaharazuka, Kevin Black, Kevin Lin, Kevin Zhang, Kiana Ehsani, Kiran Lekkala, Kirsty Ellis, Krishan Rana, Krishnan Srinivasan, Kuan Fang, Kunal Pratap Singh, Kuo-Hao Zeng, Kyle Hatch, Kyle Hsu, Laurent Itti, Lawrence Yunliang Chen, Lerrel Pinto, Li Fei-Fei, Liam Tan, Linxi Jim Fan, Lionel Ott, Lisa Lee, Luca Weihs, Magnum Chen, Marion Lepert, Marius Memmel, Masayoshi Tomizuka, Masha Itkina, Mateo Guaman Castro, Max Spero, Maximilian Du, Michael Ahn, Michael C. Yip, Mingtong Zhang, Mingyu Ding, Minho Heo, Mohan Kumar Srirama, Mohit Sharma, Moo Jin Kim, Naoaki Kanazawa, Nicklas Hansen, Nicolas Heess, Nikhil J. Joshi, Niko Sünderhauf, Ning Liu, Norman Di Palo, Nur Muhammad (Mahi) Shafiullah, Oier Mees, Oliver Kroemer, Osbert Bastani, Pannag R. Sanketi, Patrick Tree Miller, Patrick Yin, Paul Wohlhart, Peng Xu, Peter David Fagan, Peter Mitrano, Pierre Sermanet, Pieter Abbeel, Priya Sundaresan, Qiuyu Chen, Quan Vuong, Rafael Rafailov, Ran Tian, Ria Doshi, Roberto Martín-Martín, Rohan Baijal, Rosario Scalise, Rose Hendrix, Roy Lin, Runjia Qian, Ruohan Zhang, Russell Mendonca, Rutav Shah, Ryan Hoque, Ryan Julian, Samuel Bustamante-Gomez, Sean Kirmani, Sergey Levine, Shan Lin, Sherry Moore, Shikhar Bahl, Shivin Dass, Shubham D. Sonawani, Shuran Song, Sichun Xu, Siddhant Haldar, Siddharth Karamcheti, Simeon Adebola, Simon Guist, Soroush Nasiriany, Stefan Schaal, Stefan Welker, Stephen Tian, Subramanian Ramamoorthy, Sudeep Dasari, Suneel Belkhale, Sungjae Park, Suraj Nair, Suvir Mirchandani, Takayuki Osa, Tanmay Gupta, Tatsuya Harada, Tatsuya Matsushima, Ted Xiao, Thomas Kollar, Tianhe Yu, Tianli Ding, Todor Davchev, Tony Z. Zhao, Travis Armstrong, Trevor Darrell, Trinity Chung, Vidhi Jain, Vincent Vanhoucke, Wei Zhan, Wenxuan Zhou, Wolfram Burgard, Xi Chen, Xiaolong Wang, Xinghao Zhu, Xinyang Geng, Xiyuan Liu, Liangwei Xu, Xuanlin Li, Yao Lu, Yecheng Jason Ma, Yejin Kim, Yevgen Chebotar, Yifan Zhou, Yifeng Zhu, Yilin Wu, Ying Xu, Yixuan Wang, Yonatan Bisk, Yoonyoung Cho, Youngwoon Lee, Yuchen Cui, Yue Cao, Yueh-Hua Wu, Yujin Tang, Yuke Zhu, Yunchu Zhang, Yunfan Jiang, Yunshuang Li, Yunzhu Li, Yusuke Iwasawa, Yutaka Matsuo, Zehan Ma, Zhuo Xu, Zichen Jeff Cui, Zichen Zhang, Zipeng Lin
2024 A conf
AAMAS
Yuxin Chen, Chen Tang, Ran Tian, Chenran Li, Jinning Li, Masayoshi Tomizuka, Wei Zhan
2024 J jnl
CoRR
Yixiao Wang, Yifei Zhang, Mingxiao Huo, Ran Tian, Xiang Zhang, Yichen Xie, Chenfeng Xu, Pengliang Ji, Wei Zhan, Mingyu Ding, Masayoshi Tomizuka
2024 Misc conf
CoRL
Ran Tian, Boyi Li, Xinshuo Weng, Yuxiao Chen, Edward Schmerling, Yue Wang, Boris Ivanovic, Marco Pavone
2024 J jnl
CoRR
Ran Tian, Boyi Li, Xinshuo Weng, Yuxiao Chen, Edward Schmerling, Yue Wang, Boris Ivanovic, Marco Pavone
2024 J jnl
CoRR
Boyi Li, Ligeng Zhu, Ran Tian, Shuhan Tan, Yuxiao Chen, Yao Lu, Yin Cui, Sushant Veer, Max Ehrlich, Jonah Philion, Xinshuo Weng, Fuzhao Xue, Andrew Tao, Ming-Yu Liu, Sanja Fidler, Boris Ivanovic, Trevor Darrell, Jitendra Malik, Song Han, Marco Pavone
2023 J jnl
Inf. Sci.
Chu Wang, Ran Tian, Jia Hu, Zhongyu Ma
2023 J jnl
J. Comput. Sci. Technol.
Ran Tian, Zulong Diao, Haiyang Jiang, Gaogang Xie
2023 conf
FSDM
GuangLu Zhao, Ran Tian, Jingxia Wang
2023 conf
DASFAA (1)
Chu Wang, Jia Hu, Ran Tian, Xin Gao, Zhongyu Ma
2023 J jnl
Frontiers Inf. Technol. Electron. Eng.
Ran Tian, Xinmei Li, Zhongyu Ma, Yanxing Liu, Jingxia Wang, Chu Wang
2023 J jnl
Comput. Ind. Eng.
Ran Tian, Chunming Kang, Jiaming Bi, Zhongyu Ma, Yanxing Liu, Saisai Yang, Fangfang Li
2023 J jnl
Appl. Intell.
Ran Tian, Chu Wang, Jia Hu, Zhongyu Ma
2023 J jnl
SIAM J. Control. Optim.
Ran Tian, Zhiyong Yu
2023 J jnl
Expert Syst. Appl.
Ran Tian, Saisai Yang, Chu Wang, Zhongyu Ma, Chunming Kang
2023 J jnl
Inf. Sci.
Ran Tian, Chu Wang, Jia Hu, Zhongyu Ma
2023 J jnl
CoRR
Yuxin Chen, Chen Tang, Ran Tian, Chenran Li, Jinning Li, Masayoshi Tomizuka, Wei Zhan
2023 A* conf
HRI
Ran Tian, Masayoshi Tomizuka, Anca D. Dragan, Andrea Bajcsy
2023 J jnl
CoRR
Ran Tian, Masayoshi Tomizuka, Anca D. Dragan, Andrea Bajcsy
2023 J jnl
CoRR
Ran Tian, Chenfeng Xu, Masayoshi Tomizuka, Jitendra Malik, Andrea Bajcsy
2022 J jnl
CoRR
Ran Tian, Ankur P. Parikh
2022 J jnl
IEEE Trans. Instrum. Meas.
Shiwei Gao, Qingsong Zhang, Ran Tian, Zhongyu Ma, Yanxing Liu, Ziqian Hao
2022 A* conf
ICRA
Ran Tian, Nan Li, Anouck Girard, Ilya V. Kolmanovsky, Masayoshi Tomizuka
2022 J jnl
Neurocomputing
Zhiqiang Zuo, Ran Tian, Qiaoni Han, Yijing Wang, Wentao Zhang
2022 J jnl
IEEE Trans. Intell. Transp. Syst.
Ran Tian, Nan Li, Ilya V. Kolmanovsky, Yildiray Yildiz, Anouck R. Girard
2022 conf
ICC
Ran Tian, Zulong Diao, Haiyang Jiang, Gaogang Xie
2022 J jnl
Concurr. Comput. Pract. Exp.
Shi-wei Gao, Ran Tian, Peng Chen
2022 J jnl
Comput. Ind. Eng.
Ran Tian, Chu Wang, Zhongyu Ma, Yanxing Liu, Shi-wei Gao
2022 A* conf
ICRA
Ran Tian, Liting Sun, Andrea Bajcsy, Masayoshi Tomizuka, Anca D. Dragan
2022 J jnl
CoRR
Tao Lei, Ran Tian, Jasmijn Bastings, Ankur P. Parikh
2021 A* conf
ICRA
Ran Tian, Liting Sun, Masayoshi Tomizuka, David Isele
2021 J jnl
CoRR
Ran Tian, Liting Sun, Masayoshi Tomizuka, David Isele
2021 A* conf
AAAI
Ran Tian, Liting Sun, Masayoshi Tomizuka
2021 A conf
IROS
Ran Tian, Masayoshi Tomizuka, Liting Sun
2021 J jnl
CoRR
Ran Tian, Masayoshi Tomizuka, Liting Sun
2021 conf
ICANN (1)
Ran Tian, Xiang Zhang, Donghang Chen, Yujie Hu
2021 C conf
ISCC
Ran Tian, Zulong Diao, Haiyang Jiang, Gaogang Xie
2021 J jnl
CoRR
Ran Tian, Anjian Li, Masayoshi Tomizuka, Liting Sun
2021 B conf
IJCNN
Donghang Chen, Xiang Zhang, Ran Tian, Yingqi Tang, Yujie Hu, Shaozhi Wu
2021 J jnl
Telecommun. Syst.
Zhongyu Ma, Yanxing Liu, Qun Guo, Xiaochao Dang, Zhanjun Hao, Ran Tian
2021 J jnl
CoRR
Ran Tian, Liting Sun, Andrea Bajcsy, Masayoshi Tomizuka, Anca D. Dragan
2021 J jnl
CoRR
Ran Tian, Joshua Maynez, Ankur P. Parikh
2020 J jnl
Syst. Control. Lett.
Ran Tian, Zhiyong Yu, Rucheng Zhang
2020 C conf
ACC
Ran Tian, Nan Li, Ilya V. Kolmanovsky, Anouck Girard
2020 J jnl
CoRR
Ran Tian, Liting Sun, Masayoshi Tomizuka
2020 conf
CCTA
Ran Tian, Nan Li, Anouck Girard, Ilya V. Kolmanovsky
2020 conf
EMNLP (1)
Jiaao Chen, Zhenghui Wang, Ran Tian, Zichao Yang, Diyi Yang
2020 J jnl
CoRR
Jiaao Chen, Zhenghui Wang, Ran Tian, Zichao Yang, Diyi Yang
2020 C conf
MMSP
Yujie Hu, Xiang Zhang, Yexin Li, Ran Tian
2020 J jnl
IEEE Access
Ran Tian, Jiaming Bi, Qiang Zhang, Yanxing Liu
2020 conf
WWW (Companion Volume)
Adele Lu Jia, Yuanxing Rao, Hongru Li, Ran Tian, Siqi Shen
2019 conf
ICIT
Tao Huang, Ran Tian, Lifang Niu, Shujian Xiang
2019 J jnl
CoRR
Ran Tian, Nan Li, Ilya V. Kolmanovsky, Anouck Girard
2019 J jnl
CoRR
Ran Tian, Nan Li, Ilya V. Kolmanovsky, Yildiray Yildiz, Anouck Girard
2019 conf
ICCAIS
Xiaomei Jiang, Michael Namokel, Chaobin Hu, Ran Tian, Jinzhong Dong
2019 J jnl
CoRR
Ran Tian, Shashi Narayan, Thibault Sellam, Ankur P. Parikh
2018 conf
CDC
Ran Tian, Sisi Li, Nan Li, Ilya V. Kolmanovsky, Anouck Girard, Yildiray Yildiz
2018 J jnl
CoRR
Ran Tian, Sisi Li, Nan Li, Ilya V. Kolmanovsky, Anouck Girard, Yildiray Yildiz
2018 conf
IEEA
Yue Zhang, Ran Tian, Xiaoye Dai, Yuezheng Ma, Hui Li, Lin Shi
2018 conf
ACL (1)
Ryo Takahashi, Ran Tian, Kentaro Inui
2018 J jnl
CoRR
Ryo Takahashi, Ran Tian, Kentaro Inui
2018 J jnl
IEEE Trans. Control. Syst. Technol.
Ricardo Bencatel, Ran Tian, Anouck R. Girard, Ilya V. Kolmanovsky
2018 conf
IEEA
Ran Tian, Dabiao Wang, Yue Zhang, Yuezheng Ma, Hui Li, Lin Shi
2017 J jnl
J. Inf. Process.
Shuangshuang Zhou, Naoaki Okazaki, Koji Matsuda, Ran Tian, Kentaro Inui
2017 conf
IJCNLP (Tutorial Abstracts)
Ran Tian, Koji Mineshima, Pascual Martínez-Gómez
2017 J jnl
Mach. Learn.
Ran Tian, Naoaki Okazaki, Kentaro Inui
2016 C conf
ACC
Andrew G. Lamperski, Bolei Di, Tyler Lekang, Jinsun Liu, Ran Tian
2016 conf
HLT-NAACL
Sosuke Kobayashi, Ran Tian, Naoaki Okazaki, Kentaro Inui
2016 conf
ACL (1)
Ran Tian, Naoaki Okazaki, Kentaro Inui
2016 J jnl
CoRR
Ran Tian, Naoaki Okazaki, Kentaro Inui
2016 B conf
LREC
Corentin Dumont, Ran Tian, Kentaro Inui
2015 conf
HotWeb
Ran Tian, Reza Rejaie
2015 C conf
PACLIC
Hiroya Komatsu, Ran Tian, Naoaki Okazaki, Kentaro Inui
2015 J jnl
CoRR
Ran Tian, Naoaki Okazaki, Kentaro Inui
2014 conf
NTCIR
Pascual Martínez-Gómez, Ran Tian, Yusuke Miyao
2014 C conf
PACLIC
Yubing Dong, Ran Tian, Yusuke Miyao
2014 conf
ACL (1)
Ran Tian, Yusuke Miyao, Takuya Matsuzaki
2013 conf
NTCIR
Ran Tian, Yusuke Miyao, Takuya Matsuzaki, Hiroyoshi Komatsu
2013 conf
WCSP
Yiyang Ni, Shi Jin, Ran Tian, Kai-Kit Wong, Hongbo Zhu, Shixiang Shao
2013 conf
CLEF (Working Notes)
Xinjian Li, Ran Tian, Ngan L. T. Nguyen, Yusuke Miyao, Akiko Aizawa
2010 conf
Geoinformatics
Huijun Gao, Hao Zhang, Daosheng Hu, Ran Tian, Dazhi Guo
2009 J jnl
Discret. Appl. Math.
Ran Tian
2007 conf
IPC
Shu Hua, Ran Tian
2007 conf
LSMS (2)
Yubin Ji, Ran Tian, Wenhan Lin
tests/unit/test_apk_decompile_extractor.py
← Index tests/unit/test_apk_decompile_extractor.py python
"""
Unit tests for DecompileAPK extractor, export data, and ClickHouse schemas.

Tests the main DecompileAPK extractor class following the DecompileBinja test pattern.
All analysis is mocked — no JADX/apktool/Java installation required.
"""
import hashlib
import os
import tempfile
import zipfile

import pytest
from unittest.mock import MagicMock, patch, PropertyMock
from dataclasses import asdict

pytestmark = [pytest.mark.unit, pytest.mark.apk, pytest.mark.decompile]


def _create_fake_apk_file():
    """Create a minimal APK file for testing and return its path."""
    tmpdir = tempfile.mkdtemp()
    apk_path = os.path.join(tmpdir, "test.apk")
    with zipfile.ZipFile(apk_path, "w") as zf:
        zf.writestr("AndroidManifest.xml", b"<manifest/>")
        zf.writestr("classes.dex", b"dex\n035\x00" + b"\x00" * 100)
    return apk_path


# ============================================================================
# DecompileAPK Extractor Tests
# ============================================================================

class TestDecompileAPK:
    """Tests for the DecompileAPK extractor class."""

    def test_tag(self):
        from redb.extractors.decompiler.DecompileAPK import DecompileAPK
        apk_path = _create_fake_apk_file()
        try:
            ext = DecompileAPK(apk_path, MagicMock())
            assert ext.tag() == "apk_decompiled"
        finally:
            os.unlink(apk_path)

    def test_get_clickhouse_table(self):
        from redb.extractors.decompiler.DecompileAPK import DecompileAPK
        apk_path = _create_fake_apk_file()
        try:
            ext = DecompileAPK(apk_path, MagicMock())
            assert ext.get_clickhouse_table() is None
        finally:
            os.unlink(apk_path)

    def test_timeout_default(self):
        from redb.extractors.decompiler.DecompileAPK import DecompileAPK
        apk_path = _create_fake_apk_file()
        try:
            ext = DecompileAPK(apk_path, MagicMock())
            assert ext.APK_DECOMPILE_TIMEOUT == 600
        finally:
            os.unlink(apk_path)

    def test_timeout_from_env(self):
        from redb.extractors.decompiler.DecompileAPK import DecompileAPK
        apk_path = _create_fake_apk_file()
        try:
            with patch.dict(os.environ, {"APK_DECOMPILE_TIMEOUT": "900"}):
                ext = DecompileAPK(apk_path, MagicMock())
                assert ext.APK_DECOMPILE_TIMEOUT == 900
        finally:
            os.unlink(apk_path)

    def test_timeout_invalid_env(self):
        from redb.extractors.decompiler.DecompileAPK import DecompileAPK
        apk_path = _create_fake_apk_file()
        try:
            with patch.dict(os.environ, {"APK_DECOMPILE_TIMEOUT": "not_a_number"}):
                ext = DecompileAPK(apk_path, MagicMock())
                assert ext.APK_DECOMPILE_TIMEOUT == 600
        finally:
            os.unlink(apk_path)

    def test_calculate_md5(self):
        from redb.extractors.decompiler.DecompileAPK import DecompileAPK
        apk_path = _create_fake_apk_file()
        try:
            ext = DecompileAPK(apk_path, MagicMock())
            result = ext.calculate_md5("test_string")
            assert len(result) == 32
            assert result == hashlib.md5(b"test_string").hexdigest()
        finally:
            os.unlink(apk_path)

    def test_context_manager(self):
        from redb.extractors.decompiler.DecompileAPK import DecompileAPK
        apk_path = _create_fake_apk_file()
        try:
            with DecompileAPK(apk_path, MagicMock()) as ext:
                assert ext is not None
        finally:
            os.unlink(apk_path)

    def test_cleanup_run(self):
        from redb.extractors.decompiler.DecompileAPK import DecompileAPK
        apk_path = _create_fake_apk_file()
        try:
            ext = DecompileAPK(apk_path, MagicMock())
            ext.analyzer = MagicMock()
            ext.cleanup_run()
            assert ext.analyzer is None
        finally:
            os.unlink(apk_path)


# ============================================================================
# Export Data Tests
# ============================================================================

class TestPrepareExportData:
    """Tests for DecompileAPK.prepare_export_data() ClickHouse schemas."""

    def _make_extractor_with_results(self):
        from redb.extractors.decompiler.DecompileAPK import DecompileAPK
        apk_path = _create_fake_apk_file()
        ext = DecompileAPK(apk_path, MagicMock())
        ext.analysis_results = {
            "sha256": "a" * 64,
            "sha1": "b" * 40,
            "md5": "c" * 32,
            "decompiled_content": [
                {
                    "decompiled_method_hash": "d" * 64,
                    "decompiled_method": "public void foo() {}",
                    "decompiled_method_type": "USER",
                    "decompiled_has_string_encryption": False,
                    "decompiled_has_reflection_calls": False,
                    "decompiled_excessive_goto_count": False,
                }
            ],
            "decompiled_refs": [
                {
                    "decompiled_method_hash": "d" * 64,
                    "smali_method_hash": "e" * 64,
                    "decompiled_class_name": "com.example.Foo",
                    "decompiled_method_name": "foo",
                    "decompiled_method_signature": "()V",
                    "decompiled_method_prototype": "void foo()",
                    "functions_caller": ["bar"],
                    "functions_call": ["baz"],
                }
            ],
            "smali_content": [
                {
                    "smali_method_hash": "e" * 64,
                    "smali_method": "invoke-virtual {p0}, Lfoo;->bar()V\nreturn-void",
                    "smali_method_type": "USER",
                    "smali_instructions_count": 10,
                    "smali_register_count": 3,
                    "smali_has_string_encryption": False,
                    "smali_has_reflection_calls": False,
                    "smali_excessive_goto_count": False,
                    "smali_flattened_score": 0.0,
                    "smali_mba_score": 0.0,
                }
            ],
            "smali_refs": [
                {
                    "smali_method_hash": "e" * 64,
                    "decompiled_method_hash": "d" * 64,
                    "smali_class_name": "com.example.Foo",
                    "smali_method_name": "foo",
                    "smali_method_signature": "()V",
                    "ssdeep_smali": None,
                    "tlsh_smali": None,
                }
            ],
            "similarity_metrics": [
                {
                    "smali_method_hash": "e" * 64,
                    "cyclomatic_complexity": 2,
                    "ssdeep_smali": None,
                    "tlsh_smali": None,
                    "ssdeep_smali_normalized": None,
                    "tlsh_smali_normalized": None,
                    "minhash": [],
                }
            ],
            "cfg": [
                {
                    "smali_method_hash": "e" * 64,
                    "cfg_topology_hash": b'\x01' * 16,
                    "block_count": 3,
                    "edge_count": 3,
                    "cfg_instructions_count": 10,
                    "call_count": 1,
                    "cyclomatic_complexity": 2,
                    "loop_count": 0,
                    "max_depth": 2,
                    "max_fan_out": 2,
                    "md_index_topdown": 12345,
                    "md_index_bottomup": 67890,
                    "prime_product_smali": 999,
                    "cfg_feature_tlsh": None,
                    "wl_minhash": [0] * 128,
                    "bb_features": [[5, 1, 0, 1, 1, 0, 0, 2]] * 3,
                    "cfg_adjacency": [0x00000001, 0x00000002],
                }
            ],
            "strings": [
                {
                    "string": "https://evil.example.com/payload",
                    "string_encoding": "UTF8",
                    "string_offset": 0,
                    "string_length": 31,
                    "string_entropy": 3.95,
                }
            ],
            "analysis_errors": [
                {
                    "class_name": "com.example.Foo",
                    "method_name": "bar",
                    "error_location": "jadx",
                    "error_message": "timeout",
                    "error_type": "TimeoutError",
                }
            ],
        }
        return ext, apk_path

    def test_returns_none_when_no_results(self):
        from redb.extractors.decompiler.DecompileAPK import DecompileAPK
        apk_path = _create_fake_apk_file()
        try:
            ext = DecompileAPK(apk_path, MagicMock())
            assert ext.prepare_export_data("ClickHouseExporter") is None
        finally:
            os.unlink(apk_path)

    def test_multi_table_flag(self):
        ext, apk_path = self._make_extractor_with_results()
        try:
            export = ext.prepare_export_data("ClickHouseExporter")
            assert export["multi_table"] is True
        finally:
            os.unlink(apk_path)

    def test_all_table_keys_present(self):
        ext, apk_path = self._make_extractor_with_results()
        try:
            export = ext.prepare_export_data("ClickHouseExporter")
            assert "decompiled_content" in export
            assert "decompiled_refs" in export
            assert "smali_content" in export
            assert "smali_refs" in export
            assert "method_similarity_metrics" in export
            assert "strings_raw" in export
            assert "analysis_errors" in export
        finally:
            os.unlink(apk_path)

    def test_decompiled_content_schema(self):
        ext, apk_path = self._make_extractor_with_results()
        try:
            export = ext.prepare_export_data("ClickHouseExporter")
            dc = export["decompiled_content"]
            assert dc["table"] == "code_apk_decompiled_methods_content"
            assert len(dc["column_names"]) == 7
            assert len(dc["column_type_names"]) == 7
            assert "decompiled_method_hash" in dc["column_names"]
            assert "decompiled_method" in dc["column_names"]
            assert "analysis_date" in dc["column_names"]
            assert len(dc["data"]) == 1
            assert len(dc["data"][0]) == 7
        finally:
            os.unlink(apk_path)

    def test_decompiled_refs_schema(self):
        ext, apk_path = self._make_extractor_with_results()
        try:
            export = ext.prepare_export_data("ClickHouseExporter")
            dr = export["decompiled_refs"]
            assert dr["table"] == "code_apk_decompiled_methods_references"
            assert len(dr["column_names"]) == 10
            assert len(dr["column_type_names"]) == 10
            assert "sha256" in dr["column_names"]
            assert "sha1" not in dr["column_names"]
            assert "md5" not in dr["column_names"]
            assert "functions_caller" in dr["column_names"]
            assert "functions_call" in dr["column_names"]
        finally:
            os.unlink(apk_path)

    def test_smali_content_schema(self):
        ext, apk_path = self._make_extractor_with_results()
        try:
            export = ext.prepare_export_data("ClickHouseExporter")
            sc = export["smali_content"]
            assert sc["table"] == "code_apk_smali_methods_content"
            assert len(sc["column_names"]) == 11
            assert len(sc["column_type_names"]) == 11
            assert "smali_instructions_count" in sc["column_names"]
            assert "smali_register_count" in sc["column_names"]
            assert "smali_flattened_score" in sc["column_names"]
            assert "smali_mba_score" in sc["column_names"]
        finally:
            os.unlink(apk_path)

    def test_smali_refs_schema(self):
        ext, apk_path = self._make_extractor_with_results()
        try:
            export = ext.prepare_export_data("ClickHouseExporter")
            sr = export["smali_refs"]
            assert sr["table"] == "code_apk_smali_methods_references"
            assert len(sr["column_names"]) == 7
            assert len(sr["column_type_names"]) == 7
            assert "sha1" not in sr["column_names"]
            assert "md5" not in sr["column_names"]
            assert "ssdeep_smali" not in sr["column_names"]
            assert "tlsh_smali" not in sr["column_names"]
        finally:
            os.unlink(apk_path)

    def test_similarity_metrics_schema(self):
        ext, apk_path = self._make_extractor_with_results()
        try:
            export = ext.prepare_export_data("ClickHouseExporter")
            sm = export["method_similarity_metrics"]
            assert sm["table"] == "code_apk_method_similarity_metrics"
            assert len(sm["column_names"]) == 7
            assert "minhash" in sm["column_names"]
            assert "ssdeep_smali_normalized" in sm["column_names"]
            assert "tlsh_smali_normalized" in sm["column_names"]
            # cyclomatic_complexity moved to cfg table
            assert "cyclomatic_complexity" not in sm["column_names"]
            assert "block_count" not in sm["column_names"]
            assert "loop_count" not in sm["column_names"]
        finally:
            os.unlink(apk_path)

    def test_analysis_errors_schema(self):
        ext, apk_path = self._make_extractor_with_results()
        try:
            export = ext.prepare_export_data("ClickHouseExporter")
            ae = export["analysis_errors"]
            assert ae["table"] == "code_apk_analysis_errors"
            assert len(ae["column_names"]) == 9
            assert "error_hash" in ae["column_names"]
            assert "status" in ae["column_names"]
        finally:
            os.unlink(apk_path)

    def test_sha256_propagated_to_refs(self):
        ext, apk_path = self._make_extractor_with_results()
        try:
            export = ext.prepare_export_data("ClickHouseExporter")
            # Check that sha256 from analysis_results appears in ref rows
            dr_row = export["decompiled_refs"]["data"][0]
            assert dr_row[0] == "a" * 64  # sha256
            # sha1 and md5 no longer included in refs
            assert "sha1" not in export["decompiled_refs"]["column_names"]
            assert "md5" not in export["decompiled_refs"]["column_names"]
        finally:
            os.unlink(apk_path)

    def test_empty_tables_not_included(self):
        from redb.extractors.decompiler.DecompileAPK import DecompileAPK
        apk_path = _create_fake_apk_file()
        try:
            ext = DecompileAPK(apk_path, MagicMock())
            ext.analysis_results = {
                "sha256": "a" * 64,
                "sha1": "b" * 40,
                "md5": "c" * 32,
                "decompiled_content": [],
                "decompiled_refs": [],
                "smali_content": [],
                "smali_refs": [],
                "similarity_metrics": [],
                "cfg": [],
                "strings": [],
                "analysis_errors": [],
            }
            export = ext.prepare_export_data("ClickHouseExporter")
            assert export == {"multi_table": True}
        finally:
            os.unlink(apk_path)

    def test_non_clickhouse_exporter_returns_none(self):
        ext, apk_path = self._make_extractor_with_results()
        try:
            result = ext.prepare_export_data("ElasticsearchExporter")
            assert result is None
        finally:
            os.unlink(apk_path)


# ============================================================================
# Dataclass Tests
# ============================================================================

class TestAPKCodeAnalysisDataclasses:
    """Tests for the new APK code analysis dataclasses."""

    def test_decompiled_method_content(self):
        from redb.models.dataclasses import APKDecompiledMethodContent
        dc = APKDecompiledMethodContent(
            decompiled_method_hash="a" * 64,
            decompiled_method="public void foo() {}",
            decompiled_method_type="USER",
        )
        assert dc.decompiled_has_string_encryption is False
        assert dc.decompiled_has_reflection_calls is False
        assert dc.decompiled_excessive_goto_count is False

    def test_decompiled_method_content_populated(self):
        from redb.models.dataclasses import APKDecompiledMethodContent
        dc = APKDecompiledMethodContent(
            decompiled_method_hash="a" * 64,
            decompiled_method="public void foo() {}",
            decompiled_method_type="USER",
            decompiled_has_string_encryption=True,
            decompiled_has_reflection_calls=True,
            decompiled_excessive_goto_count=True,
        )
        assert dc.decompiled_has_string_encryption is True
        d = asdict(dc)
        assert d["decompiled_method_hash"] == "a" * 64

    def test_decompiled_method_reference(self):
        from redb.models.dataclasses import APKDecompiledMethodReference
        dr = APKDecompiledMethodReference(
            sha256="a" * 64,
            sha1="b" * 40,
            md5="c" * 32,
            decompiled_method_hash="d" * 64,
        )
        assert dr.functions_caller == []
        assert dr.functions_call == []
        assert dr.smali_method_hash is None

    def test_smali_method_content(self):
        from redb.models.dataclasses import APKSmaliMethodContent
        sc = APKSmaliMethodContent(
            smali_method_hash="e" * 64,
            smali_method="invoke-virtual {p0}, Lfoo;->bar()V",
            smali_method_type="USER",
            smali_instructions_count=5,
            smali_register_count=3,
        )
        assert sc.smali_instructions_count == 5
        assert sc.smali_register_count == 3

    def test_smali_method_reference(self):
        from redb.models.dataclasses import APKSmaliMethodReference
        sr = APKSmaliMethodReference(
            sha256="a" * 64,
            sha1="b" * 40,
            md5="c" * 32,
            smali_method_hash="e" * 64,
        )
        assert sr.decompiled_method_hash is None
        assert sr.ssdeep_smali is None
        assert sr.tlsh_smali is None

    def test_method_similarity_metrics(self):
        from redb.models.dataclasses import APKMethodSimilarityMetrics
        ms = APKMethodSimilarityMetrics(smali_method_hash="e" * 64)
        assert ms.cyclomatic_complexity is None
        assert ms.ssdeep_smali_normalized is None
        assert ms.tlsh_smali_normalized is None
        assert ms.minhash == []

    def test_code_analysis_error(self):
        from redb.models.dataclasses import APKCodeAnalysisError
        err = APKCodeAnalysisError(
            sha256="a" * 64,
            error_location="jadx",
            error_message="timeout",
        )
        assert err.class_name is None
        assert err.method_name is None
        assert err.error_type is None


# ============================================================================
# Tag Enum Tests
# ============================================================================

class TestAPKDecompiledTag:
    """Tests for the APK_DECOMPILED tag enum."""

    def test_tag_exists(self):
        from redb.extractors.enum import Tag
        assert hasattr(Tag, "APK_DECOMPILED")

    def test_tag_value(self):
        from redb.extractors.enum import Tag
        assert Tag.APK_DECOMPILED.value == "apk_decompiled"


# ============================================================================
# Worker Integration Tests
# ============================================================================

class TestAPKWorkerDecompileIntegration:
    """Tests that DecompileAPK is registered in workers.py."""

    def test_module_registered(self):
        """Verify DecompileAPK is discoverable via the extractor registry."""
        from redb.extractor_registry import get_extractor_class
        cls = get_extractor_class("DecompileAPK")
        assert cls is not None, "DecompileAPK not found in extractor registry"
        assert cls.__name__ == "DecompileAPK"

    def test_worker_apk_dispatch_includes_decompile(self):
        import inspect
        import redb.workers as workers
        source = inspect.getsource(workers.process_binary_file)
        assert "DecompileAPK" in source