Commit abec43a3 authored by Nguyen, Thien's avatar Nguyen, Thien
Browse files
parent 4b275a90
......@@ -199,7 +199,7 @@ void Circuit::load(std::istream &inStream) {
}
}
const int Circuit::depth() { return toGraph()->depth() - 2; }
const int Circuit::depth() { return toGraph()->depth(); }
const std::string Circuit::persistGraph() {
std::stringstream s;
......
......@@ -61,6 +61,7 @@ TEST(IRToGraphTester, checkSimple) {
EXPECT_EQ(graph->getVertexProperties(5).getString("name"), z->name());
EXPECT_EQ(graph->getVertexProperties(5).get<int>("layer"), 2);
EXPECT_EQ(f->depth(), 3);
}
TEST(IRToGraphTester, checkCNOTLadder) {
......@@ -92,6 +93,15 @@ TEST(IRToGraphTester, checkCNOTLadder) {
EXPECT_EQ(node.getString("name"), "CNOT");
EXPECT_EQ(node.get<int>("layer"), i - 1);
}
EXPECT_EQ(f->depth(), 4);
}
TEST(IRToGraphTester, checkSingleGate) {
auto f = std::make_shared<Circuit>("foo");
auto x = std::make_shared<X>(0);
f->addInstruction(x);
f->toGraph()->write(std::cout);
EXPECT_EQ(f->depth(), 1);
}
int main(int argc, char **argv) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment