Skip to main content

Property based testing package for Qiskit programs

Project description

QuCheck

Property-based testing for Qiskit programs.

Installation

QuCheck requires Python 3.11 or newer.

Install from PyPI

For most users, this is the simplest option:

conda create -n qucheck_env python=3.11
conda activate qucheck_env
pip install qucheck

Install from the repository

If you want to run the bundled examples, work on the source, or edit the package locally:

conda create -n qucheck_env python=3.11
conda activate qucheck_env
cd path/to/qucheck
pip install .

Quickstart

If you want to run the bundled example properties from this repository, start with docs/quickstart.md.

The quickstart uses:

  • examples/quickstart/properties/single_qubit_probability_property.py
  • examples/quickstart/properties/single_qubit_wrong_probability_property.py
  • examples/quickstart/run.py

RQ1:

To run the experiment in RQ1, execute: case_studies/multithreaded_test_runner.py

This will use all cores available on your machine to execute all case studies under all combinations of numbers or properties, inputs, and shots (can be modified in the test_and_store_parallel function). You can modify the number of threads used by changing the MAX_WORKERS variable in the script.

The results will be stored in the case_studies/mutation_test_results directory as CSV files.

(3 property, 100 input, 2500 and 4200 shots experiments will also be performed, which we use as a basis for comparison in RQ2)

RQ2:

To run the comparison with the MITRE unit tests, navigate to the case_studies/MITRE_unit_test_baseline directory and execute:

  • deutsch_jozsa.py
  • grover_tests.py
  • qft_tests.py
  • teleportation.py

The results will be stored in the case_studies/mutation_test_results directory as CSV files.

RQ3:

To perform the comparison with QSharpCheck, you will need to utilise the QSharpCheck framework. You can find the mutants and test files used for the comparison in the case_studies/superdense_coding/mutants/translated_circuits and case_studies/quantum_teleportation/mutants/translated_circuits directories.

You will also need to individually execute the relevant property in QuCheck for Quantum Teleportation and Superdense Coding.

This can be done by setting the number of properties to 1 in the test_and_store_parallel function in case_studies/multithreaded_test_runner.py, and commenting out all but input_reg0_equal_to_output_reg2_property.py


Credits and Third-Party Code

This repository is licensed under the MIT License (c) 2024 Gabriel Pontolillo and Marek Grzesiuk.

Portions of this project include code developed by The MITRE Corporation (2019) from the qsfe/Qiskit repository, licensed under the Apache License, Version 2.0. See the header of each adapted file and http://www.apache.org/licenses/LICENSE-2.0 for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qucheck-0.0.2.tar.gz (22.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qucheck-0.0.2-py3-none-any.whl (28.7 kB view details)

Uploaded Python 3

File details

Details for the file qucheck-0.0.2.tar.gz.

File metadata

  • Download URL: qucheck-0.0.2.tar.gz
  • Upload date:
  • Size: 22.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for qucheck-0.0.2.tar.gz
Algorithm Hash digest
SHA256 8933e450d5d51960289781cc0aa62985cace233906b8dcbb29de75fa6087cf29
MD5 fe4f03f4ae09af5392a6ce1e616ea274
BLAKE2b-256 61b7abbaeff524645e943baba471f1b2f0ef9a38fc45baba20ac4b1c2efc882c

See more details on using hashes here.

File details

Details for the file qucheck-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: qucheck-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 28.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for qucheck-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bae560f1945c843bf86f90243a051351f84d2101b34181d0adb6c9121c20cac5
MD5 2eab6a2d08ce4a04ac8c00491ebada6c
BLAKE2b-256 4a4a27a13aaa4f5156af514d599d85d7a1618010e542bd545876ff99ed32df1f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page