Skip to content

Commit

Permalink
fix testing
Browse files Browse the repository at this point in the history
  • Loading branch information
dakk committed Nov 27, 2023
1 parent d3a813e commit 77f1909
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
9 changes: 7 additions & 2 deletions test/test_algo_deutschjozsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

from qlasskit import Qint2, Qint4, qlassf
from qlasskit.algorithms import DeutschJozsa
from qlasskit.compiler import SupportedCompilers

from .utils import qiskit_measure_and_count

Expand All @@ -26,7 +27,7 @@ def test_deutschjozsa_balanced(self):
def hash(k: Qint2) -> bool:
return k[0] ^ k[1]
"""
qf = qlassf(f, compiler="tweedledum")
qf = qlassf(f)
algo = DeutschJozsa(qf)

qc_algo = algo.circuit().export("circuit", "qiskit")
Expand All @@ -35,6 +36,10 @@ def hash(k: Qint2) -> bool:
self.assertEqual(counts_readable["Balanced"], 1024)

def test_deutschjozsa_balanced2(self):
# TODO: fix this in internalcompiler
if "tweedledum" not in SupportedCompilers:
return

f = """
def hash(k: bool) -> bool:
return k
Expand All @@ -52,7 +57,7 @@ def test_deutschjozsa_constant(self):
def hash(k: Qint2) -> bool:
return False
"""
qf = qlassf(f, compiler="tweedledum")
qf = qlassf(f)
algo = DeutschJozsa(qf)

qc_algo = algo.circuit().export("circuit", "qiskit")
Expand Down
10 changes: 5 additions & 5 deletions test/test_algo_simon.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@
import unittest

from qlasskit import Qint2, Qint4, qlassf
from qlasskit.compiler import SupportedCompilers
from qlasskit.algorithms import Simon
from qlasskit.compiler import SupportedCompilers

from .utils import qiskit_measure_and_count


class TestAlgoSimon(unittest.TestCase):
def test_simon(self):
if 'tweedledum' not in SupportedCompilers:
return

# TODO: fix this in internalcompiler
if "tweedledum" not in SupportedCompilers:
return

f = """
def hash(k: Qint4) -> Qint4:
return k >> 3
"""
# TODO: fix this in internalcompiler
qf = qlassf(f, compiler="tweedledum")
algo = Simon(qf)

Expand Down

0 comments on commit 77f1909

Please sign in to comment.