-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First implementation of chain_with_environment (#539)
* First implementation of chain_with_environment * added leading underscores to unstable function * Updated deps of compatibility tests and added a compatibility test crate for 1.8 * Added a test for 1.8 compatibility crate * Updated deps from 1.8 to 1.9 * Added trait for 1.9 and comment for 1.9 * Fixed documentation and whitespace * Fixed unittest * Added comment for 1.9 * Updated deps file * Update compatibility_1_8.rs * Update compatibility_1_8.rs --------- Co-authored-by: Kirsten Bark <[email protected]> Co-authored-by: kbarkhqs <[email protected]>
- Loading branch information
1 parent
6984645
commit 07b5096
Showing
29 changed files
with
867 additions
and
727 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "compatibility_test_1_0" | ||
version ="1.8.0" | ||
version ="1.9.0" | ||
authors = ["HQS Quantum Simulations <[email protected]>"] | ||
license = "Apache-2.0" | ||
edition = "2021" | ||
|
@@ -22,7 +22,7 @@ publish = false | |
test_roqoqo_1_0 = {package = "roqoqo", version="=1.0.0"} | ||
test_roqoqo_derive_1_0 = {package = "roqoqo-derive", version="=1.0.0"} | ||
qoqo_calculator = { version="1.1" } | ||
roqoqo = {version="1.8", path="../../roqoqo", features=["serialize", "overrotate"]} | ||
roqoqo = {version="1.9", path="../../roqoqo", features=["serialize", "overrotate"]} | ||
bincode = {version="1.3"} | ||
ndarray = "0.15" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "compatibility_test_1_2" | ||
version ="1.8.0" | ||
version ="1.9.0" | ||
authors = ["HQS Quantum Simulations <[email protected]>"] | ||
license = "Apache-2.0" | ||
edition = "2021" | ||
|
@@ -22,7 +22,7 @@ publish = false | |
test_roqoqo_1_2 = {package = "roqoqo", version="=1.2.5"} | ||
test_roqoqo_derive_1_2 = {package = "roqoqo-derive", version="=1.2.5"} | ||
qoqo_calculator = { version="1.1" } | ||
roqoqo = {version="1.8", path="../../roqoqo", features=["serialize", "overrotate"]} | ||
roqoqo = {version="1.9", path="../../roqoqo", features=["serialize", "overrotate"]} | ||
bincode = {version="1.3"} | ||
ndarray = "0.15" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "compatibility_test_1_3" | ||
version ="1.8.0" | ||
version ="1.9.0" | ||
authors = ["HQS Quantum Simulations <[email protected]>"] | ||
license = "Apache-2.0" | ||
edition = "2021" | ||
|
@@ -22,7 +22,7 @@ publish = false | |
test_roqoqo_1_3 = {package = "roqoqo", version="=1.3.2"} | ||
test_roqoqo_derive_1_3 = {package = "roqoqo-derive", version="=1.3.2"} | ||
qoqo_calculator = { version="1.1" } | ||
roqoqo = {version="1.8", path="../../roqoqo", features=["serialize", "overrotate"]} | ||
roqoqo = {version="1.9", path="../../roqoqo", features=["serialize", "overrotate"]} | ||
bincode = {version="1.3"} | ||
ndarray = "0.15" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "compatibility_test_1_4" | ||
version ="1.8.0" | ||
version ="1.9.0" | ||
authors = ["HQS Quantum Simulations <[email protected]>"] | ||
license = "Apache-2.0" | ||
edition = "2021" | ||
|
@@ -22,7 +22,7 @@ publish = false | |
test_roqoqo_1_4 = {package = "roqoqo", version="=1.4.0"} | ||
test_roqoqo_derive_1_4 = {package = "roqoqo-derive", version="=1.4.0"} | ||
qoqo_calculator = { version="1.1" } | ||
roqoqo = {version="1.8", path="../../roqoqo", features=["serialize", "overrotate"]} | ||
roqoqo = {version="1.9", path="../../roqoqo", features=["serialize", "overrotate"]} | ||
bincode = {version="1.3"} | ||
ndarray = "0.15" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "compatibility_test_1_5" | ||
version ="1.8.0" | ||
version ="1.9.0" | ||
authors = ["HQS Quantum Simulations <[email protected]>"] | ||
license = "Apache-2.0" | ||
edition = "2021" | ||
|
@@ -22,7 +22,7 @@ publish = false | |
test_roqoqo_1_5 = {package = "roqoqo", version="=1.5.0"} | ||
test_roqoqo_derive_1_5 = {package = "roqoqo-derive", version="=1.5.0"} | ||
qoqo_calculator = { version="1.1" } | ||
roqoqo = {version="1.8", path="../../roqoqo", features=["serialize", "overrotate"]} | ||
roqoqo = {version="1.9", path="../../roqoqo", features=["serialize", "overrotate"]} | ||
bincode = {version="1.3"} | ||
ndarray = "0.15" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "compatibility_test_1_6" | ||
version ="1.8.0" | ||
version ="1.9.0" | ||
authors = ["HQS Quantum Simulations <[email protected]>"] | ||
license = "Apache-2.0" | ||
edition = "2021" | ||
|
@@ -22,7 +22,7 @@ publish = false | |
test_roqoqo_1_6 = {package = "roqoqo", version="=1.6.1"} | ||
test_roqoqo_derive_1_6 = {package = "roqoqo-derive", version="=1.6.1"} | ||
qoqo_calculator = { version="1.1" } | ||
roqoqo = {version="1.8", path="../../roqoqo", features=["serialize", "overrotate"]} | ||
roqoqo = {version="1.9", path="../../roqoqo", features=["serialize", "overrotate"]} | ||
bincode = {version="1.3"} | ||
ndarray = "0.15" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "compatibility_test_1_7" | ||
version ="1.8.0" | ||
version ="1.9.0" | ||
authors = ["HQS Quantum Simulations <[email protected]>"] | ||
license = "Apache-2.0" | ||
edition = "2021" | ||
|
@@ -22,7 +22,7 @@ publish = false | |
test_roqoqo_1_7 = {package = "roqoqo", version="=1.7.1"} | ||
test_roqoqo_derive_1_7 = {package = "roqoqo-derive", version="=1.7.1"} | ||
qoqo_calculator = { version="1.1" } | ||
roqoqo = {version="1.8", path="../../roqoqo", features=["serialize", "overrotate"]} | ||
roqoqo = {version="1.9", path="../../roqoqo", features=["serialize", "overrotate"]} | ||
bincode = {version="1.3"} | ||
ndarray = "0.15" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
[package] | ||
name = "compatibility_test_1_8" | ||
version ="1.9.0" | ||
authors = ["HQS Quantum Simulations <[email protected]>"] | ||
license = "Apache-2.0" | ||
edition = "2021" | ||
rust-version = "1.56" | ||
categories = ["science", "simulation"] | ||
homepage = "https://github.com/HQSquantumsimulations/qoqo" | ||
repository = "https://github.com/HQSquantumsimulations/qoqo" | ||
documentation = "https://docs.rs/roqoqo/" | ||
readme = "../README.md" | ||
description = "Compatibility tests for roqoqo" | ||
include = ["src*", "build.rs", "LICENSE", "README.md"] | ||
publish = false | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[workspace] | ||
|
||
[dependencies] | ||
test_roqoqo_1_8 = {package = "roqoqo", version="=1.8.0"} | ||
test_roqoqo_derive_1_8 = {package = "roqoqo-derive", version="=1.8.0"} | ||
qoqo_calculator = { version="1.1" } | ||
roqoqo = {version="1.9", path="../../roqoqo", features=["serialize", "overrotate"]} | ||
bincode = {version="1.3"} | ||
ndarray = "0.15" | ||
|
||
[dev-dependencies] | ||
test-case = "3.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
pub fn add(left: usize, right: usize) -> usize { | ||
left + right | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
|
||
#[test] | ||
fn it_works() { | ||
let result = add(2, 2); | ||
assert_eq!(result, 4); | ||
} | ||
} |
155 changes: 155 additions & 0 deletions
155
.compatibility_tests/compatibility_test_1_8/tests/integration/compatibility_1_8.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
// Copyright © 2023 HQS Quantum Simulations GmbH. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
// in compliance with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software distributed under the | ||
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
// express or implied. See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
use std::collections::HashMap; | ||
|
||
use test_case::test_case; | ||
use test_roqoqo_1_8; | ||
|
||
// 1.0 version | ||
#[test_case(test_roqoqo_1_8::operations::SingleQubitGate::new(0, 1.0.into(), 0.0.into(), 0.0.into(), 0.0.into(), 0.0.into(),).into(); "SingleQubitGate")] | ||
#[test_case(test_roqoqo_1_8::operations::RotateZ::new(0, 0.1.into()).into(); "RotateZ")] | ||
#[test_case(test_roqoqo_1_8::operations::RotateY::new(0, 0.1.into()).into(); "RotateY")] | ||
#[test_case(test_roqoqo_1_8::operations::RotateX::new(0, 0.1.into()).into(); "RotateX")] | ||
#[test_case(test_roqoqo_1_8::operations::RotateXY::new(0,1.0.into(), 0.1.into()).into(); "RotateXY")] | ||
#[test_case(test_roqoqo_1_8::operations::RotateAroundSphericalAxis::new(0, 1.0.into(), 1.0.into(), 1.0.into()).into(); "RotateAroundSphericalAxis")] | ||
#[test_case(test_roqoqo_1_8::operations::PauliZ::new(0).into(); "PauliZ")] | ||
#[test_case(test_roqoqo_1_8::operations::PauliY::new(0).into(); "PauliY")] | ||
#[test_case(test_roqoqo_1_8::operations::PauliX::new(0).into(); "PauliX")] | ||
#[test_case(test_roqoqo_1_8::operations::SqrtPauliX::new(0).into(); "SqrtPauliX")] | ||
#[test_case(test_roqoqo_1_8::operations::InvSqrtPauliX::new(0).into(); "InvSqrtPauliX")] | ||
#[test_case(test_roqoqo_1_8::operations::Hadamard::new(0).into(); "Hadamard")] | ||
#[test_case(test_roqoqo_1_8::operations::TGate::new(0).into(); "TGate")] | ||
#[test_case(test_roqoqo_1_8::operations::SGate::new(0).into(); "SGate")] | ||
#[test_case(test_roqoqo_1_8::operations::DefinitionBit::new("ro".to_string(), 1, false).into(); "DefinitionBit")] | ||
#[test_case(test_roqoqo_1_8::operations::DefinitionComplex::new("ro".to_string(), 1, true).into(); "DefinitionComplex")] | ||
#[test_case(test_roqoqo_1_8::operations::DefinitionUsize::new("ro".to_string(), 1, true).into(); "DefinitionUsize")] | ||
#[test_case(test_roqoqo_1_8::operations::DefinitionFloat::new("ro".to_string(), 1, true).into(); "DefinitionFloat")] | ||
#[test_case(test_roqoqo_1_8::operations::InputSymbolic::new("ro".to_string(), 1.0).into(); "InputSymbolic")] | ||
#[test_case(test_roqoqo_1_8::operations::MeasureQubit::new(0,"ro".to_string(), 1).into(); "MeasureQubit")] | ||
#[test_case(test_roqoqo_1_8::operations::PragmaGetStateVector::new("ro".to_string(), None).into(); "PragmaGetStateVector")] | ||
#[test_case(test_roqoqo_1_8::operations::PragmaGetDensityMatrix::new("ro".to_string(), None).into(); "PragmaGetDensityMatrix")] | ||
#[test_case(test_roqoqo_1_8::operations::PragmaGetOccupationProbability::new("ro".to_string(), None).into(); "PragmaGetOccupationProbability")] | ||
#[test_case(test_roqoqo_1_8::operations::PragmaGetPauliProduct::new(std::collections::HashMap::new(),"ro".to_string(), test_roqoqo_1_8::Circuit::new()).into(); "PragmaGetPauliProduct")] | ||
#[test_case(test_roqoqo_1_8::operations::PragmaRepeatedMeasurement::new("ro".to_string(), 10, None).into(); "PragmaRepeatedMeasurement")] | ||
#[test_case(test_roqoqo_1_8::operations::PragmaSetNumberOfMeasurements::new(10, "ro".to_string()).into(); "PragmaSetNumberOfMeasurements")] | ||
#[test_case(test_roqoqo_1_8::operations::PragmaSetStateVector::new(ndarray::array![1.0.into(), 0.0.into(), 0.0.into()]).into(); "PragmaSetStateVector")] | ||
#[test_case(test_roqoqo_1_8::operations::PragmaSetDensityMatrix::new(ndarray::array![[1.0.into(), 0.0.into(), 0.0.into()]]).into(); "PragmaSetDensityMatrix")] | ||
#[test_case(test_roqoqo_1_8::operations::PragmaRepeatGate::new(10).into(); "PragmaRepeatGate")] | ||
#[test_case(test_roqoqo_1_8::operations::PragmaOverrotation::new("RotateZ".to_string(), vec![0], 1.0, 1.0).into(); "PragmaOverrotation")] | ||
#[test_case(test_roqoqo_1_8::operations::PragmaBoostNoise::new(1.0.into()).into(); "PragmaBoostNoise")] | ||
#[test_case(test_roqoqo_1_8::operations::PragmaStopParallelBlock::new(vec![0], 1.0.into()).into(); "PragmaStopParallelBlock")] | ||
#[test_case(test_roqoqo_1_8::operations::PragmaGlobalPhase::new(1.0.into()).into(); "PragmaGlobalPhase")] | ||
#[test_case(test_roqoqo_1_8::operations::PragmaSleep::new(vec![0], 1.0.into()).into(); "PragmaSleep")] | ||
#[test_case(test_roqoqo_1_8::operations::PragmaActiveReset::new(0).into(); "PragmaActiveReset")] | ||
#[test_case(test_roqoqo_1_8::operations::PragmaStartDecompositionBlock::new(vec![0], HashMap::new()).into(); "PragmaStartDecompositionBlock")] | ||
#[test_case(test_roqoqo_1_8::operations::PragmaStopDecompositionBlock::new(vec![0]).into(); "PragmaStopDecompositionBlock")] | ||
#[test_case(test_roqoqo_1_8::operations::PragmaDamping::new(0,1.0.into(), 1.0.into()).into(); "PragmaDamping")] | ||
#[test_case(test_roqoqo_1_8::operations::PragmaDepolarising::new(0,1.0.into(), 1.0.into()).into(); "PragmaDepolarising")] | ||
#[test_case(test_roqoqo_1_8::operations::PragmaDephasing::new(0,1.0.into(), 1.0.into()).into(); "PragmaDephasing")] | ||
#[test_case(test_roqoqo_1_8::operations::PragmaRandomNoise::new(0,1.0.into(), 1.0.into(), 1.0.into()).into(); "PragmaRandomNoise")] | ||
#[test_case(test_roqoqo_1_8::operations::PragmaGeneralNoise::new(0, 0.1.into(), ndarray::array![[1.0.into(), 0.0.into()], [1.0.into(), 2.0.into()]]).into(); "PragmaGeneralNoise")] | ||
#[test_case(test_roqoqo_1_8::operations::PragmaConditional::new("ro".to_string(),0, test_roqoqo_1_8::Circuit::new()).into(); "PragmaConditional")] | ||
// #[test_case(test_roqoqo_1_8::operations::PragmaChangeDevice::new(&"PragmaTest".into()).unwrap().into(); "PragmaChangeDevice")] | ||
#[test_case(test_roqoqo_1_8::operations::CNOT::new(0,1).into(); "CNOT")] | ||
#[test_case(test_roqoqo_1_8::operations::SWAP::new(0,1).into(); "SWAP")] | ||
#[test_case(test_roqoqo_1_8::operations::FSwap::new(0,1).into(); "FSwap")] | ||
#[test_case(test_roqoqo_1_8::operations::ISwap::new(0,1).into(); "ISwap")] | ||
#[test_case(test_roqoqo_1_8::operations::SqrtISwap::new(0,1).into(); "SqrtISWAP")] | ||
#[test_case(test_roqoqo_1_8::operations::InvSqrtISwap::new(0,1).into(); "InvSqrtISWAP")] | ||
#[test_case(test_roqoqo_1_8::operations::XY::new(0,1, 0.1.into()).into(); "XY")] | ||
#[test_case(test_roqoqo_1_8::operations::ControlledPhaseShift::new(0,1, 0.1.into()).into(); "ControlledPhase")] | ||
#[test_case(test_roqoqo_1_8::operations::ControlledPauliY::new(0,1).into(); "ControlledPauliY")] | ||
#[test_case(test_roqoqo_1_8::operations::ControlledPauliZ::new(0,1).into(); "ControlledPauliZ")] | ||
#[test_case(test_roqoqo_1_8::operations::MolmerSorensenXX::new(0,1).into(); "MolmerSorensenXX")] | ||
#[test_case(test_roqoqo_1_8::operations::VariableMSXX::new(0,1, 0.1.into()).into(); "VariableMSXX")] | ||
#[test_case(test_roqoqo_1_8::operations::GivensRotation::new(0,1, 0.1.into(), 0.1.into()).into(); "GivensRotation")] | ||
#[test_case(test_roqoqo_1_8::operations::GivensRotationLittleEndian::new(0,1, 0.1.into(), 0.1.into()).into(); "GivensRotationLittleEndian")] | ||
#[test_case(test_roqoqo_1_8::operations::Qsim::new(0,1, 0.1.into(), 0.1.into(), 0.1.into()).into(); "Qsim")] | ||
#[test_case(test_roqoqo_1_8::operations::Fsim::new(0,1, 0.1.into(), 0.1.into(), 0.1.into()).into(); "Fsim")] | ||
#[test_case(test_roqoqo_1_8::operations::SpinInteraction::new(0,1, 0.1.into(), 0.1.into(), 0.1.into()).into(); "SpinInteraction")] | ||
#[test_case(test_roqoqo_1_8::operations::Bogoliubov::new(0,1, 0.1.into(), 0.1.into()).into(); "Bogoliubov")] | ||
#[test_case(test_roqoqo_1_8::operations::PMInteraction::new(0,1, 0.1.into()).into(); "PMInteraction")] | ||
#[test_case(test_roqoqo_1_8::operations::ComplexPMInteraction::new(0,1, 0.1.into(), 0.1.into()).into(); "ComplexPMInteraction")] | ||
#[test_case(test_roqoqo_1_8::operations::PhaseShiftedControlledZ::new(0,1, 1.0.into()).into(); "PhaseShiftedControlledZ")] | ||
#[test_case(test_roqoqo_1_8::operations::PhaseShiftState1::new(0, 1.0.into()).into(); "PhaseShiftState1")] | ||
#[test_case(test_roqoqo_1_8::operations::PhaseShiftState0::new(0, 1.0.into()).into(); "PhaseShiftState0")] | ||
#[test_case(test_roqoqo_1_8::operations::MultiQubitMS::new(vec![0,2,3], 1.0.into()).into(); "MultiQubitMS")] | ||
#[test_case(test_roqoqo_1_8::operations::MultiQubitZZ::new(vec![0,2,3], 1.0.into()).into(); "MultiQubitZZ")] | ||
// 1.1 and 1.2 | ||
#[test_case(test_roqoqo_1_8::operations::InputBit::new("input".to_string(), 1, true).into(); "InputBit")] | ||
#[test_case(test_roqoqo_1_8::operations::PragmaLoop::new(2.0.into(), test_roqoqo_1_8::Circuit::new()).into(); "PragmaLoop")] | ||
#[test_case(test_roqoqo_1_8::operations::PhaseShiftedControlledPhase::new(0,1, 1.0.into(), 1.0.into()).into(); "PhaseShiftedControlledPhase")] | ||
// 1.3 | ||
#[test_case(test_roqoqo_1_8::operations::ControlledRotateX::new(0,1, 1.0.into()).into(); "ControlledRotateX")] | ||
#[test_case(test_roqoqo_1_8::operations::ControlledRotateXY::new(0,1, 1.0.into(), 1.0.into()).into(); "ControlledRotateXY")] | ||
#[test_case(test_roqoqo_1_8::operations::ControlledControlledPauliZ::new(0,1,2).into(); "ControlledControlledPauliZ")] | ||
#[test_case(test_roqoqo_1_8::operations::ControlledControlledPhaseShift::new(0,1,2, 1.0.into()).into(); "ControlledControlledPhaseShift")] | ||
#[test_case(test_roqoqo_1_8::operations::Toffoli::new(0,1,2).into(); "Toffoli")] | ||
// 1.4 | ||
#[test_case(test_roqoqo_1_8::operations::GPi::new(0, 0.1.into()).into(); "GPi")] | ||
#[test_case(test_roqoqo_1_8::operations::GPi2::new(0, 0.1.into()).into(); "GPi2")] | ||
// 1.5 | ||
#[test_case(test_roqoqo_1_8::operations::PragmaControlledCircuit::new(0, test_roqoqo_1_8::Circuit::new()).into(); "PragmaControlledCircuit")] | ||
// Operations from 1.6 | ||
#[test_case(test_roqoqo_1_8::operations::Squeezing::new(0, 0.1.into(), 0.1.into()).into(); "Squeezing")] | ||
#[test_case(test_roqoqo_1_8::operations::PhaseShift::new(0, 0.1.into()).into(); "PhaseShift")] | ||
#[test_case(test_roqoqo_1_8::operations::BeamSplitter::new(0, 1, 0.1.into(), 0.2.into()).into(); "BeamSplitter")] | ||
#[test_case(test_roqoqo_1_8::operations::PhotonDetection::new(0, "ro".into(), 0).into(); "PhotonDetection")] | ||
// Operations from 1.7 | ||
#[test_case(test_roqoqo_1_8::operations::Identity::new(0).into(); "Identity")] | ||
// Operations from 1.8 | ||
#[test_case(test_roqoqo_1_8::operations::PhaseDisplacement::new(0, 0.1.into(), 0.1.into()).into(); "PhaseDisplacement")] | ||
#[test_case(test_roqoqo_1_8::operations::EchoCrossResonance::new(0, 1).into(); "EchoCrossResonance")] | ||
#[test_case(test_roqoqo_1_8::operations::PragmaAnnotatedOp::new(test_roqoqo_1_8::operations::PauliX::new(0).into(), "test".to_string()).into(); "PragmaAnnotatedOp")] | ||
// Operations from 1.9 - uncomment for next unittests | ||
fn test_bincode_compatibility_1_8(operation: test_roqoqo_1_8::operations::Operation) { | ||
let mut test_circuit = test_roqoqo_1_8::Circuit::new(); | ||
test_circuit += operation; | ||
|
||
let test_measurement_input = test_roqoqo_1_8::measurements::PauliZProductInput::new(3, false); | ||
let test_measurement = test_roqoqo_1_8::measurements::PauliZProduct { | ||
constant_circuit: Some(test_circuit.clone()), | ||
circuits: vec![test_circuit], | ||
input: test_measurement_input, | ||
}; | ||
let test_program = test_roqoqo_1_8::QuantumProgram::PauliZProduct { | ||
measurement: test_measurement, | ||
input_parameter_names: vec!["test".to_string()], | ||
}; | ||
let test_serialisation: Vec<u8> = bincode::serialize(&test_program).unwrap(); | ||
|
||
let _test_deserialisation: roqoqo::QuantumProgram = | ||
bincode::deserialize(&test_serialisation).unwrap(); | ||
} | ||
|
||
#[test] | ||
fn test_device_compat() { | ||
let test_device = test_roqoqo_1_8::devices::AllToAllDevice::new( | ||
3, | ||
&["RotateZ".to_string()], | ||
&["CNOT".to_string()], | ||
1.0, | ||
); | ||
let test_serialisation: Vec<u8> = bincode::serialize(&test_device).unwrap(); | ||
|
||
let test_deserialisation: roqoqo::devices::AllToAllDevice = | ||
bincode::deserialize(&test_serialisation).unwrap(); | ||
|
||
let comparsion_device = roqoqo::devices::AllToAllDevice::new( | ||
3, | ||
&["RotateZ".to_string()], | ||
&["CNOT".to_string()], | ||
1.0, | ||
); | ||
assert_eq!(test_deserialisation, comparsion_device); | ||
} |
13 changes: 13 additions & 0 deletions
13
.compatibility_tests/compatibility_test_1_8/tests/integration/main.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright © 2021-2023 HQS Quantum Simulations GmbH. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
// in compliance with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software distributed under the | ||
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
// express or implied. See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
#[cfg(test)] | ||
mod compatibility_1_8; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "compatibility_test_sim" | ||
version = "1.8.0" | ||
version = "1.9.0" | ||
authors = ["HQS Quantum Simulations <[email protected]>"] | ||
license = "Apache-2.0" | ||
edition = "2021" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.