Safe Haskell | None |
---|

This module provides some automated tests for the algebraic optimization procedure. The main function are:

`testArith5`

: runs the optimization on a reversible adder generated with Template Haskell and exhaustively tests all the values.`testCircSimpl`

and`testCircSwap`

: using the Test.QuickCheck library, perform optimization on randomly generated circuits and test validity for some random input.

- myAdder :: ([Qubit], [Qubit]) -> Circ [Qubit]
- myArith :: ([Qubit], [Qubit]) -> Circ [Qubit]
- myCircArith :: Int -> (CircState, [Wire])
- bCircArith :: Int -> BCircuit
- wire_of_endpoint :: B_Endpoint t t -> t
- runArithDry :: Int -> Int -> Int -> Int
- runArith :: Int -> Int -> Int -> Int
- testArith5 :: Bool
- choose :: [b] -> Int -> [[b]]
- genCirc :: Int -> Int -> Gen ([Gate], [Wire])
- printSampleCirc :: Int -> Int -> IO ()
- restrict :: Ord k => [k] -> Map k a -> Map k a
- testCircSimpl :: Property
- testCircSwap :: Property
- myQuickTest :: Property -> IO ()

# Testing an adder

wire_of_endpoint :: B_Endpoint t t -> t Source #

Extract the underlying `Wire`

from an `Endpoint`

.

testArith5 :: Bool Source #

Exhaustively test all the inputs of the optimized adder.

# Randomized tests

The following functions use the Test.QuickCheck library. They generate random circuits, and run them classically before and after optimization.

genCirc :: Int -> Int -> Gen ([Gate], [Wire]) Source #

Generate a random circuit with the given number of inputs and ancillas.

testCircSimpl :: Property Source #

Test of `simplRec`

.

testCircSwap :: Property Source #

Test of `alg_swap`

.

myQuickTest :: Property -> IO () Source #

A wrapper function to easily run a test.
Within the interpreter `quipperi`

, use, e.g., as

myQuickTest testCircSimpl