Skip to content

Commit 8921dcc

Browse files
committed
Add test to check identity matrix works with arguments switched
1 parent 929cfd3 commit 8921dcc

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/utilities/matrices/test_identity.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,25 @@ def test_apply_2x2_identity_happy(matrix: list[list[float]]):
4444
assert result == matrix
4545

4646

47+
@pytest.mark.parametrize("matrix", [
48+
[[1., 0.],
49+
[0., 1.]],
50+
[[2., 1.],
51+
[3., 4.]],
52+
[[2., 3., 5.],
53+
[1., 4., 6.]]
54+
])
55+
def test_apply_2x2_identity_switched_happy(matrix: list[list[float]]):
56+
"""
57+
Same as previous test, but with the operands switched
58+
"""
59+
qscode = matrix_dot_product_code(id2x2, matrix)
60+
61+
result = qsharp.eval(qscode)
62+
63+
assert result == matrix
64+
65+
4766
@pytest.mark.parametrize("matrix", [
4867
[[1.]]
4968
])

0 commit comments

Comments
 (0)