1. Simula Research Laboratory, Norway
2. National Institute of Informatics, Japan
3. Nanjing University of Aeronautics and Astronautics, China
Quantum programs implement quantum algorithms solving complex computational problems. Testing such programs is challenging due to the inherent characteristics of Quantum Computing (QC), such as the probabilistic nature and computations in superposition. However, automated and systematic testing is needed to ensure the correct behavior of quantum programs. To this end, we present three coverage criteria defined on the inputs and outputs of a quantum program, together with their test generation strategies. To determine the passing and failing of a test suite, we define two types of test oracles. We also provide a procedure to determine the passing and failing of test suites with statistical analyses. To evaluate the cost-effectiveness of the three coverage criteria, we conducted experiments with five quantum programs. We used mutation analysis to determine the coverage criteria’ effectiveness and cost in terms of number of test cases. Based on the results of mutation analysis, we identified equivalent mutants for quantum programs.
Please note that the code used for experimentation is from the book Programming Quantum Computers by Eric Johnston, Nic Harrigan and Mercedes Gimeno-Segovia.
// Programming Quantum Computers
// by Eric Johnston, Nic Harrigan and Mercedes Gimeno-Segovia
// O’Reilly Media