Skip to content

Commit

Permalink
Add testcases
Browse files Browse the repository at this point in the history
  • Loading branch information
glorialeezero committed Nov 22, 2024
1 parent eba62c7 commit 4bb4007
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/test_worklist.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from qupsy.language import GateCmd, H, HoleAexp, HoleCmd, HoleGate, Pgm, SeqCmd, X
from qupsy.worklist import Worklist


def test_worklist():
worklist = Worklist()
assert not worklist.notEmpty()


def test_add_same_pgm():
worklist = Worklist()
pgm = Pgm(HoleCmd())
worklist.put(pgm, pgm)
assert worklist.num_pgm_left() == 1


def test_get_pgm():
worklist = Worklist()
pgm1 = Pgm(HoleCmd())
pgm2 = Pgm(GateCmd(HoleGate()))
worklist.put(pgm1, pgm2)
assert worklist.get() == pgm2


def test_add_same_cost():
worklist = Worklist()
pgm1 = Pgm(SeqCmd(GateCmd(H(HoleAexp())), GateCmd(H(HoleAexp()))))
pgm2 = Pgm(SeqCmd(GateCmd(X(HoleAexp())), GateCmd(X(HoleAexp()))))
worklist.put(pgm1, pgm2)
assert worklist.get() == pgm1

0 comments on commit 4bb4007

Please sign in to comment.