Skip to content

Commit

Permalink
✅ add tests for corner cases
Browse files Browse the repository at this point in the history
Signed-off-by: burgholzer <burgholzer@me.com>
  • Loading branch information
burgholzer committed Oct 3, 2023
1 parent 1339dda commit 0eb9011
Showing 1 changed file with 80 additions and 0 deletions.
80 changes: 80 additions & 0 deletions test/test_equality.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,83 @@ TEST_F(EqualityTest, ExceptionInParallelThread) {
ec::EquivalenceCheckingManager ecm(qc1, qc1, config);
EXPECT_THROW(ecm.run(), std::invalid_argument);
}

TEST_F(EqualityTest, BothCircuitsEmptyAlternatingChecker) {
config.execution.runAlternatingChecker = true;
ec::EquivalenceCheckingManager ecm(qc1, qc2, config);
ecm.setApplicationScheme(ec::ApplicationSchemeType::Proportional);
ecm.run();
EXPECT_EQ(ecm.equivalence(), ec::EquivalenceCriterion::Equivalent);
}

TEST_F(EqualityTest, BothCircuitsEmptyConstructionChecker) {
config.execution.runConstructionChecker = true;
ec::EquivalenceCheckingManager ecm(qc1, qc2, config);
ecm.setApplicationScheme(ec::ApplicationSchemeType::Proportional);
ecm.run();
EXPECT_EQ(ecm.equivalence(), ec::EquivalenceCriterion::Equivalent);
}

TEST_F(EqualityTest, BothCircuitsEmptySimulationChecker) {
config.execution.runSimulationChecker = true;
ec::EquivalenceCheckingManager ecm(qc1, qc2, config);
ecm.setApplicationScheme(ec::ApplicationSchemeType::Proportional);
ecm.run();
EXPECT_EQ(ecm.equivalence(), ec::EquivalenceCriterion::Equivalent);
}

TEST_F(EqualityTest, BothCircuitsEmptyZXChecker) {
config.execution.runZXChecker = true;
ec::EquivalenceCheckingManager ecm(qc1, qc2, config);
ecm.setApplicationScheme(ec::ApplicationSchemeType::Proportional);
ecm.run();
EXPECT_EQ(ecm.equivalence(), ec::EquivalenceCriterion::Equivalent);
}

TEST_F(EqualityTest, OneCircuitEmptyAlternatingChecker) {
qc2.h(0);
qc2.x(0);
qc2.h(0);
qc2.z(0);
config.execution.runAlternatingChecker = true;
ec::EquivalenceCheckingManager ecm(qc1, qc2, config);
ecm.setApplicationScheme(ec::ApplicationSchemeType::Proportional);
ecm.run();
EXPECT_EQ(ecm.equivalence(), ec::EquivalenceCriterion::Equivalent);
}

TEST_F(EqualityTest, OneCircuitEmptyConstructionChecker) {
qc2.h(0);
qc2.x(0);
qc2.h(0);
qc2.z(0);
config.execution.runConstructionChecker = true;
ec::EquivalenceCheckingManager ecm(qc1, qc2, config);
ecm.setApplicationScheme(ec::ApplicationSchemeType::Proportional);
ecm.run();
EXPECT_EQ(ecm.equivalence(), ec::EquivalenceCriterion::Equivalent);
}

TEST_F(EqualityTest, OneCircuitEmptySimulationChecker) {
qc2.h(0);
qc2.x(0);
qc2.h(0);
qc2.z(0);
config.execution.runSimulationChecker = true;
ec::EquivalenceCheckingManager ecm(qc1, qc2, config);
ecm.setApplicationScheme(ec::ApplicationSchemeType::Proportional);
ecm.run();
EXPECT_EQ(ecm.equivalence(), ec::EquivalenceCriterion::ProbablyEquivalent);
}

TEST_F(EqualityTest, OneCircuitEmptyZXChecker) {
qc2.h(0);
qc2.x(0);
qc2.h(0);
qc2.z(0);
config.execution.runZXChecker = true;
ec::EquivalenceCheckingManager ecm(qc1, qc2, config);
ecm.setApplicationScheme(ec::ApplicationSchemeType::Proportional);
ecm.run();
EXPECT_EQ(ecm.equivalence(), ec::EquivalenceCriterion::Equivalent);
}

0 comments on commit 0eb9011

Please sign in to comment.