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
def test_load_cmd_invalid_parse(): cmd = CmdNop() data = cmd.export() with pytest.raises(SPSDKError, match="Incorrect header tag"): CmdLoad.parse(data)
def test_cmd_header_comparision(): cmd_header = CmdHeader(tag=1) cmd = CmdNop() assert cmd_header != cmd
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)
def test_invalid_crc(): cmd = CmdNop() with pytest.raises(SPSDKError): cmd.parse(bytes(20))
def test_version_check_invalid_parse(): cmd = CmdNop() data = cmd.export() with pytest.raises(SPSDKError, match="Invalid header tag"): CmdVersionCheck.parse(data)
def test_prog_cmd_invalid_parse(): cmd = CmdNop() data = cmd.export() with pytest.raises(SPSDKError, match="Invalid header tag"): CmdProg.parse(data)
def test_mem_enable_cmd_invalid_parse(): cmd = CmdNop() data = cmd.export() with pytest.raises(SPSDKError, match="Invalid header tag"): CmdMemEnable.parse(data)
def test_erase_invalid(): cmd = CmdNop() data = cmd.export() with pytest.raises(SPSDKError, match="Invalid header tag"): CmdErase.parse(data)
def test_fill_cmd_incorrect_parse(): cmd = CmdNop() data = cmd.export() with pytest.raises(SPSDKError, match="Incorrect header tag"): CmdFill.parse(data)