mirror of
https://github.com/PartialVolume/shredos.x86_64.git
synced 2026-02-26 20:42:11 +00:00
Upgrade buildroot to 2023.05 (from 2021.08.2), kernel is upgraded to 6.3 (from 5.13.19).
This commit is contained in:
16
support/testing/tests/package/sample_python_construct.py
Normal file
16
support/testing/tests/package/sample_python_construct.py
Normal file
@@ -0,0 +1,16 @@
|
||||
# Inspired from https://construct.readthedocs.io/en/latest/intro.html#example
|
||||
import construct
|
||||
|
||||
format = construct.Struct(
|
||||
"signature" / construct.Const(b"BMP"),
|
||||
"width" / construct.Int8ub,
|
||||
"height" / construct.Int8ub,
|
||||
"pixels" / construct.Array(construct.this.width * construct.this.height, construct.Byte),
|
||||
)
|
||||
a = format.build(dict(width=3,height=2,pixels=[7,8,9,11,12,13]))
|
||||
assert(a == b'BMP\x03\x02\x07\x08\t\x0b\x0c\r')
|
||||
b = format.parse(b'BMP\x03\x02\x07\x08\t\x0b\x0c\r')
|
||||
assert(b.signature == b'BMP')
|
||||
assert(b.width == 3)
|
||||
assert(b.height == 2)
|
||||
assert(b.pixels == [7, 8, 9, 11, 12, 13])
|
||||
Reference in New Issue
Block a user