MCPcopy Create free account
hub / github.com/QuipNetwork/xquad / test_bytecode_decode_length_mismatch

Function test_bytecode_decode_length_mismatch

xqvm_py/tests/test_program.py:101–113  ·  view source on GitHub ↗

Payload shorter than code_len raises ValueError.

()

Source from the content-addressed store, hash-verified

99
100
101def test_bytecode_decode_length_mismatch():
102 """Payload shorter than code_len raises ValueError."""
103 import struct
104 import zlib
105
106 import pytest
107
108 code = b"\xff"
109 crc = zlib.crc32(code) & 0xFFFF_FFFF
110 # Claim code_len=5 but provide only 1 byte.
111 bad_len = b"XQBC" + bytes([1, 0, 0]) + struct.pack(">II", 5, crc) + code
112 with pytest.raises(ValueError, match="length mismatch"):
113 program_from_bytecode(bad_len)
114
115
116def test_bytecode_decode_crc_mismatch():

Callers

nothing calls this directly

Calls 2

program_from_bytecodeFunction · 0.90
bytesFunction · 0.85

Tested by

no test coverage detected