示例#1
0
def test_nop_cmd():
    cmd = CmdNop()
    assert cmd.info()

    data = cmd.export()
    assert len(data) == 16
    assert len(data) == cmd.raw_size

    cmd_parsed = parse_command(data)
    assert cmd == cmd_parsed
示例#2
0
def test_load_cmd_invalid_parse():
    cmd = CmdNop()
    data = cmd.export()
    with pytest.raises(SPSDKError, match="Incorrect header tag"):
        CmdLoad.parse(data)
示例#3
0
def test_cmd_header_comparision():
    cmd_header = CmdHeader(tag=1)
    cmd = CmdNop()
    assert cmd_header != cmd
示例#4
0
def test_nop_cmd_invalid_parse():
    cmd = CmdLoad(address=100, data=b"\x00" * 100)
    data = cmd.export()
    with pytest.raises(SPSDKError, match="Incorrect header tag"):
        CmdNop.parse(data)
示例#5
0
def test_invalid_crc():
    cmd = CmdNop()
    with pytest.raises(SPSDKError):
        cmd.parse(bytes(20))
示例#6
0
def test_version_check_invalid_parse():
    cmd = CmdNop()
    data = cmd.export()
    with pytest.raises(SPSDKError, match="Invalid header tag"):
        CmdVersionCheck.parse(data)
示例#7
0
def test_prog_cmd_invalid_parse():
    cmd = CmdNop()
    data = cmd.export()
    with pytest.raises(SPSDKError, match="Invalid header tag"):
        CmdProg.parse(data)
示例#8
0
def test_mem_enable_cmd_invalid_parse():
    cmd = CmdNop()
    data = cmd.export()
    with pytest.raises(SPSDKError, match="Invalid header tag"):
        CmdMemEnable.parse(data)
示例#9
0
def test_erase_invalid():
    cmd = CmdNop()
    data = cmd.export()
    with pytest.raises(SPSDKError, match="Invalid header tag"):
        CmdErase.parse(data)
示例#10
0
def test_fill_cmd_incorrect_parse():
    cmd = CmdNop()
    data = cmd.export()
    with pytest.raises(SPSDKError, match="Incorrect header tag"):
        CmdFill.parse(data)