Skip to content

Commit 77e00a4

Browse files
committed
✨ Rename staticQubitWithOp to staticQubitsWithOps and update related test cases across various dialects and programs to reflect the new functionality of allocating multiple static qubits and applying operations.
1 parent 4470130 commit 77e00a4

13 files changed

Lines changed: 59 additions & 49 deletions

File tree

mlir/unittests/Compiler/test_compiler_pipeline.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,10 @@ INSTANTIATE_TEST_SUITE_P(
186186
MQT_NAMED_BUILDER(mlir::qc::staticQubits),
187187
MQT_NAMED_BUILDER(mlir::qir::staticQubits), false},
188188
CompilerPipelineTestCase{
189-
"StaticQubitWithOp", nullptr,
190-
MQT_NAMED_BUILDER(mlir::qc::staticQubitWithOp),
191-
MQT_NAMED_BUILDER(mlir::qc::staticQubitWithOp),
192-
MQT_NAMED_BUILDER(mlir::qir::staticQubitWithOp), false},
189+
"StaticQubitsWithOps", nullptr,
190+
MQT_NAMED_BUILDER(mlir::qc::staticQubitsWithOps),
191+
MQT_NAMED_BUILDER(mlir::qc::staticQubitsWithOps),
192+
MQT_NAMED_BUILDER(mlir::qir::staticQubitsWithOps), false},
193193
CompilerPipelineTestCase{"AllocQubit",
194194
MQT_NAMED_BUILDER(qc::allocQubit), nullptr,
195195
MQT_NAMED_BUILDER(mlir::qc::allocQubit),

mlir/unittests/Conversion/QCOToQC/test_qco_to_qc.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ TEST_P(QCOToQCTest, ProgramEquivalence) {
112112
/// @{
113113
INSTANTIATE_TEST_SUITE_P(
114114
QCOQubitManagementTest, QCOToQCTest,
115-
testing::Values(QCOToQCTestCase{"StaticQubits",
116-
MQT_NAMED_BUILDER(qco::staticQubits),
117-
MQT_NAMED_BUILDER(qc::staticQubits)},
118-
QCOToQCTestCase{"StaticQubitWithOp",
119-
MQT_NAMED_BUILDER(qco::staticQubitWithOp),
120-
MQT_NAMED_BUILDER(qc::staticQubitWithOp)}));
115+
testing::Values(
116+
QCOToQCTestCase{"StaticQubits", MQT_NAMED_BUILDER(qco::staticQubits),
117+
MQT_NAMED_BUILDER(qc::staticQubits)},
118+
QCOToQCTestCase{"StaticQubitsWithOps",
119+
MQT_NAMED_BUILDER(qco::staticQubitsWithOps),
120+
MQT_NAMED_BUILDER(qc::staticQubitsWithOps)}));
121121
/// @}
122122

123123
/// \name QCOToQC/Modifiers/InvOp.cpp

mlir/unittests/Conversion/QCToQCO/test_qc_to_qco.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ INSTANTIATE_TEST_SUITE_P(
114114
testing::Values(
115115
QCToQCOTestCase{"StaticQubits", MQT_NAMED_BUILDER(qc::staticQubits),
116116
MQT_NAMED_BUILDER(qco::staticQubits)},
117-
QCToQCOTestCase{"StaticQubitWithOp",
118-
MQT_NAMED_BUILDER(qc::staticQubitWithOp),
119-
MQT_NAMED_BUILDER(qco::staticQubitWithOp)}));
117+
QCToQCOTestCase{"StaticQubitsWithOps",
118+
MQT_NAMED_BUILDER(qc::staticQubitsWithOps),
119+
MQT_NAMED_BUILDER(qco::staticQubitsWithOps)}));
120120
/// @}
121121

122122
/// \name QCToQCO/Modifiers/InvOp.cpp

mlir/unittests/Conversion/QCToQIR/test_qc_to_qir.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -619,9 +619,9 @@ INSTANTIATE_TEST_SUITE_P(
619619
MQT_NAMED_BUILDER(qir::emptyQIR)},
620620
QCToQIRTestCase{"StaticQubits", MQT_NAMED_BUILDER(qc::staticQubits),
621621
MQT_NAMED_BUILDER(qir::emptyQIR)},
622-
QCToQIRTestCase{"StaticQubitWithOp",
623-
MQT_NAMED_BUILDER(qc::staticQubitWithOp),
624-
MQT_NAMED_BUILDER(qir::staticQubitWithOp)},
622+
QCToQIRTestCase{"StaticQubitsWithOps",
623+
MQT_NAMED_BUILDER(qc::staticQubitsWithOps),
624+
MQT_NAMED_BUILDER(qir::staticQubitsWithOps)},
625625
QCToQIRTestCase{"AllocDeallocPair",
626626
MQT_NAMED_BUILDER(qc::allocDeallocPair),
627627
MQT_NAMED_BUILDER(qir::emptyQIR)}));

mlir/unittests/Dialect/QC/IR/test_qc_ir.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -894,8 +894,9 @@ INSTANTIATE_TEST_SUITE_P(
894894
MQT_NAMED_BUILDER(emptyQC)},
895895
QCTestCase{"StaticQubits", MQT_NAMED_BUILDER(staticQubits),
896896
MQT_NAMED_BUILDER(emptyQC)},
897-
QCTestCase{"StaticQubitWithOp", MQT_NAMED_BUILDER(staticQubitWithOp),
898-
MQT_NAMED_BUILDER(staticQubitWithOp)},
897+
QCTestCase{"StaticQubitsWithOps",
898+
MQT_NAMED_BUILDER(staticQubitsWithOps),
899+
MQT_NAMED_BUILDER(staticQubitsWithOps)},
899900
QCTestCase{"AllocDeallocPair", MQT_NAMED_BUILDER(allocDeallocPair),
900901
MQT_NAMED_BUILDER(emptyQC)}));
901902
/// @}

mlir/unittests/Dialect/QCO/IR/test_qco_ir.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,8 +1052,9 @@ INSTANTIATE_TEST_SUITE_P(
10521052
MQT_NAMED_BUILDER(emptyQCO)},
10531053
QCOTestCase{"StaticQubits", MQT_NAMED_BUILDER(staticQubits),
10541054
MQT_NAMED_BUILDER(emptyQCO)},
1055-
QCOTestCase{"StaticQubitWithOp", MQT_NAMED_BUILDER(staticQubitWithOp),
1056-
MQT_NAMED_BUILDER(staticQubitWithOp)},
1055+
QCOTestCase{"StaticQubitsWithOps",
1056+
MQT_NAMED_BUILDER(staticQubitsWithOps),
1057+
MQT_NAMED_BUILDER(staticQubitsWithOps)},
10571058
QCOTestCase{"AllocDeallocPair", MQT_NAMED_BUILDER(allocDeallocPair),
10581059
MQT_NAMED_BUILDER(emptyQCO)}));
10591060
/// @}

mlir/unittests/Dialect/QIR/IR/test_qir_ir.cpp

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -517,18 +517,20 @@ INSTANTIATE_TEST_SUITE_P(
517517
/// @{
518518
INSTANTIATE_TEST_SUITE_P(
519519
QIRQubitManagementTest, QIRTest,
520-
testing::Values(
521-
QIRTestCase{"AllocQubit", MQT_NAMED_BUILDER(allocQubit),
522-
MQT_NAMED_BUILDER(allocQubit)},
523-
QIRTestCase{"AllocQubitRegister", MQT_NAMED_BUILDER(allocQubitRegister),
524-
MQT_NAMED_BUILDER(allocQubitRegister)},
525-
QIRTestCase{"AllocMultipleQubitRegisters",
526-
MQT_NAMED_BUILDER(allocMultipleQubitRegisters),
527-
MQT_NAMED_BUILDER(allocMultipleQubitRegisters)},
528-
QIRTestCase{"AllocLargeRegister", MQT_NAMED_BUILDER(allocLargeRegister),
529-
MQT_NAMED_BUILDER(allocLargeRegister)},
530-
QIRTestCase{"StaticQubits", MQT_NAMED_BUILDER(staticQubits),
531-
MQT_NAMED_BUILDER(staticQubits)},
532-
QIRTestCase{"StaticQubitWithOp", MQT_NAMED_BUILDER(staticQubitWithOp),
533-
MQT_NAMED_BUILDER(staticQubitWithOp)}));
520+
testing::Values(QIRTestCase{"AllocQubit", MQT_NAMED_BUILDER(allocQubit),
521+
MQT_NAMED_BUILDER(allocQubit)},
522+
QIRTestCase{"AllocQubitRegister",
523+
MQT_NAMED_BUILDER(allocQubitRegister),
524+
MQT_NAMED_BUILDER(allocQubitRegister)},
525+
QIRTestCase{"AllocMultipleQubitRegisters",
526+
MQT_NAMED_BUILDER(allocMultipleQubitRegisters),
527+
MQT_NAMED_BUILDER(allocMultipleQubitRegisters)},
528+
QIRTestCase{"AllocLargeRegister",
529+
MQT_NAMED_BUILDER(allocLargeRegister),
530+
MQT_NAMED_BUILDER(allocLargeRegister)},
531+
QIRTestCase{"StaticQubits", MQT_NAMED_BUILDER(staticQubits),
532+
MQT_NAMED_BUILDER(staticQubits)},
533+
QIRTestCase{"StaticQubitsWithOps",
534+
MQT_NAMED_BUILDER(staticQubitsWithOps),
535+
MQT_NAMED_BUILDER(staticQubitsWithOps)}));
534536
/// @}

mlir/unittests/programs/qc_programs.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ void staticQubits(QCProgramBuilder& b) {
3434
b.staticQubit(1);
3535
}
3636

37-
void staticQubitWithOp(QCProgramBuilder& b) {
38-
auto q = b.staticQubit(0);
39-
b.h(q);
37+
void staticQubitsWithOps(QCProgramBuilder& b) {
38+
auto q0 = b.staticQubit(0);
39+
auto q1 = b.staticQubit(1);
40+
b.h(q0);
41+
b.h(q1);
4042
}
4143

4244
void allocDeallocPair(QCProgramBuilder& b) {

mlir/unittests/programs/qc_programs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ void allocLargeRegister(QCProgramBuilder& b);
3333
/// Allocates two inline qubits.
3434
void staticQubits(QCProgramBuilder& b);
3535

36-
/// Allocates a static qubit and applies an operation.
37-
void staticQubitWithOp(QCProgramBuilder& b);
36+
/// Allocates two static qubits and applies operations.
37+
void staticQubitsWithOps(QCProgramBuilder& b);
3838

3939
/// Allocates and explicitly deallocates a single qubit.
4040
void allocDeallocPair(QCProgramBuilder& b);

mlir/unittests/programs/qco_programs.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ void staticQubits(QCOProgramBuilder& b) {
3838
b.staticQubit(1);
3939
}
4040

41-
void staticQubitWithOp(QCOProgramBuilder& b) {
42-
auto q = b.staticQubit(0);
43-
b.h(q);
41+
void staticQubitsWithOps(QCOProgramBuilder& b) {
42+
auto q0 = b.staticQubit(0);
43+
auto q1 = b.staticQubit(1);
44+
q0 = b.h(q0);
45+
q1 = b.h(q1);
4446
}
4547

4648
void allocDeallocPair(QCOProgramBuilder& b) {

0 commit comments

Comments
 (0)