mirror of
https://github.com/romanz/amodem.git
synced 2026-03-23 19:01:00 +08:00
reorganize directory structure
This commit is contained in:
15
amodem/test/test_ecc.py
Normal file
15
amodem/test/test_ecc.py
Normal file
@@ -0,0 +1,15 @@
|
||||
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
|
||||
2
loop.sh
2
loop.sh
@@ -1,2 +0,0 @@
|
||||
#!/bin/bash
|
||||
(while [ true ]; do cat $1; done ) | aplay -q -f S16_LE -c 1 -r 32000
|
||||
22
test_ecc.py
22
test_ecc.py
@@ -1,22 +0,0 @@
|
||||
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(16 * 1024))
|
||||
y = ecc.encode(x)
|
||||
x_ = concat(ecc.decode(y))
|
||||
assert x_[:len(x)] == x
|
||||
assert all(v == 0 for v in x_[len(x):])
|
||||
|
||||
|
||||
def test_file():
|
||||
data = open('data.send').read()
|
||||
enc = ecc.encode(data)
|
||||
assert concat(ecc.decode(enc)) == data
|
||||
Reference in New Issue
Block a user