Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
mlodi-hqs committed Jan 29, 2024
1 parent d83fd61 commit 7b41ed2
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 43 deletions.
6 changes: 3 additions & 3 deletions qoqo/tests/integration/devices.rs
Original file line number Diff line number Diff line change
Expand Up @@ -820,8 +820,8 @@ mod test_chain_with_environment {
// | |
// 2 - 5
// ```
let mut new_chains: Vec<(Vec<usize>, HashMap<usize, Vec<usize>>)> = Vec::new();
new_chains.push((vec![4], HashMap::from([(4, vec![1, 3, 5, 7])])));
let mut new_chains: Vec<roqoqo::devices::ChainAndEnvironment> =
vec![(vec![4], HashMap::from([(4, vec![1, 3, 5, 7])]))];
new_chains.push((
vec![3, 4],
HashMap::from([(3, vec![0, 6]), (4, vec![1, 5, 7])]),
Expand Down Expand Up @@ -886,7 +886,7 @@ mod test_chain_with_environment {
.unwrap()
.extract::<bool>(py)
.unwrap();
assert_eq!(__implements_environment_with_chains, true);
assert!(__implements_environment_with_chains);
let chains_with_environment = test_device
.call_method0(py, "__environment_chains")
.unwrap();
Expand Down
4 changes: 0 additions & 4 deletions qoqo/tests/integration/measurements/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,9 @@
// limitations under the License.

mod basis_rotation_measurement;
pub use basis_rotation_measurement::*;

mod cheated_basis_rotation_measurement;
pub use cheated_basis_rotation_measurement::*;

mod cheated_measurement;
pub use cheated_measurement::*;

mod classical_register_measurement;
pub use classical_register_measurement::*;
9 changes: 0 additions & 9 deletions qoqo/tests/integration/operations/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,22 @@
// limitations under the License.

mod define_operations;
pub use define_operations::*;

mod measurement_operations;
pub use measurement_operations::*;

mod operation_conversions;
pub use operation_conversions::*;

mod pragma_operations;
pub use pragma_operations::*;

mod multi_qubit_gate_operations;
pub use multi_qubit_gate_operations::*;

mod single_qubit_gate_operations;
pub use single_qubit_gate_operations::*;

mod two_qubit_gate_operations;
pub use two_qubit_gate_operations::*;

mod three_qubit_gate_operations;
pub use three_qubit_gate_operations::*;

mod bosonic_operations;
pub use bosonic_operations::*;

use pyo3::prelude::*;
use qoqo_calculator::CalculatorFloat;
Expand Down
5 changes: 0 additions & 5 deletions roqoqo/tests/integration/measurements/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,7 @@
// limitations under the License.

mod basis_rotation_measurement;
pub use basis_rotation_measurement::*;
mod cheated_basis_rotation_measurement;
pub use cheated_basis_rotation_measurement::*;
mod measurement_auxiliary_data_input;
pub use measurement_auxiliary_data_input::*;
mod cheated_measurement;
pub use cheated_measurement::*;
mod classical_register_measurement;
pub use classical_register_measurement::*;
10 changes: 0 additions & 10 deletions roqoqo/tests/integration/operations/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,24 @@
// limitations under the License.

mod define_operations;
pub use define_operations::*;

mod measurement_operations;
pub use measurement_operations::*;

mod pragma_operations;
pub use pragma_operations::*;

mod single_qubit_gate_operations;
pub use single_qubit_gate_operations::*;

mod two_qubit_gate_operations;
pub use two_qubit_gate_operations::*;

mod three_qubit_gate_operations;
pub use three_qubit_gate_operations::*;

mod multi_qubit_gate_operations;
pub use multi_qubit_gate_operations::*;

mod involved_classical;
pub use involved_classical::*;

mod supported_version;
pub use supported_version::*;

mod bosonic_operations;
pub use bosonic_operations::*;

use nalgebra as na;
use ndarray::Array2;
Expand Down
24 changes: 12 additions & 12 deletions roqoqo/tests/integration/operations/supported_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,29 +51,29 @@ use test_case::test_case;
#[test_case(operations::TwoQubitGateOperation::from(operations::PhaseShiftedControlledZ::new(1,0, 3.0.into())); "PhaseShifterControlledZ")]
fn test_version_1_0_0_two_qubit_gate(operation: operations::TwoQubitGateOperation) {
assert_eq!(operation.minimum_supported_roqoqo_version(), (1, 0, 0));
let op = operations::Operation::try_from(operation).unwrap();
let op = operations::Operation::from(operation);
assert_eq!(op.minimum_supported_roqoqo_version(), (1, 0, 0));
}

#[test_case(operations::TwoQubitGateOperation::from(operations::PhaseShiftedControlledPhase::new(1,0, 3.0.into(), 2.0.into())); "PhaseShiftedControlledPhase")]
fn test_version_1_2_0_two_qubit_gate(operation: operations::TwoQubitGateOperation) {
assert_eq!(operation.minimum_supported_roqoqo_version(), (1, 2, 0));
let op = operations::Operation::try_from(operation).unwrap();
let op = operations::Operation::from(operation);
assert_eq!(op.minimum_supported_roqoqo_version(), (1, 2, 0));
}

#[test_case(operations::TwoQubitGateOperation::from(operations::ControlledRotateX::new(0, 1, 0.1.into())); "ControlledRotateX")]
#[test_case(operations::TwoQubitGateOperation::from(operations::ControlledRotateXY::new(0, 1, 0.1.into(), 0.2.into())); "ControlledRotateXY")]
fn test_version_1_3_0_two_qubit_gate(operation: operations::TwoQubitGateOperation) {
assert_eq!(operation.minimum_supported_roqoqo_version(), (1, 3, 0));
let op = operations::Operation::try_from(operation).unwrap();
let op = operations::Operation::from(operation);
assert_eq!(op.minimum_supported_roqoqo_version(), (1, 3, 0));
}

#[test_case(operations::TwoQubitGateOperation::from(operations::EchoCrossResonance::new(0, 1)); "EchoCrossResonance")]
fn test_version_1_8_0_two_qubit_gate(operation: operations::TwoQubitGateOperation) {
assert_eq!(operation.minimum_supported_roqoqo_version(), (1, 8, 0));
let op = operations::Operation::try_from(operation).unwrap();
let op = operations::Operation::from(operation);
assert_eq!(op.minimum_supported_roqoqo_version(), (1, 8, 0));
}

Expand All @@ -82,7 +82,7 @@ fn test_version_1_8_0_two_qubit_gate(operation: operations::TwoQubitGateOperatio
#[test_case(operations::ThreeQubitGateOperation::from(operations::Toffoli::new(0, 1, 2)); "Toffoli")]
fn test_version_1_3_0_three_qubit_gate(operation: operations::ThreeQubitGateOperation) {
assert_eq!(operation.minimum_supported_roqoqo_version(), (1, 3, 0));
let op = operations::Operation::try_from(operation).unwrap();
let op = operations::Operation::from(operation);
assert_eq!(op.minimum_supported_roqoqo_version(), (1, 3, 0));
}

Expand All @@ -103,51 +103,51 @@ fn test_version_1_3_0_three_qubit_gate(operation: operations::ThreeQubitGateOper
#[test_case(operations::SingleQubitGateOperation::from(operations::SingleQubitGate::new(0,0.5.into(), 0.5.into(), 0.5.into(), 0.5.into(), 0.5.into()));"SingleQubitGate")]
fn test_version_1_0_0_single_qubit_gate(operation: operations::SingleQubitGateOperation) {
assert_eq!(operation.minimum_supported_roqoqo_version(), (1, 0, 0));
let op = operations::Operation::try_from(operation).unwrap();
let op = operations::Operation::from(operation);
assert_eq!(op.minimum_supported_roqoqo_version(), (1, 0, 0));
}

#[test_case(operations::SingleQubitGateOperation::from(operations::GPi::new(0, 0.1.into()));"GPi")]
#[test_case(operations::SingleQubitGateOperation::from(operations::GPi2::new(0, 0.1.into()));"GPi2")]
fn test_version_1_4_0_single_qubit_gate(operation: operations::SingleQubitGateOperation) {
assert_eq!(operation.minimum_supported_roqoqo_version(), (1, 4, 0));
let op = operations::Operation::try_from(operation).unwrap();
let op = operations::Operation::from(operation);
assert_eq!(op.minimum_supported_roqoqo_version(), (1, 4, 0));
}

#[test_case(operations::MultiQubitGateOperation::from(operations::MultiQubitMS::new(vec![0,1,2,3], 1.0.into())); "MultiQubitMS")]
fn test_version_1_0_0_multi_qubit_gate(operation: operations::MultiQubitGateOperation) {
assert_eq!(operation.minimum_supported_roqoqo_version(), (1, 0, 0));
let op = operations::Operation::try_from(operation).unwrap();
let op = operations::Operation::from(operation);
assert_eq!(op.minimum_supported_roqoqo_version(), (1, 0, 0));
}

#[test_case(operations::SingleModeGateOperation::from(operations::Squeezing::new(0, 1.0.into(), 0.0.into())); "Squeezing")]
#[test_case(operations::SingleModeGateOperation::from(operations::PhaseShift::new(0, 1.0.into())); "PhaseShift")]
fn test_version_1_6_0_single_mode_gate(operation: operations::SingleModeGateOperation) {
assert_eq!(operation.minimum_supported_roqoqo_version(), (1, 6, 0));
let op = operations::Operation::try_from(operation).unwrap();
let op = operations::Operation::from(operation);
assert_eq!(op.minimum_supported_roqoqo_version(), (1, 6, 0));
}

#[test_case(operations::SingleModeGateOperation::from(operations::PhaseDisplacement::new(0, 1.0.into(), 0.1.into())); "PhaseDisplacement")]
fn test_version_1_8_0_single_mode_gate(operation: operations::SingleModeGateOperation) {
assert_eq!(operation.minimum_supported_roqoqo_version(), (1, 8, 0));
let op = operations::Operation::try_from(operation).unwrap();
let op = operations::Operation::from(operation);
assert_eq!(op.minimum_supported_roqoqo_version(), (1, 8, 0));
}

#[test_case(operations::TwoModeGateOperation::from(operations::BeamSplitter::new(0, 1, 0.5.into(), 1.0.into())); "BeamSplitter")]
fn test_version_1_6_0_two_mode_gate(operation: operations::TwoModeGateOperation) {
assert_eq!(operation.minimum_supported_roqoqo_version(), (1, 6, 0));
let op = operations::Operation::try_from(operation).unwrap();
let op = operations::Operation::from(operation);
assert_eq!(op.minimum_supported_roqoqo_version(), (1, 6, 0));
}

#[test_case(operations::SingleModeOperation::from(operations::PhotonDetection::new(0, "ro".into(), 1)); "PhotonDetection")]
fn test_version_1_6_0_measurement_mode_gate(operation: operations::SingleModeOperation) {
assert_eq!(operation.minimum_supported_roqoqo_version(), (1, 6, 0));
let op = operations::Operation::try_from(operation).unwrap();
let op = operations::Operation::from(operation);
assert_eq!(op.minimum_supported_roqoqo_version(), (1, 6, 0));
}

Expand Down

0 comments on commit 7b41ed2

Please sign in to comment.