public class org.finos.legend.pure.runtime.java.interpreted.function.TestManyPromotion extends org.finos.legend.pure.m.tests.AbstractPureTestWithCoreCompiled
{
public void <init>()
{
org.finos.legend.pure.runtime.java.interpreted.function.TestManyPromotion v;
v := @this: org.finos.legend.pure.runtime.java.interpreted.function.TestManyPromotion;
specialinvoke v.<org.finos.legend.pure.m.tests.AbstractPureTestWithCoreCompiled: void <init>()>();
return;
}
public static void setUp()
{
org.finos.legend.pure.m.execution.FunctionExecution v;
v = staticinvoke <org.finos.legend.pure.runtime.java.interpreted.function.TestManyPromotion: org.finos.legend.pure.m.execution.FunctionExecution getFunctionExecution()>();
staticinvoke <org.finos.legend.pure.runtime.java.interpreted.function.TestManyPromotion: void setUpRuntime(org.finos.legend.pure.m.execution.FunctionExecution)>(v);
return;
}
public void cleanRuntime()
{
org.finos.legend.pure.runtime.java.interpreted.function.TestManyPromotion v;
org.finos.legend.pure.m.serialization.runtime.PureRuntime v, v;
v := @this: org.finos.legend.pure.runtime.java.interpreted.function.TestManyPromotion;
v = <org.finos.legend.pure.runtime.java.interpreted.function.TestManyPromotion: org.finos.legend.pure.m.serialization.runtime.PureRuntime runtime>;
virtualinvoke v.<org.finos.legend.pure.m.serialization.runtime.PureRuntime: void delete(java.lang.String)>("fromString.pure");
v = <org.finos.legend.pure.runtime.java.interpreted.function.TestManyPromotion: org.finos.legend.pure.m.serialization.runtime.PureRuntime runtime>;
virtualinvoke v.<org.finos.legend.pure.m.serialization.runtime.PureRuntime: org.finos.legend.pure.m.SourceMutation compile()>();
return;
}
public void testString()
{
org.finos.legend.pure.m.coreinstance.CoreInstance[] v;
org.finos.legend.pure.runtime.java.interpreted.function.TestManyPromotion v;
org.finos.legend.pure.m.execution.Console v;
java.lang.String v;
org.finos.legend.pure.m.execution.FunctionExecution v;
v := @this: org.finos.legend.pure.runtime.java.interpreted.function.TestManyPromotion;
staticinvoke <org.finos.legend.pure.runtime.java.interpreted.function.TestManyPromotion: org.finos.legend.pure.m.SourceMutation compileTestSource(java.lang.String,java.lang.String)>("fromString.pure", "function func():String[*]\n{\n    \'ok\';\n}\nfunction test():Nil[0]\n{\n    print(func(),1);}\n");
v = newarray (org.finos.legend.pure.m.coreinstance.CoreInstance)[0];
virtualinvoke v.<org.finos.legend.pure.runtime.java.interpreted.function.TestManyPromotion: org.finos.legend.pure.m.coreinstance.CoreInstance execute(java.lang.String,org.finos.legend.pure.m.coreinstance.CoreInstance[])>("test():Nil[0]", v);
v = <org.finos.legend.pure.runtime.java.interpreted.function.TestManyPromotion: org.finos.legend.pure.m.execution.FunctionExecution functionExecution>;
v = interfaceinvoke v.<org.finos.legend.pure.m.execution.FunctionExecution: org.finos.legend.pure.m.execution.Console getConsole()>();
v = interfaceinvoke v.<org.finos.legend.pure.m.execution.Console: java.lang.String getLine(int)>(0);
staticinvoke <org.junit.Assert: void assertEquals(java.lang.Object,java.lang.Object)>("\'ok\'", v);
return;
}
public void testStringError()
{
org.finos.legend.pure.runtime.java.interpreted.function.TestManyPromotion v;
java.lang.Integer v, v;
java.lang.Exception v;
v := @this: org.finos.legend.pure.runtime.java.interpreted.function.TestManyPromotion;
label:
staticinvoke <org.finos.legend.pure.runtime.java.interpreted.function.TestManyPromotion: org.finos.legend.pure.m.SourceMutation compileTestSource(java.lang.String,java.lang.String)>("fromString.pure", "function func():String[1]\n{\n    [\'ok\',\'ok2\'];\n}\nfunction test():Nil[0]\n{\n    print(func());}\n");
label:
goto label;
label:
v := @caughtexception;
v = staticinvoke <java.lang.Integer: java.lang.Integer valueOf(int)>(3);
v = staticinvoke <java.lang.Integer: java.lang.Integer valueOf(int)>(5);
staticinvoke <org.finos.legend.pure.runtime.java.interpreted.function.TestManyPromotion: void assertPureException(java.lang.Class,java.lang.String,java.lang.String,java.lang.Integer,java.lang.Integer,java.lang.Exception)>(class "Lorg/finos/legend/pure/m4/exception/PureCompilationException;", "Return multiplicity error in function \'func\'; found: [2]; expected: [1]", "fromString.pure", v, v, v);
label:
return;
catch java.lang.Exception from label to label with label;
}
public void testFunctionMatchingMultiplicity()
{
org.finos.legend.pure.m.coreinstance.CoreInstance[] v;
org.finos.legend.pure.runtime.java.interpreted.function.TestManyPromotion v;
org.finos.legend.pure.m.execution.Console v, v;
java.lang.String v, v;
org.finos.legend.pure.m.execution.FunctionExecution v, v;
v := @this: org.finos.legend.pure.runtime.java.interpreted.function.TestManyPromotion;
staticinvoke <org.finos.legend.pure.runtime.java.interpreted.function.TestManyPromotion: org.finos.legend.pure.m.SourceMutation compileTestSource(java.lang.String,java.lang.String)>("fromString.pure", "function func(a:Any[1]):Any[*]\n{\n    $a;\n}\nfunction test():Nil[0]\n{\n    print(func(test__Nil_0_)->size(), 1);    print(test__Nil_0_->map(c|func($c))->size(), 1);}\n");
v = newarray (org.finos.legend.pure.m.coreinstance.CoreInstance)[0];
virtualinvoke v.<org.finos.legend.pure.runtime.java.interpreted.function.TestManyPromotion: org.finos.legend.pure.m.coreinstance.CoreInstance execute(java.lang.String,org.finos.legend.pure.m.coreinstance.CoreInstance[])>("test():Nil[0]", v);
v = <org.finos.legend.pure.runtime.java.interpreted.function.TestManyPromotion: org.finos.legend.pure.m.execution.FunctionExecution functionExecution>;
v = interfaceinvoke v.<org.finos.legend.pure.m.execution.FunctionExecution: org.finos.legend.pure.m.execution.Console getConsole()>();
v = interfaceinvoke v.<org.finos.legend.pure.m.execution.Console: java.lang.String getLine(int)>(0);
staticinvoke <org.junit.Assert: void assertEquals(java.lang.Object,java.lang.Object)>("1", v);
v = <org.finos.legend.pure.runtime.java.interpreted.function.TestManyPromotion: org.finos.legend.pure.m.execution.FunctionExecution functionExecution>;
v = interfaceinvoke v.<org.finos.legend.pure.m.execution.FunctionExecution: org.finos.legend.pure.m.execution.Console getConsole()>();
v = interfaceinvoke v.<org.finos.legend.pure.m.execution.Console: java.lang.String getLine(int)>(1);
staticinvoke <org.junit.Assert: void assertEquals(java.lang.Object,java.lang.Object)>("1", v);
return;
}
protected static org.finos.legend.pure.m.execution.FunctionExecution getFunctionExecution()
{
org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted v;
v = new org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted;
specialinvoke v.<org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted: void <init>()>();
return v;
}
}