-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathexamples_test.py
95 lines (60 loc) · 2.32 KB
/
examples_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import cirq
import examples.basic_arithmetic
import examples.bell_inequality
import examples.bernstein_vazirani
import examples.bcs_mean_field
import examples.cross_entropy_benchmarking_example
import examples.deutsch
import examples.grover
import examples.hello_qubit
import examples.hhl
import examples.phase_estimator
import examples.place_on_bristlecone
import examples.qaoa
import examples.quantum_fourier_transform
import examples.quantum_teleportation
import examples.qubit_characterizations_example
import examples.superdense_coding
import examples.swap_networks
def test_example_runs_bernstein_vazirani():
examples.bernstein_vazirani.main(qubit_count=3)
# Check empty oracle case. Cover both biases.
a = cirq.NamedQubit('a')
assert list(examples.bernstein_vazirani.make_oracle(
[], a, [], False)) == []
assert list(examples.bernstein_vazirani.make_oracle(
[], a, [], True)) == [cirq.X(a)]
def test_example_runs_deutsch():
examples.deutsch.main()
def test_example_runs_hello_line():
examples.place_on_bristlecone.main()
def test_example_runs_hello_qubit():
examples.hello_qubit.main()
def test_example_runs_bell_inequality():
examples.bell_inequality.main()
def test_example_runs_quantum_fourier_transform():
examples.quantum_fourier_transform.main()
def test_example_runs_bcs_mean_field():
examples.bcs_mean_field.main()
def test_example_runs_grover():
examples.grover.main()
def test_example_runs_basic_arithmetic():
examples.basic_arithmetic.main(n=2)
def test_example_runs_phase_estimator():
examples.phase_estimator.main(qnums=(2,), repetitions=2)
def test_example_runs_qaoa():
examples.qaoa.main()
def test_example_runs_quantum_teleportation():
examples.quantum_teleportation.main()
def test_example_runs_superdense_coding():
examples.superdense_coding.main()
def test_example_runs_hhl():
examples.hhl.main()
def test_example_runs_qubit_characterizations():
examples.qubit_characterizations_example.main()
def test_example_swap_networks():
examples.swap_networks.main()
def test_example_cross_entropy_benchmarking():
examples.cross_entropy_benchmarking_example.main(repetitions=10,
num_circuits=2,
cycles=[2, 3, 4])