Skip to content

Commit

Permalink
Clean testset for targettype
Browse files Browse the repository at this point in the history
  • Loading branch information
Todorbsc committed Mar 14, 2024
1 parent 723a0c8 commit 2121fe3
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions test/Gate_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -481,18 +481,12 @@
@test targettype(Gate{Op}) === I
end

@testset "gate_operator_targettype" begin
gates = [Rx(1, θ = π / 4), CRy(1, 2, θ = π / 6), Control(1, Control(2, Rz(3, θ = π / 3)))]
targettypes = [Rx, Ry, Rz]

@testset "gate_targettype_$gate" for (gate, tgttype) in zip(gates, targettypes)
@test targettype(gate) === tgttype
end

@testset "op_targettype_$gate" for (gate, tgttype) in zip(gates, targettypes)
op = operator(gate)
@test targettype(op) === tgttype
end
@testset "$(operator(gate))" for (gate, correct) in [
(Z(1), Z),
(CZ(1, 2), Z),
(Control(1, Control(2, Z(3))), Z),
]
@test targettype(gate) === correct
end
end

Expand Down

0 comments on commit 2121fe3

Please sign in to comment.