def test_greater(): assert yx_cmp(GridQubit(1, 1), GridQubit(0, 0)) > 0 assert yx_cmp(GridQubit(1, 1), GridQubit(0, 1)) > 0 assert yx_cmp(GridQubit(0, 1), GridQubit(1, 0)) > 0
def lower_left(): cand = None for n in device.qubits: if cand is None or yx_cmp(n, cand) < 0: cand = n return cand
def test_lower(): assert yx_cmp(GridQubit(0, 0), GridQubit(1, 1)) < 0 assert yx_cmp(GridQubit(0, 1), GridQubit(1, 1)) < 0 assert yx_cmp(GridQubit(1, 0), GridQubit(0, 1)) < 0
def test_equal(): assert yx_cmp(GridQubit(0, 0), GridQubit(0, 0)) == 0 assert yx_cmp(GridQubit(1, 1), GridQubit(1, 1)) == 0
def test_greater(): assert yx_cmp(XmonQubit(1, 1), XmonQubit(0, 0)) > 0 assert yx_cmp(XmonQubit(1, 1), XmonQubit(0, 1)) > 0 assert yx_cmp(XmonQubit(0, 1), XmonQubit(1, 0)) > 0
def test_equal(): assert yx_cmp(XmonQubit(0, 0), XmonQubit(0, 0)) == 0 assert yx_cmp(XmonQubit(1, 1), XmonQubit(1, 1)) == 0
def test_lower(): assert yx_cmp(XmonQubit(0, 0), XmonQubit(1, 1)) < 0 assert yx_cmp(XmonQubit(0, 1), XmonQubit(1, 1)) < 0 assert yx_cmp(XmonQubit(1, 0), XmonQubit(0, 1)) < 0