def test_parse_invalid_cmd_copy_cmd_tag(): """CmdCopy tag validity test.""" cmd = CmdCopy(address=100, length=0, destination_address=0, memory_id_from=0, memory_id_to=0) cmd.cmd_tag = EnumCmdTag.CALL data = cmd.export() with pytest.raises(SPSDKError): CmdLoadCmac.parse(data=data)
def test_cmd_copy(): """Test address, length, destination_address, memory_id_from, memory_id_to, info value, size after export and parsing of CmdCopy command.""" cmd = CmdCopy(address=100, length=0, destination_address=0, memory_id_from=0, memory_id_to=0) assert cmd.address == 100 assert cmd.length == 0 assert cmd.destination_address == 0 assert cmd.memory_id_from == 0 assert cmd.memory_id_to == 0 assert cmd.info() data = cmd.export() assert len(data) % 16 == 0 cmd_parsed = CmdCopy.parse(data=data) assert cmd.address == cmd_parsed.address assert cmd.length == cmd_parsed.length assert cmd.destination_address == cmd_parsed.destination_address assert cmd.memory_id_from == cmd_parsed.memory_id_from assert cmd.memory_id_to == cmd_parsed.memory_id_to assert 0x00000000 <= cmd.address <= 0xFFFFFFFF assert 0x00000000 <= cmd.length <= 0xFFFFFFFF
def test_cmd_copy(): """Test address, length, destination_address, memory_id_from, memory_id_to, info value, size after export and parsing of CmdCopy command.""" cmd = CmdCopy(address=100, length=10, destination_address=20, memory_id_from=30, memory_id_to=40) assert cmd.address == 100 assert cmd.length == 10 assert cmd.destination_address == 20 assert cmd.memory_id_from == 30 assert cmd.memory_id_to == 40 assert cmd.info() data = cmd.export() assert len(data) % 16 == 0 cmd_parsed = CmdCopy.parse(data=data) assert cmd == cmd_parsed