一句话:提出 QUTest,用标准 .qasm 文件原生编写量子程序测试,支持断言、lint 与多运行时兼容检查。
量子程序常以 OpenQASM 3 电路形式共享,但测试通常用 Python 与 Qiskit 等宿主语言编写,割裂了程序与测试。QUTest 是原生测试框架,程序与测试都是标准 .qasm 文件,测试采用 Arrange/Act/Assert 模式,配置、运行时需求与断言以 pragma 注释 //% 编码,保持与现有 OpenQASM 工具兼容。它提供 12 种断言,覆盖确定性、统计、量子态与结构检查,并含 linter 和可跨选定运行时版本在隔离环境中运行的环境感知模式。其 CLI 支持自动测试发现、运行时兼容性检查以及用于持续集成的 XML 报告。论文描述 pragma 语言与实现,并计划通过覆盖率和变异测试进行评估。
Quantum programs are often shared as OpenQASM 3 circuits, but tests are still written in host languages such as Python with Qiskit. We present QUTest, a native framework in which both programs and tests are standard .qasm files. Tests follow the Arrange / Act / Assert pattern, while configuration, runtime requirements, and assertions are encoded as pragma comments (//%), preserving compatibility with existing OpenQASM tools. QUTest provides 12 assertion types spanning deterministic, statistical, quantum-state, and structural checks, plus a linter and an environment-aware mode for running the same test across selected runtime versions in isolated environments. Its CLI supports automatic test discovery, runtime compatibility checks, and XML reports for continuous integration. We describe the pragma language, implementation, and a planned evaluation using coverage and mutation testing.