QUTest: 一种用于量子程序的原生测试框架
QUTest: A Native Testing Framework for Quantum Programs
AI总结:
本文提出QUTest,一种原生测试框架,允许用标准.qasm文件编写程序和测试,支持Arrange / Act / Assert模式,并提供12种断言类型、代码检查工具和跨不同运行时版本的测试环境。
AI中文摘要:
量子程序通常以OpenQASM 3电路形式共享,但测试仍使用主机语言如Python和Qiskit编写。我们提出了QUTest,一种原生框架,其中程序和测试均为标准.qasm文件。测试遵循Arrange / Act / Assert模式,而配置、运行时要求和断言编码为pragma注释(//%),保持与现有OpenQASM工具的兼容性。QUTest提供12种断言类型,涵盖确定性、统计性、量子态和结构性检查,还提供代码检查工具和环境感知模式,用于在隔离环境中跨选定运行时版本运行相同测试。其CLI支持自动测试发现、运行时兼容性检查和持续集成的XML报告。我们描述了pragma语言、实现以及计划使用覆盖率和变异测试进行评估。QUTest可在https://github.com/QBugs/qutest上获得。视频演示:https://youtu.be/FvgvsiAXuW0。
英文摘要:
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. QUTest is available at https://github.com/QBugs/qutest. Video demo: https://youtu.be/FvgvsiAXuW0.