-- Copyright (c) 2026 Huawei Technologies Co., Ltd.
-- openUBMC is licensed under Mulan PSL v2.
-- You can use this software according to the terms and conditions of the Mulan PSL v2.
-- You may obtain a copy of Mulan PSL v2 at:
--          http://license.coscl.org.cn/MulanPSL2
-- THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
-- EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
-- MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
-- See the Mulan PSL v2 for more details.

local hwproxy_app = require('hwproxy_app')
local log = require('mc.logging')

TestHwproxyapp = {}

local old_log_raise = log.raise
function TestHwproxyapp:setUp()
    log.raise = function() end
end

function TestHwproxyapp:tearDown()
    log.raise = old_log_raise
end

function TestHwproxyapp:test_trace_chip()
    local input = {
        addr = 0,
        addrWidth = 1,
        offsetWidth = 1,
        offset = 0,
        len = 1,
        mask = 0xf,
        type = 1,
        buffer = 0x00,
        protocol_flag = nil,
        name = 'chip_1',
        smc_target = nil,
        append_write = nil,
        is_trace = true,
        requestor = 'bmc.kepler.hwproxy',
        funcname = nil,
        has_error = false,
    }
    local ret = '00'
    input.funcname = 'read'
    hwproxy_app:trace_chip(input, ret)
    input.funcname = 'write'
    hwproxy_app:trace_chip(input, nil)
end