Abstract
Oracle quantum programs are a fundamental class of quantum programs that enable developers to embed classical logic into quantum computing. Many important quantum algorithms are built upon oracle quantum programs, making it essential to ensure their correctness during development. Although software testing is a well-established approach for improving program reliability, no systematic method has been developed to test oracle quantum programs. This paper aims to build an equivalence-class-partition-based testing framework to complete the testing tasks for general oracle quantum programs. Our research methods involve both theoretical analysis and experimental evaluations. In the theoretical analysis, we first give the formal definition of general oracle quantum programs. Then we establish the foundational theory for the testing approaches. We propose an equivalence-class-partition-based testing framework, involving 4 testing criteria and 3 propositions about the selection of parameters in testing execution. In experimental evaluations, we select 10 original oracle quantum programs and their 132 mutants to evaluate the correctness of our theory and the effectiveness of our testing framework. Our results demonstrate that the proposed framework significantly aids developers in testing oracle quantum programs, providing insights to enhance the reliability of quantum software.