本文整理汇总了C#中ProtoScript.Runners.ProtoScriptRunner类的典型用法代码示例。如果您正苦于以下问题:C# ProtoScript.Runners.ProtoScriptRunner类的具体用法?C# ProtoScript.Runners.ProtoScriptRunner怎么用?C# ProtoScript.Runners.ProtoScriptRunner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProtoScript.Runners.ProtoScriptRunner类属于命名空间,在下文中一共展示了ProtoScript.Runners.ProtoScriptRunner类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1:
ProtoScript.Runners.ProtoScriptRunner fsr = new ProtoScript.Runners.ProtoScriptRunner();
fsr.Execute(
@"
[Associative]
{
a = [Imperative]
{
示例2: RedefineWithFunctions03
public void RedefineWithFunctions03()
{
String code =
@"
class C
{
mx : var;
constructor C()
{
mx = 10;
}
def f(a : int)
{
mx = a + 1;
return = mx;
}
}
x = 10;
p = C.C();
x = p.f(x);
";
ProtoScript.Runners.ProtoScriptRunner fsr = new ProtoScript.Runners.ProtoScriptRunner();
runtimeCore = fsr.Execute(code, core); ExecutionMirror mirror = runtimeCore.Mirror;
Assert.IsTrue((Int64)mirror.GetValue("x").Payload == 11);
}
示例3: GetUpcastChainTest
public void GetUpcastChainTest()
{
String code =
@"class A {}
class B extends A {}
class C extends B {}
";
ProtoScript.Runners.ProtoScriptRunner fsr = new ProtoScript.Runners.ProtoScriptRunner();
ProtoCore.RuntimeCore runtimeCore = null;
runtimeCore = fsr.Execute(code, core); ExecutionMirror mirror = runtimeCore.Mirror;
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, runtimeCore);
List<int> idsB = ClassUtils.GetClassUpcastChain(cnB, runtimeCore);
List<int> idsC = ClassUtils.GetClassUpcastChain(cnC, runtimeCore);
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));
Assert.IsTrue(idsC.Contains(idB));
Assert.IsTrue(idsC.Contains(idC));
}
示例4: ExecuteAndVerify
protected int ExecuteAndVerify(String code, ValidationData[] data, Dictionary<string, Object> context, out int nErrors)
{
ProtoCore.Core core = Setup();
ProtoScript.Runners.ProtoScriptRunner fsr = new ProtoScript.Runners.ProtoScriptRunner();
ProtoCore.CompileTime.Context compileContext = new ProtoCore.CompileTime.Context(code, context);
ProtoCore.RuntimeCore runtimeCore = null;
ExecutionMirror mirror = fsr.Execute(compileContext, core, out runtimeCore);
int nWarnings = runtimeCore.RuntimeStatus.WarningCount;
nErrors = core.BuildStatus.ErrorCount;
if (data == null)
{
runtimeCore.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);
}
}
runtimeCore.Cleanup();
return nWarnings + nErrors;
}
示例5: T0000_sample
public void T0000_sample()
{
String code =
@"
x = 1;
";
ProtoScript.Runners.ProtoScriptRunner fsr = new ProtoScript.Runners.ProtoScriptRunner();
String errmsg = "";
ExecutionMirror mirror = thisTest.VerifyRunScriptSource(code, errmsg);
示例6: scale
return = 0;
}
x = 10;
y = 40;
n = scale();
n = scale(10);
";
ProtoScript.Runners.ProtoScriptRunner fsr = new ProtoScript.Runners.ProtoScriptRunner();
runtimeCore = fsr.Execute(code, core); ExecutionMirror mirror = runtimeCore.Mirror;
示例7: SimpleMethodOverload1
ProtoScript.Runners.ProtoScriptRunner fsr = new ProtoScript.Runners.ProtoScriptRunner();
runtimeCore = fsr.Execute(code, core); ExecutionMirror mirror = runtimeCore.Mirror;
Assert.IsTrue((Int64)mirror.GetValue("x").Payload == 123);
Assert.IsTrue((Int64)mirror.GetValue("y").Payload == 345);
}
[Test]
[Category("DSDefinedClass_Ported")]
public void SimpleMethodOverload1()
示例8: TestMultLanguageImperativeAssociative
b = 4;
}
", core, out runtimeCore);
}
[Test]
public void TestMultLanguageImperativeAssociative()
{
ProtoScript.Runners.ProtoScriptRunner fsr = new ProtoScript.Runners.ProtoScriptRunner();
fsr.Execute(
@"
示例9: f
}
def f(a : int)
{
mx = a + 1;
return = mx;
}
}
x = 10;
示例10: RedefineWithFunctions03
public void RedefineWithFunctions03()
{
String code =
@"
class C
{
mx : var;
constructor C()
示例11: SimpleMethodOverload2
runtimeCore = fsr.Execute(code, core); ExecutionMirror mirror = runtimeCore.Mirror;
Assert.IsTrue((Int64)mirror.GetValue("x").Payload == 123);
Assert.IsTrue((Int64)mirror.GetValue("y").Payload == 345);
}
[Test]
[Category("DSDefinedClass_Ported")]
public void SimpleMethodOverload2()
示例12:
ExecutionMirror mirror = thisTest.RunScriptSource(code);
thisTest.Verify("f0", false);
thisTest.Verify("f1", false);
thisTest.Verify("f2", false);
thisTest.Verify("f3", false);
thisTest.Verify("t0", true);
thisTest.Verify("t1", true);
thisTest.Verify("t2", true);
示例13: f2
@"def f1(i : int, k : int)
{
return = i + k;
}
def f2(i : int, k : int)
{
return = i - k;
}
x = 12;
示例14: foo
String code =
@"
def foo(a,b)
{
return = a + b;
}
x = {0,1};
y = {2,3};
test = foo( x<1>,y<2> );
示例15: LiteralRetrival
public void LiteralRetrival()
{
String code =
@"
foo;
[Associative]
{
foo = 5;
}