Jack C. P. Cheng

54 papers C 3Journal 48Unranked 3
YearRankTypeTitle / Venue / Authors
2026 J jnl
Adv. Eng. Informatics
Xingbo Gong, Xingyu Tao, YuQing Xu, Helen H. L. Kwok, Weiwei Chen, Da Shi, Dezhi Li, Jack C. P. Cheng
2026 J jnl
Adv. Eng. Informatics
Fangzhou Lin, Mingkai Li, Boyu Wang, Qian Wang, Xiao Zhang, Jack C. P. Cheng, Zhengyi Chen
2026 J jnl
J. Comput. Civ. Eng.
Hongzhe Yue, Qian Wang, Yicheng Huang, Hai Fang, Jack C. P. Cheng, Luping Li
2026 J jnl
Comput. Environ. Urban Syst.
Fengyi Xu, Jun Ma, Waishan Qiu, Cui Guo, Jack C. P. Cheng
2026 J jnl
CoRR
Chao Yin, Hongzhe Yue, Qing Han, Difeng Hu, Zhenyu Liang, Fangzhou Lin, Bing Sun, Boyu Wang, Mingkai Li, Wei Yao, Jack C. P. Cheng
2026 J jnl
Adv. Eng. Informatics
Hongzhe Yue, Qian Wang, Xiang Nie, Hai Fang, Jack C. P. Cheng, Shuju Jing, Boyu Wang
2025 J jnl
Comput. Aided Civ. Infrastructure Eng.
Hongzhe Yue, Qian Wang, Yang Su, Hai Fang, Jack C. P. Cheng, Mingyu Zhang
2025 J jnl
Adv. Eng. Informatics
Hao Liu, Mingkai Li, Jack C. P. Cheng, Chimay J. Anumba, Liqiao Xia
2025 J jnl
Adv. Eng. Informatics
Ang Li, Peter Kok-Yiu Wong, Xingyu Tao, Jun Ma, Jack C. P. Cheng
2025 J jnl
CoRR
Fengyi Xu, Jun Ma, Waishan Qiu, Cui Guo, Jack C. P. Cheng
2025 J jnl
Adv. Eng. Informatics
Hongzhe Yue, Qian Wang, Hong Huang, Xin Xia, Hai Fang, Jack C. P. Cheng
2025 J jnl
Adv. Eng. Informatics
Boyu Wang, Fangzhou Lin, Mingkai Li, Zhenyu Liang, Zhengyi Chen, Mingzhu Wang, Jack C. P. Cheng
2025 J jnl
Adv. Eng. Informatics
Zhenyu Liang, Liu Yang, Zhaolun Liang, Jeff Chak Fu Chan, Zhaojie Zhang, Mingzhu Wang, Jack C. P. Cheng
2024 J jnl
Adv. Eng. Informatics
YuQing Xu, Xingyu Tao, Moumita Das, Helen H. L. Kwok, Hao Liu, Karina K. L. Kuan, Alexis K. H. Lau, Jack C. P. Cheng
2024 J jnl
Adv. Eng. Informatics
Hao Liu, Vincent J. L. Gan, Jack C. P. Cheng, Shanjing Alexander Zhou
2024 J jnl
Eng. Appl. Artif. Intell.
Fenghua Liu, Wenli Liu, Ang Li, Jack C. P. Cheng
2024 J jnl
Adv. Eng. Informatics
Xingyu Tao, Zhaoji Wu, YuQing Xu, Chengliang Zheng, Yihai Fang, Moumita Das, Hao Liu, Xingbo Gong, Jack C. P. Cheng
2023 J jnl
J. Comput. Civ. Eng.
Jack C. P. Cheng, Changhao Song, Xiao Zhang, Zhengyi Chen
2023 J jnl
Comput. Ind.
Liu Yang, Hoon Sohn, Zhanxiong Ma, Ikgeun Jeon, Peipei Liu, Jack C. P. Cheng
2023 J jnl
Comput. Ind.
Xingyu Tao, Peter Kok-Yiu Wong, YuQing Xu, Yuhan Liu, Xingbo Gong, Chengliang Zheng, Moumita Das, Jack C. P. Cheng
2022 J jnl
Adv. Eng. Informatics
Hao Liu, Jack C. P. Cheng, Vincent J. L. Gan, Shanjing Alexander Zhou
2022 J jnl
Comput. Aided Civ. Infrastructure Eng.
Peter Kok-Yiu Wong, Han Luo, Mingzhu Wang, Jack C. P. Cheng
2022 J jnl
Comput. Ind.
Zaolin Pan, Cheng Su, Yichuan Deng, Jack C. P. Cheng
2022 J jnl
Adv. Eng. Informatics
Jack C. P. Cheng, Kwok Ho Poon, Peter Kok-Yiu Wong
2022 J jnl
Adv. Eng. Informatics
Kwok Ho Poon, Peter Kok-Yiu Wong, Jack C. P. Cheng
2021 J jnl
Comput. Ind.
Min Deng, Yi Tan, Jyoti Singh, Ajay Joneja, Jack C. P. Cheng
2021 J jnl
Adv. Eng. Informatics
Peter Kok-Yiu Wong, Han Luo, Mingzhu Wang, Pak Him Leung, Jack C. P. Cheng
2020 J jnl
Comput. Aided Civ. Infrastructure Eng.
Mingzhu Wang, Jack C. P. Cheng
2020 J jnl
J. Comput. Civ. Eng.
Srinath Shiv Kumar, Mingzhu Wang, Dulcy M. Abraham, Mohammad R. Jahanshahi, Tom Iseley, Jack C. P. Cheng
2020 J jnl
J. Comput. Civ. Eng.
Keyu Chen, Weiwei Chen, Jack C. P. Cheng, Qian Wang
2020 J jnl
Adv. Eng. Informatics
Jun Ma, Jack C. P. Cheng, Feifeng Jiang, Vincent J. L. Gan, Mingzhu Wang, Chong Zhai
2020 J jnl
Adv. Eng. Informatics
Jun Ma, Jack C. P. Cheng, Yuexiong Ding, Changqing Lin, Feifeng Jiang, Mingzhu Wang, Chong Zhai
2019 J jnl
J. Inf. Technol. Constr.
Keyu Chen, Weiwei Chen, Chun Ting Li, Jack C. P. Cheng
2019 J jnl
IEEE Access
Jun Ma, Yuexiong Ding, Jack C. P. Cheng, Yi Tan, Vincent J. L. Gan, Jingcheng Zhang
2019 J jnl
Adv. Eng. Informatics
Min Deng, Vincent J. L. Gan, Yi Tan, Ajay Joneja, Jack C. P. Cheng
2019 J jnl
Comput. Ind.
Songfei Wu, Qiyu Shen, Yichuan Deng, Jack C. P. Cheng
2019 J jnl
Adv. Eng. Informatics
Vincent J. L. Gan, C. L. Wong, Kam Tim Tse, Jack C. P. Cheng, Irene M. C. Lo, Chun Man Chan
2018 J jnl
J. Comput. Civ. Eng.
Qian Wang, Hoon Sohn, Jack C. P. Cheng
2018 conf
EG-ICE
Mingzhu Wang, Jack C. P. Cheng
2018 conf
EG-ICE
Jack C. P. Cheng, Helen H. L. Kwok, Alison Li, Jimmy Tong, Alexis K. H. Lau
2018 conf
EG-ICE
Weiwei Chen, Keyu Chen, Jack C. P. Cheng
2017 J jnl
ISPRS Int. J. Geo Inf.
Xin Liu, Xiangyu Wang, Graeme Wright, Jack C. P. Cheng, Xiao Li, Rui Liu
2017 J jnl
Comput. Aided Civ. Infrastructure Eng.
Qian Wang, Jack C. P. Cheng, Hoon Sohn
2017 J jnl
Adv. Eng. Informatics
M. A. Jun, Jack C. P. Cheng
2017 J jnl
ISPRS Int. J. Geo Inf.
Yongze Song, Xiangyu Wang, Yi Tan, Peng Wu, Monty Sutrisna, Jack C. P. Cheng, Keith Hampson
2015 J jnl
J. Inf. Technol. Constr.
Jack C. P. Cheng, Qiqi Lu
2015 J jnl
Int. J. 3 D Inf. Model.
Yichuan Deng, Jack C. P. Cheng
2015 J jnl
Adv. Eng. Informatics
Vincent J. L. Gan, Jack C. P. Cheng
2015 J jnl
J. Inf. Technol. Constr.
Jack C. P. Cheng, Yichuan Deng, Chimay J. Anumba
2014 J jnl
J. Inf. Technol. Constr.
Jack C. P. Cheng, Moumita Das
2012 C conf
CDVE
Jack C. P. Cheng, Vignesh Venkataraman
2011 C conf
CDVE
Jack C. P. Cheng, Moumita Das
2011 C conf
CDVE
Jack C. P. Cheng, Lauren Y. H. Ma
2010 J jnl
Adv. Eng. Informatics
Jack C. P. Cheng, Kincho H. Law, Hans Bjornsson, Albert T. Jones, Ram D. Sriram
tests/unit/test_decompile_utils.py
← Index tests/unit/test_decompile_utils.py python
"""Unit tests for decompiler utility modules:
- bninja/utils/hashes.py
- bninja/utils/json_encoder.py
- bninja/analysis/low_level_normalization.py
"""
import hashlib
import json
import pytest


# ============================================================================
# 1a. hashes.py
# ============================================================================

from redb.extractors.decompiler.bninja.utils.hashes import (
    calculate_md5,
    calculate_sha256,
    calculate_tlsh,
)


class TestCalculateMD5:
    def test_calculate_md5_known_value(self):
        expected = hashlib.md5(b"test").hexdigest()
        assert calculate_md5("test") == expected

    def test_calculate_md5_empty(self):
        expected = hashlib.md5(b"").hexdigest()
        assert calculate_md5("") == expected


class TestCalculateSHA256:
    def test_calculate_sha256_known_value(self):
        expected = hashlib.sha256(b"hello world").hexdigest()
        assert calculate_sha256("hello world") == expected

    def test_calculate_sha256_empty_string(self):
        result = calculate_sha256("")
        assert len(result) == 64
        assert all(c in "0123456789abcdef" for c in result)


class TestCalculateTLSH:
    def test_calculate_tlsh_long_data(self):
        # TLSH requires >= 50 bytes
        data = "A" * 100
        result = calculate_tlsh(data)
        assert result is not None
        assert isinstance(result, str)

    def test_calculate_tlsh_short_data(self):
        data = "A" * 10
        result = calculate_tlsh(data)
        assert result is None

    def test_calculate_tlsh_deterministic(self):
        data = "x" * 200
        assert calculate_tlsh(data) == calculate_tlsh(data)



# ============================================================================
# 1b. json_encoder.py
# ============================================================================

from redb.extractors.decompiler.bninja.utils.json_encoder import BinaryNinjaEncoder


class TestBinaryNinjaEncoder:
    def test_encode_value_confidence_object(self):
        obj = type("VC", (), {"value": 42, "confidence": 255})()
        result = json.dumps(obj, cls=BinaryNinjaEncoder)
        assert json.loads(result) == 42

    def test_encode_str_fallback(self):
        obj = type("Obj", (), {"__str__": lambda self: "custom_repr"})()
        result = json.dumps(obj, cls=BinaryNinjaEncoder)
        assert json.loads(result) == "custom_repr"

    def test_encode_normal_types(self):
        data = {"a": 1, "b": [2, 3], "c": "hello"}
        result = json.dumps(data, cls=BinaryNinjaEncoder)
        assert json.loads(result) == data

    def test_encode_set_via_str(self):
        # Python sets have __str__, so BinaryNinjaEncoder converts them
        # to their string repr instead of raising TypeError.
        result = json.dumps(set([1, 2, 3]), cls=BinaryNinjaEncoder)
        parsed = json.loads(result)
        assert isinstance(parsed, str)
        assert "1" in parsed


# ============================================================================
# 1c. low_level_normalization.py
# ============================================================================

from redb.extractors.decompiler.bninja.analysis.low_level_normalization import (
    LowLevelNormalization,
)


class MockIL:
    """Mock IL node for normalization tests."""
    def __init__(self, operation, operands=None):
        self.operation = operation
        self.operands = operands or []


class TestLowLevelNormalization:
    def setup_method(self):
        self.normalizer = LowLevelNormalization()

    def test_normalize_single_instruction(self):
        node = MockIL(operation=5)
        result = self.normalizer.normalize_instruction_all_levels(node)
        assert result == [5]

    def test_normalize_nested_operands(self):
        child1 = MockIL(operation=10)
        child2 = MockIL(operation=20)
        root = MockIL(operation=1, operands=[child1, child2])
        result = self.normalizer.normalize_instruction_all_levels(root)
        assert result == [1, 10, 20]

    def test_normalize_empty_operands(self):
        node = MockIL(operation=42, operands=[])
        result = self.normalizer.normalize_instruction_all_levels(node)
        assert result == [42]

    def test_normalize_list_operands(self):
        # Simulates phi-node style list operands
        inner = MockIL(operation=99)
        node = MockIL(operation=7, operands=[[inner]])
        result = self.normalizer.normalize_instruction_all_levels(node)
        assert result == [7, 99]

    def test_normalize_none_input(self):
        result = self.normalizer.normalize_instruction_all_levels(None)
        assert result == []