Changed binary test data so the file contents repeat on 8 character boundaries making differences easier to spot in Omnivore's char view

* added ranges for file specification
This commit is contained in:
Rob McMullen 2016-02-11 22:29:51 -08:00
parent c36aebd593
commit 690cc0aaca
2 changed files with 22 additions and 10 deletions

View File

@ -9,14 +9,14 @@ import subprocess
import tempfile
def create_binary(filename, num, outfile, options):
"""Create patterned binary data with the filename interleaved with a byte
ramp, e.g. A128\x00A128\x01A128\x02 etc.
"""Create patterned binary data with the first 7 characters of the filename
interleaved with a byte ramp, e.g. A128 \x00A128 \x01A128 \x02 etc.
"""
root, _ = outfile.split(".")
a = np.fromstring(root + " ", dtype=np.uint8)
prefix = ("%s " % root)[0:8]
a = np.fromstring(prefix, dtype=np.uint8)
b = np.tile(a, (num / np.alen(a)) + 1)[0:num]
e = np.where(b == 32)[0]
b[e] = np.arange(np.alen(e), dtype=np.uint8)
b[7::8] = np.arange(np.alen(b) / 8, dtype=np.uint8)
with open(filename, "wb") as fh:
fh.write(b.tostring())
@ -78,12 +78,23 @@ if __name__ == "__main__":
repeat, num = entry.split("*", 1)
num = int(num)
repeat = int(repeat)
entries = [num] * repeat
elif "-" in entry:
first, last = entry.split("-", 1)
first = int(first)
if "," in last:
last, step = last.split(",", 1)
step = int(step)
else:
step = 1
last = int(last)
entries = range(first, last + 1, step)
else:
num = int(entry)
repeat = 1
for i in range(repeat):
outfile = get_filename(num, used)
create_binary(binfile, num, outfile, options)
entries = [num]
for i in entries:
outfile = get_filename(i, used)
create_binary(binfile, i, outfile, options)
franny(out, "-A", "-i", binfile, "-o", outfile)
files.append(outfile)
os.unlink(binfile)

View File

@ -6,7 +6,8 @@ function create() {
./create_binary.py $ARGS -o ${ROOT}test1.atr 128 256 512 1024 4096
./create_binary.py $ARGS -o ${ROOT}test2.atr 50*256 2*512 256 1024 256 d1 d2 d3 4096
./create_binary.py $ARGS -o ${ROOT}test3.atr 10*256 d1 d7 4096 d3 d5 d9 8000
./create_binary.py $ARGS -o ${ROOT}test4.atr 10*4096 d1 d3 d5 d7 d9
./create_binary.py $ARGS -o ${ROOT}test4.atr 10*4096 d1 d3 d5 d7 d9 15000
./create_binary.py $ARGS -o ${ROOT}test5.atr 100-500,7
}
create "dos_sd_" "-f a -t s"