diff --git a/src/Simulation/Simulators.Tests/Circuits/ResourcesEstimator.qs b/src/Simulation/Simulators.Tests/Circuits/ResourcesEstimator.qs
index 8d34b42448c..b209762cc09 100644
--- a/src/Simulation/Simulators.Tests/Circuits/ResourcesEstimator.qs
+++ b/src/Simulation/Simulators.Tests/Circuits/ResourcesEstimator.qs
@@ -16,4 +16,24 @@ namespace Microsoft.Quantum.Simulation.Simulators.Tests
ResetAll([q[1], q[0]]);
}
}
+
+ // Tests for Depth and Width lower bounds
+ operation DepthDifferentQubits () : Unit
+ {
+ using(q = Qubit[3]) {
+ T(q[0]);
+ T(q[1]);
+ T(q[2]);
+ T(q[0]);
+ }
+ }
+ operation DepthVersusWidth () : Unit
+ {
+ using(q = Qubit()) {
+ T(q);
+ }
+ using(q = Qubit()) {
+ T(q);
+ }
+ }
}
diff --git a/src/Simulation/Simulators.Tests/ResourcesEstimatorTests.cs b/src/Simulation/Simulators.Tests/ResourcesEstimatorTests.cs
index 5fa9728a0d0..2128f458764 100644
--- a/src/Simulation/Simulators.Tests/ResourcesEstimatorTests.cs
+++ b/src/Simulation/Simulators.Tests/ResourcesEstimatorTests.cs
@@ -100,6 +100,43 @@ public void ToTSVTest()
var cliffords = rows.First(r => r.StartsWith("QubitClifford")).Split('\t');
Assert.Equal(2, cliffords.Length);
Assert.Equal("2", cliffords[1]);
+ }
+
+ ///
+ /// Shows that T gates on different qubits are counted for depth purposes as
+ /// executing in parallel.
+ ///
+ [Fact]
+ public void DepthDifferentQubitsTest()
+ {
+ var sim = new ResourcesEstimator();
+
+ // using(q = Qubit[3]) { T(q[0]); T(q[1]); T(q[3]); T(q[0]); }
+ DepthDifferentQubits.Run(sim).Wait();
+ var data = sim.Data;
+
+ Assert.Equal(4.0, data.Rows.Find("T")["Sum"]);
+ Assert.Equal(3.0, data.Rows.Find("Width")["Sum"]);
+ Assert.Equal(2.0, data.Rows.Find("Depth")["Sum"]);
+ }
+
+ ///
+ /// Documents that the width and depth statistics reflect independent lower
+ /// bounds for each (two T gates cannot be combined into a circuit of depth
+ /// one and width one).
+ ///
+ [Fact]
+ public void DepthVersusWidthTest()
+ {
+ var sim = new ResourcesEstimator();
+
+ // using(q = Qubit()) { T(q); } using(q = Qubit()) { T(q); } (yes, twice)
+ DepthVersusWidth.Run(sim).Wait();
+ var data = sim.Data;
+
+ Assert.Equal(2.0, data.Rows.Find("T")["Sum"]);
+ Assert.Equal(1.0, data.Rows.Find("Width")["Sum"]);
+ Assert.Equal(1.0, data.Rows.Find("Depth")["Sum"]);
}
}
}