public void VerifyTracingMultipleOperationsTest() { ResourcesEstimator sim = new ResourcesEstimator(); Operation_1_of_2.Run(sim).Wait(); DataTable data1 = sim.Data; Assert.Equal(1.0, data1.Rows.Find("CNOT")["Sum"]); Assert.Equal(1.0, data1.Rows.Find("QubitClifford")["Sum"]); Assert.Equal(1.0, data1.Rows.Find("T")["Sum"]); Assert.Equal(0.0, data1.Rows.Find("R")["Sum"]); Assert.Equal(0.0, data1.Rows.Find("Measure")["Sum"]); Assert.Equal(2.0, data1.Rows.Find("QubitCount")["Sum"]); Operation_2_of_2.Run(sim).Wait(); DataTable data2 = sim.Data; // Aggregated stats for both operations. Assert.Equal(1.0 + 2.0, data2.Rows.Find("CNOT")["Sum"]); Assert.Equal(1.0 + 1.0, data2.Rows.Find("QubitClifford")["Sum"]); Assert.Equal(1.0 + 0.0, data2.Rows.Find("T")["Sum"]); Assert.Equal(0.0 + 1.0, data2.Rows.Find("R")["Sum"]); Assert.Equal(0.0 + 1.0, data2.Rows.Find("Measure")["Sum"]); Assert.Equal(2.0 + 3.0, data2.Rows.Find("QubitCount")["Sum"]); Assert.Equal(System.Math.Max(2.0, 3.0), data2.Rows.Find("QubitCount")["Max"]); // Run again to confirm two operations isn't the limit! VerySimpleEstimate.Run(sim).Wait(); DataTable data3 = sim.Data; Assert.Equal(2.0 + 3.0 + 3.0, data3.Rows.Find("QubitCount")["Sum"]); Assert.Equal(3.0, data3.Rows.Find("QubitCount")["Max"]); }
public void VerifyDataTest() { var sim = new ResourcesEstimator(); VerySimpleEstimate.Run(sim).Wait(); var data = sim.Data; Assert.Equal(1.0, data.Rows.Find("CNOT")["Sum"]); Assert.Equal(0.0, data.Rows.Find("R")["Sum"]); Assert.Equal(2.0, data.Rows.Find("QubitClifford")["Sum"]); Assert.Equal(3.0, data.Rows.Find("Width")["Sum"]); }
public void ToTSVTest() { var sim = new ResourcesEstimator(); VerySimpleEstimate.Run(sim).Wait(); var data = sim.ToTSV(); Console.WriteLine(data); Assert.NotNull(data); var rows = data.Split('\n'); Assert.Equal(10, rows.Length); var cols = rows[0].Split('\t'); Assert.Equal("Metric", cols[0].Trim()); Assert.Equal(3, cols.Length); var cliffords = rows.First(r => r.StartsWith("QubitClifford")).Split('\t'); Assert.Equal(3, cliffords.Length); Assert.Equal("2", cliffords[1]); }