本文整理汇总了C#中ProtoScript.Runners.ProtoScriptTestRunner类的典型用法代码示例。如果您正苦于以下问题:C# ProtoScript.Runners.ProtoScriptTestRunner类的具体用法?C# ProtoScript.Runners.ProtoScriptTestRunner怎么用?C# ProtoScript.Runners.ProtoScriptTestRunner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProtoScript.Runners.ProtoScriptTestRunner类属于命名空间,在下文中一共展示了ProtoScript.Runners.ProtoScriptTestRunner类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ModifierStackWithArray
public void ModifierStackWithArray()
{
ProtoScript.Runners.ProtoScriptTestRunner fsr = new ProtoScript.Runners.ProtoScriptTestRunner();
ExecutionMirror mirror = fsr.Execute(
@"
a;
[email protected];
[email protected];
[Associative]
{
a =
{
{3, 2, 1} => [email protected];
1 => [email protected];
}
}
", core, out compileState);
Obj o = mirror.GetValue("[email protected]");
List<Obj> os = mirror.GetArrayElements(o);
Assert.IsTrue(os.Count == 3);
Assert.IsTrue((Int64)os[0].Payload == 3);
Assert.IsTrue((Int64)os[1].Payload == 2);
Assert.IsTrue((Int64)os[2].Payload == 1);
Assert.IsTrue((Int64)mirror.GetValue("[email protected]", 0).Payload == 1);
}
开发者ID:junmendoza,项目名称:designscript,代码行数:27,代码来源:ModifierStack.cs
示例2: ModifierStackWithArrayAndFunction
public void ModifierStackWithArrayAndFunction()
{
ProtoScript.Runners.ProtoScriptTestRunner fsr = new ProtoScript.Runners.ProtoScriptTestRunner();
ExecutionMirror mirror = fsr.Execute(
@"[email protected];[email protected];b;
[Associative]
{
def foo : int(x : int)
{
a = x+2;
return = a;
}
b =
{
{3, 2, 1} => [email protected];
foo(7) => [email protected];
}
}
", core, out compileState);
Obj o = mirror.GetValue("[email protected]");
List<Obj> os = mirror.GetArrayElements(o);
Assert.IsTrue(os.Count == 3);
Assert.IsTrue((Int64)os[0].Payload == 3);
Assert.IsTrue((Int64)os[1].Payload == 2);
Assert.IsTrue((Int64)os[2].Payload == 1);
Assert.IsTrue((Int64)mirror.GetValue("[email protected]", 0).Payload == 9);
Assert.IsTrue((Int64)mirror.GetValue("b", 0).Payload == 9);
}
开发者ID:junmendoza,项目名称:designscript,代码行数:30,代码来源:ModifierStack.cs
示例3: ClassTest
public void ClassTest()
{
ProtoScript.Runners.ProtoScriptTestRunner fsr = new ProtoScript.Runners.ProtoScriptTestRunner();
fsr.Execute(
@"
[Associative]
{
class Point
{
mx : var;
my : var;
mz : var;
constructor Point(xx : double, yy : double, zz : double)
{
mz = xx;
my = yy;
mx = zz;
}
}
point = Point.Point(10,10,10);
}
", core, out compileState);
//Object o = mirror.GetValue("point.mx");
//Assert.IsTrue((long)o == 10);
}
开发者ID:junmendoza,项目名称:designscript,代码行数:26,代码来源:ModifierStack.cs
示例4: EmbeddedTest001
public void EmbeddedTest001()
{
String code =
@"x;[Associative]
{
x = 0;
[Imperative]
{
x = x + 5;
}
}
";
ProtoScript.Runners.ProtoScriptTestRunner fsr = new ProtoScript.Runners.ProtoScriptTestRunner();
ExecutionMirror mirror = fsr.Execute(code, core, out compileState);
Obj o = mirror.GetValue("x");
Assert.IsTrue((Int64)o.Payload == 5);
}
[Test]
public void EmbeddedTest002()
{
String code =
@"
开发者ID:samuto,项目名称:designscript,代码行数:25,代码来源:AssociativeToImperative.cs
示例5: AccessGlobalVariableInsideFunction
public void AccessGlobalVariableInsideFunction()
{
string code = @"
arr = { 1, 2, 3 };
factor = 10;
def foo : int[]()
{
f = factor;
[Imperative]
{
ix = 0;
for(i in arr)
{
arr[ix] = arr[ix] * factor * f;
ix = ix + 1;
}
}
return = arr;
}
w = foo();
w0 = w[0];
w1 = w[1];
w2 = w[2];
";
ProtoScript.Runners.ProtoScriptTestRunner fsr = new ProtoScript.Runners.ProtoScriptTestRunner();
ExecutionMirror mirror = fsr.Execute(code, core);
Assert.IsTrue((Int64)mirror.GetValue("w0").Payload == 100);
Assert.IsTrue((Int64)mirror.GetValue("w1").Payload == 200);
Assert.IsTrue((Int64)mirror.GetValue("w2").Payload == 300);
}
开发者ID:Benglin,项目名称:designscript,代码行数:34,代码来源:AssociativeToImperative.cs
示例6: ExecuteAndVerify
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;
}
开发者ID:RobertiF,项目名称:Dynamo,代码行数:28,代码来源:CSFFITest.cs
示例7: ExternCallTest
public void ExternCallTest()
{
//String code =
/*@"external (""ffi_library"") def sum_all : double (arr : double[], numElems : int);
def sum_all_2 : double (arr : double[], numElems : int)
{ return = 42;
}
arr = {1.0, 2, 3, 4, 5, 6, 7, 8, 9, 10};
sum_1_to_10 = sum_all_2(arr, 10);";
*/
String code =
@"external (""ffi_library"") def sum_all : double (arr : double[], numElems : int);
arr = {1.0, 2, 3, 4, 5, 6, 7, 8, 9, 10};
sum_1_to_10 = sum_all(arr, 10);";
ProtoScript.Runners.ProtoScriptTestRunner fsr = new ProtoScript.Runners.ProtoScriptTestRunner();
ExecutionMirror mirror = fsr.Execute(code, core);
Obj o = mirror.GetValue("sum_1_to_10");
Assert.IsTrue((Int64)o.Payload == 55);
}
开发者ID:RobertiF,项目名称:Dynamo,代码行数:32,代码来源:CallSite.cs
示例8: GetUpcastChainTest
public void GetUpcastChainTest()
{
String code =
@"class A {}
class B extends A {}
class C extends B {}
";
ProtoScript.Runners.ProtoScriptTestRunner fsr = new ProtoScript.Runners.ProtoScriptTestRunner();
ExecutionMirror mirror = fsr.Execute(code, core);
int idA = core.ClassTable.IndexOf("A");
int idB = core.ClassTable.IndexOf("B");
int idC = core.ClassTable.IndexOf("C");
ClassNode cnA = core.ClassTable.ClassNodes[idA];
ClassNode cnB = core.ClassTable.ClassNodes[idB];
ClassNode cnC = core.ClassTable.ClassNodes[idC];
List<int> idsA = ClassUtils.GetClassUpcastChain(cnA, core);
List<int> idsB = ClassUtils.GetClassUpcastChain(cnB, core);
List<int> idsC = ClassUtils.GetClassUpcastChain(cnC, core);
Assert.IsTrue(idsA.Count == 2);
Assert.IsTrue(idsA.Contains(idA));
Assert.IsTrue(idsB.Count == 3);
Assert.IsTrue(idsB.Contains(idA));
Assert.IsTrue(idsB.Contains(idB));
Assert.IsTrue(idsC.Count == 4);
Assert.IsTrue(idsC.Contains(idA));
开发者ID:heegwon,项目名称:Dynamo,代码行数:26,代码来源:ClassUtilsTest.cs
示例9:
ProtoScript.Runners.ProtoScriptTestRunner fsr = new ProtoScript.Runners.ProtoScriptTestRunner();
fsr.Execute(
@"
[Associative]
{
a = [Imperative]
{
开发者ID:rafatahmed,项目名称:Dynamo,代码行数:7,代码来源:MultiLanugageBasic.cs
示例10: SimpleCtorResolution01
public void SimpleCtorResolution01()
{
String code =
@"
class f
{
fx : var;
fy : var;
constructor f()
{
fx = 123;
fy = 345;
}
}
// Construct class 'f'
cf = f.f();
x = cf.fx;
y = cf.fy;
";
ProtoScript.Runners.ProtoScriptTestRunner fsr = new ProtoScript.Runners.ProtoScriptTestRunner();
ExecutionMirror mirror = fsr.Execute(code, core, out compileState);
Assert.IsTrue((Int64)mirror.GetValue("x").Payload == 123);
Assert.IsTrue((Int64)mirror.GetValue("y").Payload == 345);
}
开发者ID:junmendoza,项目名称:designscript,代码行数:28,代码来源:MethodResolution.cs
示例11: StackValueDiffTestProperty01
public void StackValueDiffTestProperty01()
{
String code =
@"
class A
{
x : var;
constructor A()
{
x = 20;
}
}
[Imperative]
{
a = A.A();
b = 1.0;
}
";
ProtoScript.Runners.ProtoScriptTestRunner fsr = new ProtoScript.Runners.ProtoScriptTestRunner();
ProtoCore.RuntimeCore runtimeCore = null;
ExecutionMirror mirror = fsr.Execute(code, core, out runtimeCore);
StackValue svA = mirror.GetRawFirstValue("a");
StackValue svB = mirror.GetRawFirstValue("b");
Assert.IsTrue(svA.metaData.type != svB.metaData.type);
}
开发者ID:rafatahmed,项目名称:Dynamo,代码行数:25,代码来源:ArrayUtilsTest.cs
示例12: TestClassUsageInImpeartive
public void TestClassUsageInImpeartive()
{
ProtoCore.Core core = new ProtoCore.Core(new ProtoCore.Options());
core.Executives.Add(ProtoCore.Language.kAssociative, new ProtoAssociative.Executive(core));
core.Executives.Add(ProtoCore.Language.kImperative, new ProtoImperative.Executive(core));
ProtoScript.Runners.ProtoScriptTestRunner fsr = new ProtoScript.Runners.ProtoScriptTestRunner();
ExecutionMirror mirror = fsr.Execute(
@"
class foo
{
m : var;
constructor Create(a1 : int)
{
m = a1;
}
}
x;y;
[Imperative]
{
p = foo.Create(16);
x = p.m;
p.m = 32;
y = p.m;
}
"
, core, out compileState);
Assert.IsTrue((Int64)mirror.GetValue("x", 0).Payload == 16);
Assert.IsTrue((Int64)mirror.GetValue("y", 0).Payload == 32);
}
开发者ID:samuto,项目名称:designscript,代码行数:30,代码来源:MultiLanugageBasic.cs
示例13: RedefineWithFunctions02
ProtoScript.Runners.ProtoScriptTestRunner fsr = new ProtoScript.Runners.ProtoScriptTestRunner();
ExecutionMirror mirror = fsr.Execute(code, core);
Assert.IsTrue((Int64)mirror.GetValue("x").Payload == 1001);
}
[Test]
[Category("ToFixYuKe")]
public void RedefineWithFunctions02()
开发者ID:RobertiF,项目名称:Dynamo,代码行数:8,代码来源:RedefinitionExpression.cs
示例14: TestScriptFile
ProtoScript.Runners.ProtoScriptTestRunner fsr = new ProtoScript.Runners.ProtoScriptTestRunner();
ProtoLanguage.CompileStateTracker compileState = null;
fsr.Execute(scriptCode, core, out compileState);
}
public void TestScriptFile(string filename)
{
ProtoCore.Core core = new ProtoCore.Core(new ProtoCore.Options());
开发者ID:samuto,项目名称:designscript,代码行数:8,代码来源:FFITests.cs
示例15:
";
ProtoScript.Runners.ProtoScriptTestRunner fsr = new ProtoScript.Runners.ProtoScriptTestRunner();
ExecutionMirror mirror = fsr.Execute(code, core);
Obj o = mirror.GetValue("x");
Assert.IsTrue((Int64)o.Payload == 6);
}
[Test]
开发者ID:heegwon,项目名称:Dynamo,代码行数:8,代码来源:AssociativeToImperative.cs
示例16: TwoSimpleExprInModifierStack
", core);
Assert.IsTrue((Int64)mirror.GetValue("a", 0).Payload == 10);
}
[Test]
public void TwoSimpleExprInModifierStack()
{
ProtoScript.Runners.ProtoScriptTestRunner fsr = new ProtoScript.Runners.ProtoScriptTestRunner();
开发者ID:RobertiF,项目名称:Dynamo,代码行数:8,代码来源:ModifierStack.cs
示例17: scale
return = 0;
}
x = 10;
y = 40;
n = scale();
n = scale(10);
";
ProtoScript.Runners.ProtoScriptTestRunner fsr = new ProtoScript.Runners.ProtoScriptTestRunner();
ExecutionMirror mirror = fsr.Execute(code, core, out runtimeCore);
开发者ID:joespiff,项目名称:Dynamo,代码行数:9,代码来源:MethodResolution.cs
示例18: SimpleMethodOverload1
ProtoScript.Runners.ProtoScriptTestRunner fsr = new ProtoScript.Runners.ProtoScriptTestRunner();
ExecutionMirror mirror = fsr.Execute(code, core, out runtimeCore);
Assert.IsTrue((Int64)mirror.GetValue("x").Payload == 123);
Assert.IsTrue((Int64)mirror.GetValue("y").Payload == 345);
}
[Test]
[Category("DSDefinedClass_Ported")]
public void SimpleMethodOverload1()
开发者ID:joespiff,项目名称:Dynamo,代码行数:9,代码来源:MethodResolution.cs
示例19: foo
test = foo( x<1>,y<2> );
";
ProtoScript.Runners.ProtoScriptTestRunner fsr = new ProtoScript.Runners.ProtoScriptTestRunner();
String errmsg = "";
ExecutionMirror mirror = thisTest.VerifyRunScriptSource(code, errmsg);
thisTest.Verify("test", new Object[] { new Object[] { 2, 3 }, new Object[] { 3, 4 } });
}
[Test]
开发者ID:joespiff,项目名称:Dynamo,代码行数:9,代码来源:ReplicationGuide.cs
示例20:
ExecutionMirror mirror = fsr.Execute(
@"
a;
[Associative]
{
a =
{
开发者ID:RobertiF,项目名称:Dynamo,代码行数:7,代码来源:ModifierStack.cs
注:本文中的ProtoScript.Runners.ProtoScriptTestRunner类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论