コード例 #1
0
ファイル: CSFFITest.cs プロジェクト: RobertiF/Dynamo
 protected int ExecuteAndVerify(String code, ValidationData[] data, Dictionary<string, Object> context, out int nErrors)
 {
     ProtoCore.Core core = Setup();
     ProtoScript.Runners.ProtoScriptTestRunner fsr = new ProtoScript.Runners.ProtoScriptTestRunner();
     ExecutionMirror mirror = fsr.Execute(code, core, context);
     int nWarnings = core.RuntimeStatus.WarningCount;
     nErrors = core.BuildStatus.ErrorCount;
     if (data == null)
     {
         core.Cleanup();
         return nWarnings + nErrors;
     }
     TestFrameWork thisTest = new TestFrameWork();
     foreach (var item in data)
     {
         if (item.ExpectedValue == null)
         {
             object nullOb = null;
             TestFrameWork.Verify(mirror, item.ValueName, nullOb, item.BlockIndex);
         }
         else
         {
             TestFrameWork.Verify(mirror, item.ValueName, item.ExpectedValue, item.BlockIndex);
         }
     }
     core.Cleanup();
     return nWarnings + nErrors;
 }
コード例 #2
0
ファイル: CallsiteRegen.cs プロジェクト: ankushraizada/Dynamo
            public void Setup()
            {
                testFx = new TestFrameWork();
                astLiveRunner = new ProtoScript.Runners.LiveRunner();
                FFITarget.IncrementerTracedClass.ResetForNextTest();

            }
コード例 #3
0
ファイル: TypeSystemTests.cs プロジェクト: hipigod/Dynamo
        public void TestAssignFailDueToRank()
        {
            string code =
                @"
a:int = {3};
";
            var mirror = thisTest.RunScriptSource(code);

            TestFrameWork.Verify(mirror, "a", null);
        }
コード例 #4
0
            public void TestGuidStability()
            {
                //Test to ensure that the first time the code is executed the wasTraced attribute is marked as false
                //and the secodn time it is marked as true


                string setupCode =
                    @"import(""FFITarget.dll""); 
x = 0; 
mtcA = IncrementerTracedClass.IncrementerTracedClass(x); 
mtcAID = mtcA.ID;
mtcAWasTraced = mtcA.WasCreatedWithTrace(); ";



                // Create 2 CBNs

                List <Subtree> added = new List <Subtree>();


                // Simulate a new new CBN
                Guid guid1 = System.Guid.NewGuid();

                added.Add(ProtoTestFx.TD.TestFrameWork.CreateSubTreeFromCode(guid1, setupCode));

                var syncData = new GraphSyncData(null, added, null);

                astLiveRunner.UpdateGraph(syncData);

                TestFrameWork.AssertValue("mtcAID", 0, astLiveRunner);
                TestFrameWork.AssertValue("mtcAWasTraced", false, astLiveRunner);


                var core          = astLiveRunner.RuntimeCore;
                var ctorCallsites = core.RuntimeData.CallsiteCache.Values.Where(c => c.MethodName == "IncrementerTracedClass");

                Assert.IsTrue(ctorCallsites.Count() == 1);
                Guid guid = ctorCallsites.First().CallSiteID;



                ExecuteMoreCode("x = 1;");

                // Verify that a is re-executed
                TestFrameWork.AssertValue("mtcAID", 0, astLiveRunner);
                TestFrameWork.AssertValue("mtcAWasTraced", true, astLiveRunner);

                //Verify that the GUID has been adjusted
                var ctorCallsites2 = core.RuntimeData.CallsiteCache.Values.Where(c => c.MethodName == "IncrementerTracedClass");

                Assert.IsTrue(ctorCallsites2.Count() == 1);
                Guid guid2 = ctorCallsites2.First().CallSiteID;

                Assert.AreEqual(guid, guid2);
            }
コード例 #5
0
ファイル: TestScope.cs プロジェクト: auras3590/Dynamo
        public void T031_Defect_1450594()
        {
            string          src    = @"f;p;q;x;y1;z;y2;
[Imperative]
{
   a = 2;
    [Associative]
    {
        
        i = 3;
    }
    f = i;
}
[Associative]
{
	def foo1 ( i )
	{
		x = 1;
		return = x;
	}
	p = x;
	q = a;
}
y = 1;
[Imperative]
{
   def foo ( i )
   {
		x = 2;
		if( i < x ) 
		{
		    y = 3;
			return = y * i;
		}
		return = y;
	}
	x = y;
	y1 = foo ( 1 );
	y2 = foo ( 3 );
	z = x * 2;
	
}
";
            ExecutionMirror mirror = thisTest.RunScriptSource(src);

            thisTest.Verify("f", null);

            thisTest.Verify("p", 2);
            thisTest.Verify("q", null);
            thisTest.Verify("x", 2);
            thisTest.Verify("y1", 3);
            thisTest.Verify("z", 4);
            thisTest.Verify("y2", 3);
            TestFrameWork.VerifyBuildWarning(ProtoCore.BuildData.WarningID.IdUnboundIdentifier);
        }
コード例 #6
0
        public void TestNull02()
        {
            String code =
                @"[Imperative]
                {
                    a = b;
                }";

            thisTest.RunScriptSource(code);
            TestFrameWork.VerifyBuildWarning(ProtoCore.BuildData.WarningID.IdUnboundIdentifier);
        }
コード例 #7
0
        public void Regress_1467091()
        {
            ExecutionMirror mirror = thisTest.RunScriptFile(testCasePath, "Regress_1467091.ds");

            TestFrameWork.VerifyBuildWarning(ProtoCore.BuildData.WarningID.kIdUnboundIdentifier);
            if (!core.Options.SuppressFunctionResolutionWarning)
            {
                TestFrameWork.VerifyBuildWarning(ProtoCore.BuildData.WarningID.kFunctionNotFound);
            }
            thisTest.Verify("y1", null);
            thisTest.Verify("y2", null);
        }
コード例 #8
0
        public void functionNotFound_1467444()
        {
            String code =
                @"
                a = foo();
            ";
            string errmsg = "";

            ExecutionMirror mirror = thisTest.VerifyRunScriptSource(code, errmsg);

            TestFrameWork.VerifyBuildWarning(ProtoCore.BuildData.WarningID.kFunctionNotFound);
        }
コード例 #9
0
ファイル: Assignment.cs プロジェクト: hipigod/Dynamo
        public void T40_Defect_1450552()
        {
            string          src    = @"a;
[Imperative]
{
 a = b;
}";
            ExecutionMirror mirror = thisTest.RunScriptSource(src);

            Assert.IsTrue(mirror.GetValue("a").DsasmValue.IsNull);
            TestFrameWork.VerifyBuildWarning(ProtoCore.BuildData.WarningID.kIdUnboundIdentifier);
        }
コード例 #10
0
ファイル: AssocAssignment.cs プロジェクト: yaoclee/Dynamo
        public void T03_TestAssignmentToUndefinedVariables_negative()
        {
            string          src    = @"a;
[Associative]
{
    a = b;
}";
            ExecutionMirror mirror = thisTest.RunScriptSource(src);

            thisTest.Verify("a", null);
            TestFrameWork.VerifyBuildWarning(ProtoCore.BuildData.WarningID.IdUnboundIdentifier);
        }
コード例 #11
0
ファイル: AssocAssignment.cs プロジェクト: yaoclee/Dynamo
        public void T40_Defect_1450552()
        {
            string          src    = @"a;
[Associative]
{
 a = b;
}";
            ExecutionMirror mirror = thisTest.RunScriptSource(src);

            thisTest.Verify("a", null);
            TestFrameWork.VerifyBuildWarning(ProtoCore.BuildData.WarningID.IdUnboundIdentifier);
        }
コード例 #12
0
ファイル: StringTest.cs プロジェクト: auras3590/Dynamo
        public void TestStringIndexing05()
        {
            String code =
                @"
                s = """";
                r = s[0];
                ";

            thisTest.RunScriptSource(code);
            // Will get an index out of range runtime warning
            TestFrameWork.VerifyRuntimeWarning(ProtoCore.Runtime.WarningID.OverIndexing);
        }
コード例 #13
0
ファイル: TypeSystemTests.cs プロジェクト: tylerputnam/Dynamo
        public void MinimalStringTest()
        {
            String code =
                @"a = ""Callsite is an angry bird"";
b ="""";
"                                                              ;
            var        mirror = thisTest.RunScriptSource(code);
            StackValue sv     = mirror.GetRawFirstValue("a");
            StackValue svb    = mirror.GetRawFirstValue("b");

            TestFrameWork.Verify(mirror, "a", "Callsite is an angry bird");
        }
コード例 #14
0
ファイル: TypeSystemTests.cs プロジェクト: tylerputnam/Dynamo
        public void SimpleUpCast()
        {
            String code =
                @"def foo(x:int[])
{
    return = x;
}
r = foo(1);"                                                       ;
            var mirror = thisTest.RunScriptSource(code);

            TestFrameWork.Verify(mirror, "r", new Object[] { 1 });
        }
コード例 #15
0
ファイル: Assignment.cs プロジェクト: hipigod/Dynamo
        public void T03_TestAssignmentToUndefinedVariables_negative()
        {
            string          src    = @"a;
[Imperative]
{
    a = b;
}";
            ExecutionMirror mirror = thisTest.RunScriptSource(src);

            Assert.IsTrue(mirror.GetValue("a").DsasmValue.IsNull);
            TestFrameWork.VerifyBuildWarning(ProtoCore.BuildData.WarningID.kIdUnboundIdentifier);
        }
コード例 #16
0
ファイル: Update.cs プロジェクト: tshcha/Dynamo
        public void T011_Update_Of_Variable_To_Null()
        {
            string src = @"x = 1;
y = 2/x;
x = 0;
v1 = 2;
v2 = v1 * 3;
v1 = null;";

            thisTest.VerifyRunScriptSource(src);
            TestFrameWork.AssertInfinity("y");
            thisTest.Verify("v2", null);
        }
コード例 #17
0
        public void TestArrayOverIndexing01()
        {
            string code = @"
[Imperative]
{
    arr2 = [1, 2, 3];
    t = arr2[1][0];
}
";

            thisTest.RunScriptSource(code);
            TestFrameWork.VerifyRuntimeWarning(ProtoCore.Runtime.WarningID.MethodResolutionFailure);
        }
コード例 #18
0
ファイル: StringTest.cs プロジェクト: tshcha/Dynamo
        public void TestStringIndexing05()
        {
            // TODO pratapa: String indexing is broken post Dictionary changes
            String code =
                @"
                s = """";
                r = s[0];
                ";

            thisTest.RunScriptSource(code);
            // Will get an index out of range runtime warning
            TestFrameWork.VerifyRuntimeWarning(ProtoCore.Runtime.WarningID.OverIndexing);
        }
コード例 #19
0
ファイル: StringTest.cs プロジェクト: auras3590/Dynamo
        public void T03_Defect_UndefinedType()
        {
            string          code   = @"
def foo(x:S)
{
	return = x;
}
b = foo(1);
";
            ExecutionMirror mirror = thisTest.RunScriptSource(code);
            object          v1     = null;

            TestFrameWork.Verify(mirror, "b", v1, 0);
        }
コード例 #20
0
ファイル: Update.cs プロジェクト: tshcha/Dynamo
        public void TestCyclicDependency01()
        {
            string          code   = @"
b = 1;
a = b + 1;
b = a;";
            ExecutionMirror mirror = thisTest.RunScriptSource(code);

            TestFrameWork.VerifyBuildWarning(ProtoCore.BuildData.WarningID.InvalidStaticCyclicDependency);
            Object n1 = null;

            thisTest.Verify("a", n1);
            thisTest.Verify("b", n1);
        }
コード例 #21
0
ファイル: EventTest.cs プロジェクト: santom/designscript
        public void RunPropertyChangedForRunMode()
        {
            string code =
                @"import (Foo from ""ProtoTest.dll"");
foo = Foo.GetInstance();              
foo.ID = 17;
id = foo.ID;
Foo.SetID(foo, 41);               
";
            var testRunner = new TestFrameWork();

            testRunner.RunScriptSource(code);
            testRunner.Verify("id", 41);
        }
コード例 #22
0
ファイル: TypeSystemTests.cs プロジェクト: tylerputnam/Dynamo
        public void Rep2()
        {
            String code =
                @"
def foo(i:int)
{
 return = 3.5; 
}
a=foo(3);
"                                                                ;
            var mirror = thisTest.RunScriptSource(code);

            TestFrameWork.Verify(mirror, "a", 3.5);
        }
コード例 #23
0
ファイル: TypeSystemTests.cs プロジェクト: tylerputnam/Dynamo
        public void Rep4()
        {
            String code =
                @"
def foo(i:int)
{
 return = 3.5; 
}
a=foo({{0, 1}});
"                                                                       ;
            var mirror = thisTest.RunScriptSource(code);

            TestFrameWork.Verify(mirror, "a", new object[] { new object[] { 3.5, 3.5 } });
        }
コード例 #24
0
ファイル: TypeSystemTests.cs プロジェクト: tylerputnam/Dynamo
        public void ArrayConvTest()
        {
            String code =
                @"
def foo:int[]()
{
 return = {3.5}; 
}
a=foo();
"                                                                  ;
            var mirror = thisTest.RunScriptSource(code);

            TestFrameWork.Verify(mirror, "a", new Object[] { 4 });
        }
コード例 #25
0
ファイル: TypeSystemTests.cs プロジェクト: tylerputnam/Dynamo
        public void TestVarReturnOnArrayStructure()
        {
            string code =
                @"
def foo : var[] (x)
{
return=x;
}
y = foo(3);
"                                                                 ;
            var mirror = thisTest.RunScriptSource(code);

            TestFrameWork.Verify(mirror, "y", new object[] { 3 });
        }
コード例 #26
0
        public void Regress_1467107()
        {
            string          code   = @"
def foo(x:int)
{
    return =  x + 1;
}
m=null;
y = m.foo(2);";
            ExecutionMirror mirror = thisTest.RunScriptSource(code);

            thisTest.Verify("y", null);
            TestFrameWork.VerifyRuntimeWarning(ProtoCore.Runtime.WarningID.DereferencingNonPointer);
        }
コード例 #27
0
ファイル: EventTest.cs プロジェクト: Steell/Dynamo
        public void RunPropertyChangedNegative()
        {
            string code =
                @"import (Foo from ""ProtoTest.dll"");
foo = Foo.GetInstance();              
foo.ID = 17;
id = foo.ID;
id = bar.ID;        // Redefinition
Foo.SetID(foo, 41);               
"                                                                                                                                                                                               ;
            var testRunner = new TestFrameWork();

            testRunner.RunScriptSource(code);
            testRunner.Verify("id", null);
        }
コード例 #28
0
ファイル: TypeSystemTests.cs プロジェクト: tylerputnam/Dynamo
        public void TestIntDispatch()
        {
            string code =
                @"
def foo (x : int[])
{
return=x;
}
y = foo(3);
z = foo({3});"                                                                 ;
            var mirror = thisTest.RunScriptSource(code);

            TestFrameWork.Verify(mirror, "y", new object[] { 3 });
            TestFrameWork.Verify(mirror, "z", new object[] { 3 });
        }
コード例 #29
0
ファイル: StringTest.cs プロジェクト: auras3590/Dynamo
        public void T01_String_IfElse_4()
        {
            string          code   = @"
a = ""a"";
b = ""a"";
result = 
[Imperative]
{
	if (a ==b) return = true;
	else return = false;
}";
            ExecutionMirror mirror = thisTest.RunScriptSource(code);

            TestFrameWork.Verify(mirror, "result", true, 0);
        }
コード例 #30
0
        public void TestArrayOverIndexing01()
        {
            string code = @"
[Imperative]
{
    arr1 = {true, false};
    arr2 = {1, 2, 3};
    arr3 = {false, true};
    t = arr2[1][0];
}
";

            thisTest.RunScriptSource(code);
            TestFrameWork.VerifyRuntimeWarning(ProtoCore.Runtime.WarningID.OverIndexing);
        }
コード例 #31
0
ファイル: TypeSystemTests.cs プロジェクト: tylerputnam/Dynamo
        public void Rep5()
        {
            //Assert.Fail("DNL-1467183 Sprint24: rev 3163 : replication on nested array is outputting extra brackets in some cases");
            String code =
                @"
def foo(i:int)
{
 return = 3.5; 
}
a=foo({{0, 1}, 1});
"                                                                          ;
            var mirror = thisTest.RunScriptSource(code);

            TestFrameWork.Verify(mirror, "a", new object[] { new object[] { 3.5, 3.5 }, 3.5 });
        }
コード例 #32
0
ファイル: TypeSystemTests.cs プロジェクト: tylerputnam/Dynamo
        public void StatementArrayTest2()
        {
            //DNL-1467221 Sprint 26 - Rev 3345 type conversion to array as return type does not get converted
            String code =
                @"
a;
[Associative]
{ 
a : double[] = 1.5;
}
"                                                             ;
            var mirror = thisTest.RunScriptSource(code);

            TestFrameWork.Verify(mirror, "a", new object[] { 1.5 });
        }
コード例 #33
0
ファイル: Replication.cs プロジェクト: Benglin/designscript
        public void TestIncompatibleTypes()
        {
            String code =
            @"def fun : double(arg: int) { return = 4; }

            class A
            {
            x : int;
            constructor A(_x : int) { x = _i; }
            }

            v1 = A.A(0);
            v2 = fun(4);

            v3 = fun ({0, 1});
            v4 = fun ({A.A(0), A.A(1)});

            ";

            ExecutionMirror mirror = thisTest.RunScriptSource(code);

            TestFrameWork fx = new TestFrameWork();
            TestFrameWork.Verify(mirror, "v2", 4.0);
        }
コード例 #34
0
ファイル: Replication.cs プロジェクト: sh4nnongoh/Dynamo
        public void TestIncompatibleTypes()
        {
            String code =
@"def fun : double(arg: int) { return = 4; }
v1 = Integer.ValueCtor(0);
v2 = fun(4);
v3 = fun ({0, 1});
v4 = fun ({Integer.ValueCtor(0), Integer.ValueCtor(1)});
";
            ExecutionMirror mirror = thisTest.RunScriptSource(code);
            TestFrameWork fx = new TestFrameWork();
            TestFrameWork.Verify(mirror, "v2", 4.0);
        }
コード例 #35
0
 public void Setup()
 {
     theTest = new TestFrameWork();
 }
コード例 #36
0
ファイル: CSFFITest.cs プロジェクト: RobertiF/Dynamo
 public void TestNamespaceImport()
 {
     string code =
         @"import(MicroFeatureTests from ""ProtoTest.dll"");";
     TestFrameWork theTest = new TestFrameWork();
     var mirror = theTest.RunScriptSource(code);
     TestFrameWork.VerifyBuildWarning(ProtoCore.BuildData.WarningID.kMultipleSymbolFound);
     string[] classes = theTest.GetAllMatchingClasses("MicroFeatureTests");
     Assert.True(classes.Length > 1, "More than one implementation of MicroFeatureTests class expected");
 }
コード例 #37
0
ファイル: CSFFITest.cs プロジェクト: RobertiF/Dynamo
 public void TestImportNonBrowsableClass()
 {
     string code = @"
         import(DesignScriptEntity from ""ProtoGeometry.dll"");
         ";
     TestFrameWork theTest = new TestFrameWork();
     ExecutionMirror mirror = theTest.RunScriptSource(code);
     Assert.IsTrue(theTest.GetClassIndex("Geometry") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("Point") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("DesignScriptEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("GeometryFactory") == ProtoCore.DSASM.Constants.kInvalidIndex);
 }
コード例 #38
0
ファイル: CSFFITest.cs プロジェクト: RobertiF/Dynamo
 public void TestNonBrowsableInterfaces()
 {
     string code = @"
         import(""ProtoGeometry.dll"");
         ";
     TestFrameWork theTest = new TestFrameWork();
     ExecutionMirror mirror = theTest.RunScriptSource(code);
     Assert.IsTrue(theTest.GetClassIndex("Geometry") != ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("IColor") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("IDesignScriptEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("IDisplayable") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("IPersistentObject") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("IPersistencyManager") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("ICoordinateSystemEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("IGeometryEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("IPointEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("ICurveEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("ILineEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("ICircleEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("IArcEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("IBSplineCurveEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("IBRepEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("ISurfaceEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("IBSplineSurfaceEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("IPlaneEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("ISolidEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("IPrimitiveSolidEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("IConeEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("ICuboidEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("ISphereEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("IPolygonEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("ISubDMeshEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("IBlockEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("IBlockHelper") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("ITopologyEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("IShellEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("ICellEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("IFaceEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("ICellFaceEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("IVertexEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("IEdgeEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("ITextEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("IGeometryFactory") == ProtoCore.DSASM.Constants.kInvalidIndex);
 }
コード例 #39
0
ファイル: EventTest.cs プロジェクト: algobasket/Dynamo
            Assert.IsTrue((Int64)val.Payload == 202);
            // expect to re-execute id2 = bar.ID
            Assert.AreEqual(5, vms.ExecutionCursor.StartInclusive.LineNo);
            vms = runner_.StepOver();
            val = GetWatchValue(core_, @"id2");
            Assert.IsTrue((Int64)val.Payload == 202);
        }
コード例 #40
0
ファイル: Replication.cs プロジェクト: Benglin/designscript
        public void Test2DnSquareCellArrayCallWithArgAssociative()
        {
            String code =
            @"def fun : double(arg: double) { return = 4.0; }

            a = fun({{1.0, 2.0, 3.0, 4.0}, {5.0, 6.0, 7.0, 8.0 }});
            ";

            ExecutionMirror mirror = thisTest.RunScriptSource(code);

            //Assert.Fail("1467075 - Sprint23 : rev 2660 : replication with nested array is not working as expected");

            TestFrameWork fx = new TestFrameWork();
            TestFrameWork.Verify(mirror, "a", new Object[] {
                new Object[] {4.0, 4.0, 4.0, 4.0 },
                new Object[] {4.0, 4.0, 4.0, 4.0 }});
        }
コード例 #41
0
ファイル: Replication.cs プロジェクト: Benglin/designscript
        public void Test1DnCellArrayCallWithArgAssociative()
        {
            String code =
            @"def fun : double(arg: double) { return = 4.0; }

            a = fun({1.0, 2.0, 3.0, 4.0});
            ";

            ExecutionMirror mirror = thisTest.RunScriptSource(code);

            TestFrameWork fx = new TestFrameWork();
            TestFrameWork.Verify(mirror, "a", new Object[] { 4.0, 4.0, 4.0, 4.0 });
        }
コード例 #42
0
ファイル: Replication.cs プロジェクト: Benglin/designscript
        public void T09_Defect_1456568_Replication_On_Operators()
        {
            String code =
            @"xdata = {1, 2};
            ydata = {3, 4};
            z = xdata + ydata;
            ";

            ExecutionMirror mirror = thisTest.RunScriptSource(code);

            TestFrameWork fx = new TestFrameWork();
            Object[] v1 = new Object[] { 4, 6 };
            TestFrameWork.Verify(mirror, "z", v1);
        }
コード例 #43
0
ファイル: Replication.cs プロジェクト: Benglin/designscript
        public void TestOverloadDispatchWithTypeConversion()
        {
            String code =
            @"class TestDefect
            {
            def foo(val : double)
            {
                return = val;
            }

            def foo(arr : double[])
            {
                return = -123;
            }

            def sqr(val : int)
            {
                return = val * val;
            }
            }

            test = TestDefect.TestDefect();
            arr = 5..25;
            s = test.foo(arr);

            ";

            ExecutionMirror mirror = thisTest.RunScriptSource(code);

            TestFrameWork fx = new TestFrameWork();
            TestFrameWork.Verify(mirror, "s", -123);
        }
コード例 #44
0
ファイル: EventTest.cs プロジェクト: algobasket/Dynamo
 Assert.IsTrue((Int64)val.Payload == 101);
 val = GetWatchValue(core_, @"id2");
 Assert.IsTrue((Int64)val.Payload == 101);
 fooSingleton.ID = 202;
 // expect to re-execute id1 = foo.ID
 vms = runner_.StepOver();
 Assert.AreEqual(3, vms.ExecutionCursor.StartInclusive.LineNo);
 vms = runner_.StepOver();
コード例 #45
0
ファイル: CSFFITest.cs プロジェクト: RobertiF/Dynamo
 public void TestDefaultConstructorNotAvailableOnAbstractClass()
 {
     string code = @"
         import(""ProtoGeometry.dll"");
         ";
     TestFrameWork theTest = new TestFrameWork();
     ExecutionMirror mirror = theTest.RunScriptSource(code);
     //Verify that Geometry.Geometry constructor deson't exists
     theTest.VerifyMethodExists("Geometry", "Geometry", false);
 }
コード例 #46
0
ファイル: CSFFITest.cs プロジェクト: RobertiF/Dynamo
 public void TestImportBrowsableClass()
 {
     string code = @"
         import(NurbsCurve from ""ProtoGeometry.dll"");
         ";
     TestFrameWork theTest = new TestFrameWork();
     ExecutionMirror mirror = theTest.RunScriptSource(code);
     //This import must import BSplineCurve and related classes.
     Assert.IsTrue(theTest.GetClassIndex("Geometry") != ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("Point") != ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("Vector") != ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("Solid") != ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("Surface") != ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("Plane") != ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("CoordinateSystem") != ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("CoordinateSystem") != ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("Curve") != ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("NurbsCurve") != ProtoCore.DSASM.Constants.kInvalidIndex);
     //Non-browsable as well as unrelated class should not be imported.
     Assert.IsTrue(theTest.GetClassIndex("DesignScriptEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("Circle") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("SubDivisionMesh") == ProtoCore.DSASM.Constants.kInvalidIndex);
     Assert.IsTrue(theTest.GetClassIndex("GeometryFactory") == ProtoCore.DSASM.Constants.kInvalidIndex);
 }