mirror of
https://github.com/romanz/amodem.git
synced 2026-02-06 16:48:06 +08:00
16 lines
319 B
Python
16 lines
319 B
Python
from amodem import ecc
|
|
import random
|
|
import itertools
|
|
|
|
|
|
def concat(chunks):
|
|
return bytearray(itertools.chain.from_iterable(chunks))
|
|
|
|
|
|
def test_random():
|
|
r = random.Random(0)
|
|
x = bytearray(r.randrange(0, 256) for i in range(64 * 1024))
|
|
y = ecc.encode(x)
|
|
x_ = concat(ecc.decode(y))
|
|
assert x_ == x
|