Skip to content
Merged
2 changes: 1 addition & 1 deletion test/algorithms/test_qpe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ TEST_P(QPE, IQPETest) {
auto qc = qc::createIterativeQPE(lambda, precision);
ASSERT_EQ(qc.getNqubits(), 2U);

constexpr auto shots = 8192U;
constexpr auto shots = 16384U;
const auto measurements = dd::sample(qc, shots);

// sort the measurements
Expand Down
31 changes: 2 additions & 29 deletions test/qdmi/devices/dd/device_status_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ TEST(DeviceStatus, TransitionsBusyThenIdleAfterJob) {
// it. Submit a job to force BUSY then completion to IDLE.
const qdmi_test::JobGuard j{s.session};
ASSERT_EQ(qdmi_test::setProgram(j.job, QDMI_PROGRAM_FORMAT_QASM3,
qdmi_test::QASM3_BELL_SAMPLING),
qdmi_test::QASM3_HEAVY_SAMPLING),
QDMI_SUCCESS);
ASSERT_EQ(qdmi_test::setShots(j.job, 4096), QDMI_SUCCESS);
ASSERT_EQ(qdmi_test::setShots(j.job, 16384), QDMI_SUCCESS);
ASSERT_EQ(MQT_DDSIM_QDMI_device_job_submit(j.job), QDMI_SUCCESS);

// Poll while running to observe BUSY at least once.
Expand All @@ -65,30 +65,3 @@ TEST(DeviceStatus, TransitionsBusyThenIdleAfterJob) {
// After completion, the status should be IDLE.
EXPECT_EQ(queryStatus(s.session), QDMI_DEVICE_STATUS_IDLE);
}

TEST(DeviceStatus, MultipleConcurrentJobsKeepBusyUntilLastFinishes) {
const qdmi_test::SessionGuard s{};

const qdmi_test::JobGuard j1{s.session};
const qdmi_test::JobGuard j2{s.session};
ASSERT_EQ(qdmi_test::setProgram(j1.job, QDMI_PROGRAM_FORMAT_QASM3,
qdmi_test::QASM3_BELL_SAMPLING),
QDMI_SUCCESS);
ASSERT_EQ(qdmi_test::setProgram(j2.job, QDMI_PROGRAM_FORMAT_QASM3,
qdmi_test::QASM3_HEAVY_SAMPLING5),
QDMI_SUCCESS);
ASSERT_EQ(qdmi_test::setShots(j1.job, 1024), QDMI_SUCCESS);
ASSERT_EQ(qdmi_test::setShots(j2.job, 16384), QDMI_SUCCESS);

ASSERT_EQ(MQT_DDSIM_QDMI_device_job_submit(j1.job), QDMI_SUCCESS);
ASSERT_EQ(MQT_DDSIM_QDMI_device_job_submit(j2.job), QDMI_SUCCESS);

// Wait for first to finish
ASSERT_EQ(MQT_DDSIM_QDMI_device_job_wait(j1.job, 0), QDMI_SUCCESS);
// Status should still be BUSY while the second runs
EXPECT_EQ(queryStatus(s.session), QDMI_DEVICE_STATUS_BUSY);

// Wait for second, then status should go IDLE
ASSERT_EQ(MQT_DDSIM_QDMI_device_job_wait(j2.job, 0), QDMI_SUCCESS);
EXPECT_EQ(queryStatus(s.session), QDMI_DEVICE_STATUS_IDLE);
}
4 changes: 2 additions & 2 deletions test/qdmi/devices/dd/error_handling_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ TEST_F(ErrorHandling, GetResultsBeforeDone) {
const qdmi_test::SessionGuard s{};
const qdmi_test::JobGuard j{s.session};
ASSERT_EQ(qdmi_test::setProgram(j.job, QDMI_PROGRAM_FORMAT_QASM3,
qdmi_test::QASM3_BELL_SAMPLING),
qdmi_test::QASM3_HEAVY_SAMPLING),
QDMI_SUCCESS);
ASSERT_EQ(qdmi_test::setShots(j.job, 64), QDMI_SUCCESS);
ASSERT_EQ(qdmi_test::setShots(j.job, 16384), QDMI_SUCCESS);
// Before submit → invalid
EXPECT_EQ(MQT_DDSIM_QDMI_device_job_get_results(
j.job, QDMI_JOB_RESULT_HIST_KEYS, 0, nullptr, nullptr),
Expand Down
14 changes: 12 additions & 2 deletions test/qdmi/devices/dd/helpers/circuits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ cx q[0], q[1];

inline constexpr const char* QASM3_MALFORMED = "Definitely not OpenQASM";

// A slightly heavier 5-qubit sampling circuit to prolong runtime slightly while
// A slightly heavier dynamic sampling circuit to prolong runtime slightly while
// remaining fast
inline constexpr auto QASM3_HEAVY_SAMPLING5 = R"(
inline constexpr auto QASM3_HEAVY_SAMPLING = R"(
OPENQASM 3;
include "stdgates.inc";
qubit[5] q;
Expand All @@ -58,6 +58,16 @@ cx q[1], q[2];
cx q[0], q[1];
// Measure all qubits
c = measure q;
// Add dynamic component
if (c == 3) {
rx(0.7) q[0];
ry(0.5) q[1];
rz(1.1) q[2];
ry(0.3) q[3];
rx(0.9) q[4];
}
// Measure all qubits again
c = measure q;
)";

} // namespace qdmi_test
2 changes: 1 addition & 1 deletion test/qdmi/devices/dd/job_lifecycle_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ TEST(JobLifecycle, FreeWhileRunningWaitsForCompletion) {
ASSERT_EQ(MQT_DDSIM_QDMI_device_session_create_device_job(s.session, &job),
QDMI_SUCCESS);
ASSERT_EQ(qdmi_test::setProgram(job, QDMI_PROGRAM_FORMAT_QASM3,
qdmi_test::QASM3_HEAVY_SAMPLING5),
qdmi_test::QASM3_HEAVY_SAMPLING),
QDMI_SUCCESS);
ASSERT_EQ(qdmi_test::setShots(job, 4096), QDMI_SUCCESS);
ASSERT_EQ(MQT_DDSIM_QDMI_device_job_submit(job), QDMI_SUCCESS);
Expand Down
Loading