Search in sources :

Example 1 with ToFix

use of org.finos.legend.pure.m3.tools.test.ToFix in project legend-pure by finos.

the class TestQualifiedProperty method testInheritedQualifiedPropertyWithTighterMultiplicity.

@Test
@Ignore
@ToFix
public void testInheritedQualifiedPropertyWithTighterMultiplicity() {
    compileTestSource("/test/testSource.pure", "import test::*;\n" + "Class test::TestClass1\n" + "{\n" + "  name : String[1];\n" + "  getNames()\n" + "  {\n" + "    $this.name->split(' ')\n" + "  }:String[*];\n" + "}\n" + "\n" + "Class test::TestClass2 extends TestClass1\n" + "{\n" + "  getNames()\n" + "  {\n" + "    $this.name->split(' ')->last()\n" + "  }:String[0..1];\n" + "}\n" + "\n" + "function test::testFn():Any[*]\n" + "{\n" + "  ^TestClass1(name='Daniel Benedict').getNames()->joinStrings(', ') +\n" + "    '\\n' +\n" + "    ^TestClass2(name='Daniel Benedict').getNames()->joinStrings(', ')\n" + "}\n");
    CoreInstance func = this.runtime.getFunction("test::testFn():Any[*]");
    CoreInstance result = this.functionExecution.start(func, Lists.immutable.<CoreInstance>empty());
    Assert.assertEquals("Daniel, Benedict\nBenedict", PrimitiveUtilities.getStringValue(result.getValueForMetaPropertyToOne(M3Properties.values)));
}
Also used : CoreInstance(org.finos.legend.pure.m4.coreinstance.CoreInstance) ToFix(org.finos.legend.pure.m3.tools.test.ToFix)

Example 2 with ToFix

use of org.finos.legend.pure.m3.tools.test.ToFix in project legend-pure by finos.

the class TestMilestonedPropertyUsageInFunctionExpressions method testAllVersionsInRangePropertyUsageForCrossTemporal.

@ToFix
@Ignore
@Test
public void testAllVersionsInRangePropertyUsageForCrossTemporal() {
    runtime.createInMemorySource("test.pure", "import meta::test::milestoning::domain::*;\n" + "Class <<temporal.businesstemporal>> meta::test::milestoning::domain::Product{\n" + "   classification : Classification[*];\n" + "}\n" + "Class  <<temporal.processingtemporal>> meta::test::milestoning::domain::Classification{\n" + "   exchangeName : String[0..1];\n" + "}\n" + "function go():Any[*]\n" + "{\n" + "   {|Product.allVersionsInRange(%2018-1-1, %2018-1-9).classificationAllVersionsInRange(%2018-1-1, %2018-1-9)}\n" + "}\n");
    runtime.compile();
    runtime.modify("test.pure", "import meta::test::milestoning::domain::*;\n" + "Class <<temporal.bitemporal>> meta::test::milestoning::domain::Product{\n" + "   classification : Classification[*];\n" + "}\n" + "Class  <<temporal.businesstemporal>> meta::test::milestoning::domain::Classification{\n" + "   exchangeName : String[0..1];\n" + "}\n" + "function go():Any[*]\n" + "{\n" + "   {|Product.all(%2018-1-1, %2018-1-9).classificationAllVersionsInRange(%2018-1-1, %2018-1-9)}\n" + "}\n");
    runtime.compile();
    runtime.modify("test.pure", "import meta::test::milestoning::domain::*;\n" + "Class <<temporal.bitemporal>> meta::test::milestoning::domain::Product{\n" + "   classification : Classification[*];\n" + "}\n" + "Class  <<temporal.processingtemporal>> meta::test::milestoning::domain::Classification{\n" + "   exchangeName : String[0..1];\n" + "}\n" + "function go():Any[*]\n" + "{\n" + "   {|Product.all(%2018-1-1, %2018-1-9).classificationAllVersionsInRange(%2018-1-1, %2018-1-9)}\n" + "}\n");
    runtime.compile();
    runtime.modify("test.pure", "import meta::test::milestoning::domain::*;\n" + "Class <<temporal.businesstemporal>> meta::test::milestoning::domain::Product{\n" + "   classification : Classification[*];\n" + "}\n" + "Class  <<temporal.bitemporal>> meta::test::milestoning::domain::Classification{\n" + "   exchangeName : String[0..1];\n" + "}\n" + "function go():Any[*]\n" + "{\n" + "   {|Product.allVersionsInRange(%2018-1-1, %2018-1-9).classificationAllVersionsInRange(%2018-1-1, %2018-1-9)}\n" + "}\n");
    PureCompilationException e1 = Assert.assertThrows(PureCompilationException.class, runtime::compile);
    Assert.assertEquals("Compilation error at (resource:test.pure line:10 column:55), \"The system can't find a match for the function: classificationAllVersionsInRange(_:Product[1],_:StrictDate[1],_:StrictDate[1])", e1.getMessage());
    runtime.modify("test.pure", "import meta::test::milestoning::domain::*;\n" + "Class <<temporal.processingtemporal>> meta::test::milestoning::domain::Product{\n" + "   classification : Classification[*];\n" + "}\n" + "Class  <<temporal.bitemporal>> meta::test::milestoning::domain::Classification{\n" + "   exchangeName : String[0..1];\n" + "}\n" + "function go():Any[*]\n" + "{\n" + "   {|Product.allVersionsInRange(%2018-1-1, %2018-1-9).classificationAllVersionsInRange(%2018-1-1, %2018-1-9)}\n" + "}\n");
    PureCompilationException e2 = Assert.assertThrows(PureCompilationException.class, runtime::compile);
    Assert.assertEquals("Compilation error at (resource:test.pure line:10 column:55), \"The system can't find a match for the function: classificationAllVersionsInRange(_:Product[1],_:StrictDate[1],_:StrictDate[1])", e2.getMessage());
    runtime.modify("test.pure", "import meta::test::milestoning::domain::*;\n" + "Class <<temporal.processingtemporal>> meta::test::milestoning::domain::Product{\n" + "   classification : Classification[*];\n" + "}\n" + "Class  <<temporal.businesstemporal>> meta::test::milestoning::domain::Classification{\n" + "   exchangeName : String[0..1];\n" + "}\n" + "function go():Any[*]\n" + "{\n" + "   {|Product.allVersionsInRange(%2018-1-1, %2018-1-9).classificationAllVersionsInRange(%2018-1-1, %2018-1-9)}\n" + "}\n");
    runtime.compile();
}
Also used : PureCompilationException(org.finos.legend.pure.m4.exception.PureCompilationException) Ignore(org.junit.Ignore) Test(org.junit.Test) ToFix(org.finos.legend.pure.m3.tools.test.ToFix)

Example 3 with ToFix

use of org.finos.legend.pure.m3.tools.test.ToFix in project legend-pure by finos.

the class TestPureRuntimeClass_InGeneralization method testPureRuntimeClassRemoveSpecialization.

@Test
@ToFix
@Ignore
public void testPureRuntimeClassRemoveSpecialization() {
    String generalSourceId = "/test/generalModel.pure";
    String generalSource = "Class test::MoreGeneral {}";
    String specificSourceId = "/test/specificModel.pure";
    String specificSource = "Class test::MoreSpecific extends test::MoreGeneral {}";
    RuntimeVerifier.verifyOperationIsStable(new RuntimeTestScriptBuilder().createInMemorySource(generalSourceId, generalSource).createInMemorySource(specificSourceId, specificSource).compile(), new RuntimeTestScriptBuilder().deleteSource(specificSourceId).compile().createInMemorySource(specificSourceId, specificSource).compile(), this.runtime, this.functionExecution, this.getAdditionalVerifiers());
}
Also used : RuntimeTestScriptBuilder(org.finos.legend.pure.m3.RuntimeTestScriptBuilder) Ignore(org.junit.Ignore) Test(org.junit.Test) ToFix(org.finos.legend.pure.m3.tools.test.ToFix)

Aggregations

ToFix (org.finos.legend.pure.m3.tools.test.ToFix)3 Ignore (org.junit.Ignore)2 Test (org.junit.Test)2 RuntimeTestScriptBuilder (org.finos.legend.pure.m3.RuntimeTestScriptBuilder)1 CoreInstance (org.finos.legend.pure.m4.coreinstance.CoreInstance)1 PureCompilationException (org.finos.legend.pure.m4.exception.PureCompilationException)1