Files
Sprinter-SDCC/tests/seek/gen_bigfile.py
T
snark13 737c974400 Add mdview markdown viewer, reorganize tests/examples and libc layout
- Split tests/ (libc feature tests) and examples/ (real apps); shared
  app.mk in repo root, was examples/example.mk
- libc/io/* split into libc/{conio,env,errno,file,mouse,string,sys,
  time,video}/ — clearer module boundaries
- New examples/mdview/: markdown viewer (Phases 1-5 + light nested
  lists). Headers (H1-H4), HR, ulist/olist/quote with nesting via
  leading spaces, fenced code blocks, inline emphasis (bold/italic/
  underscore/code), wrap/unwrap mode with soft wrap (F2), horizontal
  pan (← →) with '>' truncation indicator
- libc additions: scroll() in conio (ESTEX SCROLL), strlwr/strupr,
  gets() test
- Makefile updates across tests/ for the new shared app.mk path

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-04 22:23:36 +03:00

36 lines
1.2 KiB
Python

#!/usr/bin/env python3
"""
Generate a >64 KB test file with predictable position-encoded content.
Every 256-byte block starts with a 32-character ASCII line
"[off=NNNNNNN] block #BBBB filler...\n"
where NNNNNNN is the absolute byte offset of the block start (padded to 7
decimal digits) and BBBB is the 4-digit block index. The line is padded
to 256 bytes with '.' so that seeking to any 256-aligned offset gives an
immediately-readable label.
"""
import sys
import os
def main():
path = sys.argv[1] if len(sys.argv) > 1 else "big.txt"
target_size = int(sys.argv[2]) if len(sys.argv) > 2 else 100 * 1024
block_size = 256
nblocks = (target_size + block_size - 1) // block_size
with open(path, "wb") as f:
for b in range(nblocks):
offset = b * block_size
header = f"[off={offset:07d}] block #{b:04d} "
body = header + ("." * (block_size - len(header) - 1)) + "\n"
assert len(body) == block_size, len(body)
f.write(body.encode("ascii"))
actual = os.path.getsize(path)
print(f"wrote {path}: {actual} bytes ({nblocks} blocks of {block_size} each)")
if __name__ == "__main__":
main()