"""Compile the actual command encoder and check its wire bytes and bounds.""" from pathlib import Path import shutil import subprocess import tempfile import unittest class BamCommandFormatTest(unittest.TestCase): def test_command_encoding(self): compiler = shutil.which("cc") if not compiler: self.skipTest("native C compiler not available") source = Path(__file__).with_name("ipa_v2_cmd_format.c") with tempfile.TemporaryDirectory() as directory: executable = Path(directory) / "ipa-v2-format-test" subprocess.run([compiler, "-std=c11", "-Wall", "-Wextra", "-Werror", str(source), "-o", str(executable)], check=True) subprocess.run([str(executable)], check=True)