Esempio n. 1
0
def test_checkdata_invalid():
    cmd = CmdCheckData()
    with pytest.raises(SPSDKError):
        cmd.num_bytes = 6
    with pytest.raises(SPSDKError):
        cmd.ops = 99
    with pytest.raises(SPSDKError):
        cmd = CmdCheckData(numbytes=8)
    with pytest.raises(SPSDKError):
        cmd = CmdCheckData(ops=80)
Esempio n. 2
0
def test_checkdata_cmd_basic():
    cmd = CmdCheckData(ops=EnumCheckOps.ANY_CLEAR,
                       address=0,
                       mask=0x00000001,
                       count=5)
    assert cmd.num_bytes == 4
    assert cmd.ops == EnumCheckOps.ANY_CLEAR
    assert cmd.address == 0
    assert cmd.mask == 0x00000001
    assert cmd.count == 5

    assert cmd._header.param == 20
    cmd.num_bytes = 1
    assert cmd._header.param == 17

    cmd.ops = EnumCheckOps.ALL_CLEAR
    assert cmd._header.param == 1

    assert "CmdCheckData " in repr(cmd)