Files
vt1200/bad-apple/tests/test_c_decoder.py
T

24 lines
753 B
Python

import subprocess
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
def test_c_decoder_matches_python(tmp_path):
subprocess.run([sys.executable, str(ROOT / "tests" / "make_fixture.py")],
check=True)
exe = tmp_path / "decode"
subprocess.run([
"gcc", "-std=c99", "-Wall", "-Werror",
str(ROOT / "player" / "movie.c"),
str(ROOT / "player" / "tests" / "test_movie_decode.c"),
"-o", str(exe),
], check=True)
out = subprocess.run(
[str(exe), str(ROOT / "player" / "tests" / "fixture.bin")],
check=True, capture_output=True, text=True).stdout
assert "frames=2" in out
assert "0 0 0 0 0 32 32" in out
assert "1 1 1 1 1 2 3" in out