コード例 #1
0
        public void NativeOperationWithSimulatorSpecificEmulation()
        {
            void TestOne(IOperationFactory sim, string expected)
            {
                var actual = DefaultBody.Run(sim).Result;

                Assert.Equal(expected, actual);

                if (sim is IDisposable dis)
                {
                    dis.Dispose();
                }
            }

            TestOne(new QrackSimulator(), "Simulator");
        }
コード例 #2
0
 public override void SetChildrenScopes(NovaScope scope)
 {
     Test.SetScope(scope);
     if (DefaultBody != null)
     {
         DefaultBody.SetScope(scope);
     }
     foreach (var @case in Cases)
     {
         foreach (var test in @case.TestValues)
         {
             test.SetScope(scope);
         }
         @case.Body.SetScope(scope);
     }
 }
コード例 #3
0
        public void NativeOperationWithSimulatorSpecificEmulation()
        {
            void TestOne(IOperationFactory sim, string expected)
            {
                var actual = DefaultBody.Run(sim).Result;

                Assert.Equal(expected, actual);

                if (sim is IDisposable dis)
                {
                    dis.Dispose();
                }
            }

            TestOne(new QuantumSimulator(), "Simulator");
            TestOne(new ToffoliSimulator(), "Toffoli");
            TestOne(new ResourcesEstimator(), "hello");
        }
コード例 #4
0
 public override SysExpr ToExpression() => SysExpr.Switch(SwitchValue.ToExpression(), DefaultBody.ToExpression(),
                                                          Comparison, Cases.Map(x => x.ToSwitchCase()));