当前位置: 首页>>代码示例>>C#>>正文


C# ExpressionInterpreterRunner.Execute方法代码示例

本文整理汇总了C#中ProtoScript.Runners.ExpressionInterpreterRunner.Execute方法的典型用法代码示例。如果您正苦于以下问题:C# ExpressionInterpreterRunner.Execute方法的具体用法?C# ExpressionInterpreterRunner.Execute怎么用?C# ExpressionInterpreterRunner.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ProtoScript.Runners.ExpressionInterpreterRunner的用法示例。


在下文中一共展示了ExpressionInterpreterRunner.Execute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: cyclicdependancy_726

        public void cyclicdependancy_726()
        {
            string src =
            @"a = 1..3;
                c = a;

                b = [ Imperative ]
                {
                    count = 0;
                        for ( i in a )
                        {
                            if ( i > 0 )
                                {
                                    a[count] = i + 1;
                                }
                                count = count+1;
                        }
                        return = a;
                }

                d = [ Imperative ]
                {
                    count2 = 0;
                        while (count2 <= 2 )
                        {
                            if ( a[count2] > 0 )
                                {
                                    a[count2] = a[count2] + 1;
                                }
                                count2 = count2+1;
                        }
                        return = a;
                }

                e = b;";
            fsr.PreStart(src, runnerConfig);
            DebugRunner.VMState vms = fsr.Step();

            fsr.Run();
            Assert.AreEqual(fsr.isEnded, true);
            ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core);
            ExecutionMirror mirror = watchRunner.Execute(@"a");
            TestFrameWork.Verify(mirror, "b", null, 0);
            TestFrameWork.VerifyRuntimeWarning(ProtoCore.RuntimeData.WarningID.kCyclicDependency);
        }
开发者ID:Benglin,项目名称:designscript,代码行数:45,代码来源:BasicTests.cs

示例2: TestWatchExpression1

        public void TestWatchExpression1()
        {
            // Execute and verify the main script in a debug session
            fsr.PreStart(
@"

a = 1;
b = 20;

");
            DebugRunner.VMState vms = fsr.Step();
            vms = fsr.Step();

            // Execute and verify the watch window expression script
            ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
            Assert.Throws(typeof(ProtoCore.Exceptions.CompileErrorsOccured), () =>
            {
                watchRunner.Execute(@"%");
            });

            watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
            ExecutionMirror mirror = watchRunner.Execute(@"a");
            Obj objExecVal = mirror.GetWatchValue();
            Assert.IsTrue((Int64)objExecVal.Payload == 1);


            vms = fsr.Step();

            // Execute and verify the watch window expression script
            watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
            Assert.Throws(typeof(ProtoCore.Exceptions.CompileErrorsOccured), () =>
            {
                watchRunner.Execute(@"%");
            });

            watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
            mirror = watchRunner.Execute(@"b");
            objExecVal = mirror.GetWatchValue();
            Assert.IsTrue((Int64)objExecVal.Payload == 20);
        }
开发者ID:norbertzsiros,项目名称:Dynamo,代码行数:40,代码来源:BasicTests.cs

示例3: TestWatchExpressionInNestedBlock2_519_2

        public void TestWatchExpressionInNestedBlock2_519_2()
        {
            // Execute and verify the defect IDE-519
            fsr.PreStart(
            @"class test
                {
                    f;
                    constructor test()
                    {
                    [Associative]
                        {
                            [Imperative]
                            {
                                i = 3;
                            }
                    // The value of 'i' cannot be inspected here.
                    // If this line is removed, then 'i' can be inspected.    
                            f = i;
                        }
                    }
                }

                a = test.test();
                b = a.f;

            ");

            DebugRunner.VMState vms = fsr.StepOver();//Line 5

            vms = fsr.Step();//Line 6
            vms = fsr.Step();//Line 6

            {
                // Get the value of "i".
                // This is to simulate the refresh of watch window as a result of "Step" button.
                ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
                ExecutionMirror mirror = watchRunner.Execute(@"i");
                Obj objExecVal = mirror.GetWatchValue();

                // It should not be available.
                Assert.AreNotEqual(null, objExecVal);
                Assert.AreEqual(3, (Int64)objExecVal.Payload);
            }
            vms = fsr.Step();
            vms = fsr.Step();
            vms = fsr.Step();
            vms = fsr.Step();
            vms = fsr.Step();
            vms = fsr.Step();
            //Line 7
            {
                // Get the value of "i".
                // This is to simulate the refresh of watch window as a result of "Step" button.
                ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
                ExecutionMirror mirror = watchRunner.Execute(@"b");
                Obj objExecVal = mirror.GetWatchValue();
                // It should not be available.

                Assert.AreEqual(null, objExecVal.Payload);

            }
        }
开发者ID:norbertzsiros,项目名称:Dynamo,代码行数:62,代码来源:BasicTests.cs

示例4: StepIn_inlineconditional_Imperative_722_3

        public void StepIn_inlineconditional_Imperative_722_3()
        {
            string src =
            @"[Imperative]
                {
                    def foo : int(a : int, b : int)
                    {
                        return = x = a > b ? a : b;
                    }
                    c1 = foo(10, 3);
    
                    Print(c1);
                }";
            fsr.PreStart(src);
            DebugRunner.VMState vms = fsr.Step();

            vms = fsr.Step();




            {

                ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
                ExecutionMirror mirror = watchRunner.Execute(@"a");
                Obj objExecVal = mirror.GetWatchValue();
                //TestFrameWork.Verify(mirror, "a", 10, 2);
                Assert.AreNotEqual(null, objExecVal);
                Assert.AreEqual(10, (Int64)objExecVal.Payload);

            }


            {
                ExpressionInterpreterRunner watchRunner2 = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
                ExecutionMirror mirror2 = watchRunner2.Execute(@"b");
                Obj objExecVal2 = mirror2.GetWatchValue();
                //TestFrameWork.Verify(mirror2, "b", 3, 2);
                Assert.AreNotEqual(null, objExecVal2);
                Assert.AreEqual(3, (Int64)objExecVal2.Payload);
            }

            vms = fsr.Step();
            vms = fsr.Step();
            {
                ExpressionInterpreterRunner watchRunner3 = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
                ExecutionMirror mirror3 = watchRunner3.Execute(@"x");
                Obj objExecVal3 = mirror3.GetWatchValue();
                //TestFrameWork.Verify(mirror3, "x", 10, 2);
                Assert.AreNotEqual(null, objExecVal3);
                Assert.AreEqual(10, (Int64)objExecVal3.Payload);
            }


            vms = fsr.Step();
            vms = fsr.Step();

            {
                ExpressionInterpreterRunner watchRunner4 = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
                ExecutionMirror mirror4 = watchRunner4.Execute(@"c1");
                Obj objExecVal4 = mirror4.GetWatchValue();
                TestFrameWork.Verify(mirror4, "c1", 10, 1);
            }

        }
开发者ID:norbertzsiros,项目名称:Dynamo,代码行数:65,代码来源:BasicTests.cs

示例5: SteppingOverinline_Imperative_723_6

        public void SteppingOverinline_Imperative_723_6()
        {
            string src =
            @"import(""DSCoreNodes.dll"");
                x = -330;
                [Imperative]
                {
    
                    a = x > 1 ? Math.Cos(60) : Math.Cos(45);
                    b = 22;
                }";
            fsr.PreStart(src);
            DebugRunner.VMState vms = fsr.Step();

            vms = fsr.StepOver();
            vms = fsr.StepOver();


            {

                ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
                ExecutionMirror mirror = watchRunner.Execute(@"a");
                Obj objExecVal = mirror.GetWatchValue();
                TestFrameWork.Verify(mirror, "a", 0.707106, 1);

            }
            vms = fsr.StepOver();
            {
                ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
                ExecutionMirror mirror = watchRunner.Execute(@"b");
                Obj objExecVal = mirror.GetWatchValue();
                TestFrameWork.Verify(mirror, "b", 22, 1);
            }

        }
开发者ID:norbertzsiros,项目名称:Dynamo,代码行数:35,代码来源:BasicTests.cs

示例6: TestWatchExpressionInClassMember1

        public void TestWatchExpressionInClassMember1()
        {
            // Execute and verify the defect IDE-476
            fsr.PreStart(
@"class A //line 1
{
    a : var;
    a2 : var;
    a4 : var;
    
    
    constructor A(x : var)
    {
        a2 = 3;
        a = x;
    }
    def update(x : var)
    {
        a = {
            x => a1;
            a1 > 10 ? true : false => a4;
            
        }
        return = x;
    }
}

a1 = A.A(0);
a1 = A.A();
x = a1.update(1);
y = { a1.a1, a1.a4 };
");

            DebugRunner.VMState vms = fsr.StepOver();//Line 24

            vms = fsr.Step();//Line 10

            // Get the value of "a2".
            {
                // This is to simulate the refresh of watch window as a result of "Step" button.
                ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
                ExecutionMirror mirror = watchRunner.Execute(@"a2");
                Obj objExecVal = mirror.GetWatchValue();

                // It should not be available.
                Assert.AreNotEqual(null, objExecVal);
                Assert.AreEqual(null, objExecVal.Payload);
            }

            vms = fsr.Step();//Line 11

            // Get the value of "a2".
            {
                // This is to simulate the refresh of watch window as a result of "Step" button.
                ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
                ExecutionMirror mirror = watchRunner.Execute(@"a2");
                Obj objExecVal = mirror.GetWatchValue();

                // It should not be available.
                Assert.AreEqual((Int64)objExecVal.Payload, 3);
            }

            vms = fsr.Step();//Line 12

            // Get the value of "a2".
            {
                // This is to simulate the refresh of watch window as a result of "Step" button.
                ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
                ExecutionMirror mirror = watchRunner.Execute(@"a2");
                Obj objExecVal = mirror.GetWatchValue();

                // It should not be available.
                Assert.AreEqual((Int64)objExecVal.Payload, 3);
            }

            vms = fsr.Step();//Line 24

            // Get the value of "a2".
            {
                // This is to simulate the refresh of watch window as a result of "Step" button.
                ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
                ExecutionMirror mirror = watchRunner.Execute(@"a2");
                Obj objExecVal = mirror.GetWatchValue();

                // It should not be available.
                Assert.AreNotEqual(null, objExecVal);
                Assert.AreEqual(null, objExecVal.Payload);
            }

            vms = fsr.Step();//Line 25

            // Get the value of "a2".
            {
                // This is to simulate the refresh of watch window as a result of "Step" button.
                ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
                ExecutionMirror mirror = watchRunner.Execute(@"a2");
                Obj objExecVal = mirror.GetWatchValue();

                // It should not be available.
                Assert.AreNotEqual(null, objExecVal);
//.........这里部分代码省略.........
开发者ID:norbertzsiros,项目名称:Dynamo,代码行数:101,代码来源:BasicTests.cs

示例7: TestWatchExpressionImperative4

        public void TestWatchExpressionImperative4()
        {
            // Execute and verify the main script in a debug session
            fsr.PreStart(
@"
[Associative]
{
}

[Imperative]
{
    eee = 43420;
}
");

            // First step should highlight closing bracket of "Associative" block.
            DebugRunner.VMState vms = fsr.StepOver();
            Assert.AreEqual(4, vms.ExecutionCursor.StartInclusive.LineNo);
            Assert.AreEqual(1, vms.ExecutionCursor.StartInclusive.CharNo);
            Assert.AreEqual(4, vms.ExecutionCursor.EndExclusive.LineNo);
            Assert.AreEqual(2, vms.ExecutionCursor.EndExclusive.CharNo);

            vms = fsr.StepOver(); // Highlight "eee = 43420;"
            Assert.AreEqual(8, vms.ExecutionCursor.StartInclusive.LineNo);
            Assert.AreEqual(5, vms.ExecutionCursor.StartInclusive.CharNo);
            Assert.AreEqual(8, vms.ExecutionCursor.EndExclusive.LineNo);
            Assert.AreEqual(17, vms.ExecutionCursor.EndExclusive.CharNo);

            // Get the value of "eee".
            {
                // This is to simulate the refresh of watch window as a result of "Step" button.
                ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
                ExecutionMirror mirror = watchRunner.Execute(@"eee");
                Obj objExecVal = mirror.GetWatchValue();

                // It should not be available.
                Assert.AreNotEqual(null, objExecVal);
                Assert.AreEqual(null, objExecVal.Payload);
            }

            vms = fsr.StepOver(); // Highlight closing bracket of "Imperative" block.
            Assert.AreEqual(9, vms.ExecutionCursor.StartInclusive.LineNo);
            Assert.AreEqual(1, vms.ExecutionCursor.StartInclusive.CharNo);
            Assert.AreEqual(9, vms.ExecutionCursor.EndExclusive.LineNo);
            Assert.AreEqual(2, vms.ExecutionCursor.EndExclusive.CharNo);

            // Get the value of "eee".
            {
                // This is to simulate the refresh of watch window as a result of "Step" button.
                ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
                ExecutionMirror mirror = watchRunner.Execute(@"eee");
                Obj objExecVal = mirror.GetWatchValue();

                // It should not be available.
                Assert.AreNotEqual(null, objExecVal);
                Assert.AreNotEqual(null, objExecVal.Payload);
                Assert.AreEqual("43420", objExecVal.Payload.ToString());
            }
        }
开发者ID:norbertzsiros,项目名称:Dynamo,代码行数:59,代码来源:BasicTests.cs

示例8: HighlightingFunctionsInArrayAssociative2_Defect_IDE_578

        public void HighlightingFunctionsInArrayAssociative2_Defect_IDE_578()
        {
            string src =
        @"class Dummy
{
    value : var;
    constructor Dummy()
    {
        value = 5;
    }
}

def GetValue(d : Dummy)
{
    return = d.value;
}

arr = {Dummy.Dummy(), Dummy.Dummy(), Dummy.Dummy(), Dummy.Dummy()};
val = GetValue(arr);";

            fsr.PreStart(src);
            DebugRunner.VMState vms = fsr.Step();

            Assert.AreEqual(15, vms.ExecutionCursor.StartInclusive.LineNo);
            Assert.AreEqual(1, vms.ExecutionCursor.StartInclusive.CharNo);
            Assert.AreEqual(15, vms.ExecutionCursor.EndExclusive.LineNo);
            Assert.AreEqual(68, vms.ExecutionCursor.EndExclusive.CharNo);

            vms = fsr.StepOver();

            ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
            ExecutionMirror mirror = watchRunner.Execute(@"arr[0].value");
            Obj o1 = mirror.GetWatchValue();
            Assert.AreEqual(5, (Int64)o1.Payload);

            watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
            mirror = watchRunner.Execute(@"arr[1].value");
            o1 = mirror.GetWatchValue();
            Assert.AreEqual(5, (Int64)o1.Payload);

            watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
            mirror = watchRunner.Execute(@"arr[2].value");
            o1 = mirror.GetWatchValue();
            Assert.AreEqual(5, (Int64)o1.Payload);

            watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
            mirror = watchRunner.Execute(@"arr[3].value");
            o1 = mirror.GetWatchValue();
            Assert.AreEqual(5, (Int64)o1.Payload);
        }
开发者ID:norbertzsiros,项目名称:Dynamo,代码行数:50,代码来源:BasicTests.cs

示例9: TestWatchExpressionInFunction

        public void TestWatchExpressionInFunction()
        {
            // Execute and verify the main script in a debug session
            fsr.PreStart(
@"
def foo()
{
    aaa = 4;
    return = null;
}

bbb = foo();
");

            // First step should bring the exec cursor to "bbb = foo()".
            DebugRunner.VMState vms = fsr.StepOver();
            Assert.AreEqual(8, vms.ExecutionCursor.StartInclusive.LineNo);
            Assert.AreEqual(1, vms.ExecutionCursor.StartInclusive.CharNo);
            Assert.AreEqual(8, vms.ExecutionCursor.EndExclusive.LineNo);
            Assert.AreEqual(13, vms.ExecutionCursor.EndExclusive.CharNo);

            vms = fsr.Step(); // Highlight "aaa = 4;"
            Assert.AreEqual(4, vms.ExecutionCursor.StartInclusive.LineNo);
            Assert.AreEqual(5, vms.ExecutionCursor.StartInclusive.CharNo);
            Assert.AreEqual(4, vms.ExecutionCursor.EndExclusive.LineNo);
            Assert.AreEqual(13, vms.ExecutionCursor.EndExclusive.CharNo);

            // Get the value of "aaa".
            {
                // This is to simulate the refresh of watch window as a result of "Step" button.
                ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
                ExecutionMirror mirror = watchRunner.Execute(@"aaa");
                Obj objExecVal = mirror.GetWatchValue();

                // It should not be available.
                Assert.AreNotEqual(null, objExecVal);
                Assert.AreEqual(null, objExecVal.Payload);
            }

            vms = fsr.StepOver(); // Highlight "return = null;"
            Assert.AreEqual(5, vms.ExecutionCursor.StartInclusive.LineNo);
            Assert.AreEqual(5, vms.ExecutionCursor.StartInclusive.CharNo);
            Assert.AreEqual(5, vms.ExecutionCursor.EndExclusive.LineNo);
            Assert.AreEqual(19, vms.ExecutionCursor.EndExclusive.CharNo);

            // Get the value of "aaa".
            {
                // This is to simulate the refresh of watch window as a result of "Step" button.
                ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
                ExecutionMirror mirror = watchRunner.Execute(@"aaa");
                Obj objExecVal = mirror.GetWatchValue();

                // It should not be available.
                Assert.AreNotEqual(null, objExecVal);
                Assert.AreNotEqual(null, objExecVal.Payload);
                Assert.AreEqual("4", objExecVal.Payload.ToString());
            }
        }
开发者ID:norbertzsiros,项目名称:Dynamo,代码行数:58,代码来源:BasicTests.cs

示例10: TestWatchExpression5

        public void TestWatchExpression5()
        {
            string sourceCode = @"
a = { 1, 0, 0.0 };  // Line 2
b = { a, 1 };       // Line 3

[Imperative]        // Line 5
{
    a[1] = 1;       // Line 7
    m = a;          // Line 8
}                   // Line 9
";
            fsr.PreStart(sourceCode);
            DebugRunner.VMState vms = fsr.StepOver();
            Assert.AreEqual(2, vms.ExecutionCursor.StartInclusive.LineNo);
            vms = fsr.StepOver();
            Assert.AreEqual(3, vms.ExecutionCursor.StartInclusive.LineNo);
            vms = fsr.StepOver();
            Assert.AreEqual(7, vms.ExecutionCursor.StartInclusive.LineNo);
            vms = fsr.StepOver();
            Assert.AreEqual(8, vms.ExecutionCursor.StartInclusive.LineNo);
            vms = fsr.StepOver();
            Assert.AreEqual(9, vms.ExecutionCursor.StartInclusive.LineNo);

            // Get the value of "m[0]".
            {
                // This is to simulate the refresh of watch window as a result of "Step" button.
                ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
                ExecutionMirror mirror = watchRunner.Execute(@"m[0]");
                Obj objExecVal = mirror.GetWatchValue();

                // It should be "1".
                Assert.AreNotEqual(null, objExecVal);
                Assert.AreNotEqual(null, objExecVal.Payload);
                Assert.AreEqual("1", objExecVal.Payload.ToString());
            }

            vms = fsr.StepOver(); // Causes "b = { a, 1 };" to execute.
            Assert.AreEqual(3, vms.ExecutionCursor.StartInclusive.LineNo);

            // Get the value of "m[0]".
            {
                // This is to simulate the refresh of watch window as a result of "Step" button.
                ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
                ExecutionMirror mirror = watchRunner.Execute(@"m[0]");
                Obj objExecVal = mirror.GetWatchValue();

                // It should still be "1".
                Assert.AreNotEqual(null, objExecVal);
                // Assert.AreEqual(null, objExecVal.Payload);
            }
        }
开发者ID:norbertzsiros,项目名称:Dynamo,代码行数:52,代码来源:BasicTests.cs

示例11: TestWatchExpression4

        public void TestWatchExpression4()
        {
            // Execute and verify the main script in a debug session
            fsr.PreStart(
@"
def f : int(i : int, j : int)
{
    a = 5;
    return = 7;
}

a = f(1, 2);
b = 2;
c = 3;
");

            // First step should bring the exec cursor to "a = f(1, 2)".
            DebugRunner.VMState vms = fsr.StepOver();

            {
                // This is to simulate the event when "a" is added into the watch window
                // before it gets assigned a value. This should not cause subsequent stepping
                // to go wrong.
                ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
                ExecutionMirror mirror = watchRunner.Execute(@"a");
                Obj objExecVal = mirror.GetWatchValue();

                // This should not return a value since "a" is unassigned now.
                Assert.AreNotEqual(null, objExecVal);
                Assert.AreEqual(null, objExecVal.Payload);
            }

            // Second step should bring it to "b = 2;".
            vms = fsr.StepOver();

            {
                // This is to simulate the refresh of watch window as a result of "Step" button.
                ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
                ExecutionMirror mirror = watchRunner.Execute(@"a");
                Obj objExecVal = mirror.GetWatchValue();

                // Now "a" should be "7" as the result of assignment from return value of "f".
                Assert.AreNotEqual(null, objExecVal);
                Assert.AreNotEqual(null, objExecVal.Payload);
                Assert.AreEqual("7", objExecVal.Payload.ToString());
            }

            // Third step should bring it to "c = 3;".
            vms = fsr.StepOver();

            // Final step ends the debug session.
            vms = fsr.StepOver();
            Assert.AreEqual(true, vms.isEnded);
        }
开发者ID:norbertzsiros,项目名称:Dynamo,代码行数:54,代码来源:BasicTests.cs

示例12: TestWatchExpressionInNestedBlock1

        public void TestWatchExpressionInNestedBlock1()
        {
            // Execute and verify the defect IDE-487
            fsr.PreStart(
@"class test { a = 1; } //line 1

c1 = [Imperative]
{
    a = test.test();
    b = [Associative]
    {
        return = test.test();
    }
    
    c = a.a + b.a;
    return = c;
}

c2 = [Associative]
{
    a = test.test();
    b = [Imperative]
    {
        return = test.test();
    }
    
    c = a.a + b.a;
    return = c;
}
");

            DebugRunner.VMState vms = fsr.StepOver();//Line 5

            vms = fsr.Step();//Line 1

            {
                // 1. Get the value of "a".
                // This is to simulate the refresh of watch window as a result of "Step" button.
                ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
                ExecutionMirror mirror = watchRunner.Execute(@"a");
                Obj objExecVal = mirror.GetWatchValue();

                // It should not be available.
                Assert.AreNotEqual(null, objExecVal);
                Assert.AreEqual(null, objExecVal.Payload);
            }

            {
                // 2. Get the value of "b".
                // This is to simulate the refresh of watch window as a result of "Step" button.
                ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
                ExecutionMirror mirror = watchRunner.Execute(@"b");
                Obj objExecVal = mirror.GetWatchValue();

                // It should not be available.
                Assert.AreNotEqual(null, objExecVal);
                Assert.AreEqual(null, objExecVal.Payload);
            }

            {
                // 3.Get the value of "c".
                // This is to simulate the refresh of watch window as a result of "Step" button.
                ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
                ExecutionMirror mirror = watchRunner.Execute(@"c");
                Obj objExecVal = mirror.GetWatchValue();

                // It should not be available.
                Assert.AreNotEqual(null, objExecVal);
                Assert.AreEqual(null, objExecVal.Payload);
            }


            vms = fsr.Step();//Line 5

            {
                // 1. Get the value of "a".
                // This is to simulate the refresh of watch window as a result of "Step" button.
                ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
                ExecutionMirror mirror = watchRunner.Execute(@"a");
                Obj objExecVal = mirror.GetWatchValue();

                // It should not be available.
                Assert.AreNotEqual(null, objExecVal);
                Assert.AreEqual(null, objExecVal.Payload);
            }

            {
                // 2. Get the value of "b".
                // This is to simulate the refresh of watch window as a result of "Step" button.
                ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
                ExecutionMirror mirror = watchRunner.Execute(@"b");
                Obj objExecVal = mirror.GetWatchValue();

                // It should not be available.
                Assert.AreNotEqual(null, objExecVal);
                Assert.AreEqual(null, objExecVal.Payload);
            }

            {
                // 3.Get the value of "c".
//.........这里部分代码省略.........
开发者ID:norbertzsiros,项目名称:Dynamo,代码行数:101,代码来源:BasicTests.cs

示例13: Simple_debug

        public void Simple_debug()
        {
            // Execute and verify the main script in a debug session
            fsr.PreStart(
@"
class Tuple4

{

  
    

    public def Equals : bool (other : Tuple4)

    {

        return =true;
          

    }

}
                
t1 = Tuple4.Tuple4();
t2 = Tuple4.Tuple4();
b = t1.Equals(t2);
           
");

            DebugRunner.VMState vms = fsr.Step();

            vms = fsr.StepOver();
            vms = fsr.StepOver();
            vms = fsr.StepOver();

            ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
            ExecutionMirror mirror = watchRunner.Execute(@"b");
            Obj objExecVal = mirror.GetWatchValue();
            TestFrameWork.Verify(mirror, "b", true, 0);


        }
开发者ID:norbertzsiros,项目名称:Dynamo,代码行数:42,代码来源:BasicTests.cs

示例14: UseCase_Robert_simple_numeric_associative_2

        public void UseCase_Robert_simple_numeric_associative_2()
        {
            // Execute and verify the main script in a debug session
            fsr.PreStart(
@"
import(""ProtoGeometry.dll"");

a : int;
b : int;

[Associative]
{
    a = 10;
    b = 2 * a;
    a = a + 1;
}
           
");


            DebugRunner.VMState vms = fsr.Step();

            ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
            ExecutionMirror mirror = watchRunner.Execute(@"a");
            TestFrameWork.Verify(mirror, "a", null, 0);

            vms = fsr.StepOver();

            TestFrameWork.Verify(mirror, "a", 10, 0);

            vms = fsr.Step();
            TestFrameWork.Verify(mirror, "b", 20, 0);

            vms = fsr.Step();
            TestFrameWork.Verify(mirror, "a", 11, 0);

            vms = fsr.Step();
            TestFrameWork.Verify(mirror, "b", 22, 0);

        }
开发者ID:norbertzsiros,项目名称:Dynamo,代码行数:40,代码来源:BasicTests.cs

示例15: Defect_IDE_464

        public void Defect_IDE_464()
        {
            string src =
        @"class A
            {
                a : int[];
            }
            def foo(x1 : A)
            {
                x1.a = -1;
                return = x1;
            }
            a1 = A.A();
            a1.a = { 1, 2 };
            b = a1.a;
            a1.a = -1;";

            fsr.PreStart(src);
            fsr.Step(); // a1 = A.A();

            DebugRunner.VMState vms = fsr.Step();   // a : int[];
            fsr.Step();
            fsr.Step();
            fsr.Step();
            vms = fsr.Step();   // a1.a = -1;

            ExpressionInterpreterRunner watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
            ExecutionMirror mirror = watchRunner.Execute(@"b[0]");
            Obj o1 = mirror.GetWatchValue();
            Assert.AreEqual(1, (Int64)o1.Payload);

            watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
            mirror = watchRunner.Execute(@"b[1]");
            o1 = mirror.GetWatchValue();
            Assert.AreEqual(2, (Int64)o1.Payload);

            fsr.Step();
            vms = fsr.Step();

            watchRunner = new ExpressionInterpreterRunner(core, fsr.runtimeCore);
            mirror = watchRunner.Execute(@"b[0]");
            o1 = mirror.GetWatchValue();
            Assert.AreEqual(-1, (Int64)o1.Payload);
        }
开发者ID:norbertzsiros,项目名称:Dynamo,代码行数:44,代码来源:BasicTests.cs


注:本文中的ProtoScript.Runners.ExpressionInterpreterRunner.Execute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。