feat(k1): complete canonical control lifecycle
This commit is contained in:
@@ -17,6 +17,7 @@ from k1link.device_plugins.xgrids_k1.protocol.modeling import (
|
||||
from k1link.device_plugins.xgrids_k1.protocol.protobuf_wire import (
|
||||
ProtobufWireError,
|
||||
decode_zigzag64,
|
||||
encode_zigzag64,
|
||||
iter_fields,
|
||||
)
|
||||
from k1link.device_plugins.xgrids_k1.protocol.streams import (
|
||||
@@ -94,6 +95,13 @@ def test_protobuf_wire_zigzag_and_bounds() -> None:
|
||||
assert decode_zigzag64(0) == 0
|
||||
assert decode_zigzag64(1) == -1
|
||||
assert decode_zigzag64(2) == 1
|
||||
assert encode_zigzag64(0) == 0
|
||||
assert encode_zigzag64(-1) == 1
|
||||
assert encode_zigzag64(1) == 2
|
||||
assert decode_zigzag64(encode_zigzag64(-(1 << 63))) == -(1 << 63)
|
||||
assert decode_zigzag64(encode_zigzag64((1 << 63) - 1)) == (1 << 63) - 1
|
||||
with pytest.raises(ProtobufWireError, match="outside int64"):
|
||||
encode_zigzag64(1 << 63)
|
||||
with pytest.raises(ProtobufWireError, match="truncated"):
|
||||
list(iter_fields(b"\x0a\x02\x01"))
|
||||
with pytest.raises(ProtobufWireError, match="unsupported"):
|
||||
|
||||
Reference in New Issue
Block a user