Skip to content

Commit b1d5b81

Browse files
committed
ST6RI-840 Added model-level evaluation test for constructor expressions.
1 parent c365ffb commit b1d5b81

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

org.omg.sysml.interactive.tests/src/org/omg/sysml/interactive/tests/ModelLevelEvaluationTest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,21 @@ public void testListEvaluation() throws Exception {
299299
assertEquals(true, evaluateBooleanValue(null, null, "SequenceFunctions::notEmpty((1,2,3))"));
300300
}
301301

302+
@Test
303+
public void testConstructorEvaluation() throws Exception {
304+
SysMLInteractive instance = getSysMLInteractiveInstance();
305+
process(instance,
306+
"part def P { attribute a; attribute b; } " +
307+
"part p1 = new P(1, 2); " +
308+
"part p2 = new P(b = p1.b, a = p1.a);");
309+
assertEquals(true, evaluateBooleanValue(instance, null, "p1 istype P"));
310+
assertEquals(1, evaluateIntegerValue(instance, null, "p1.a"));
311+
assertEquals(2, evaluateIntegerValue(instance, null, "p1.b"));
312+
assertEquals(true, evaluateBooleanValue(instance, null, "p2 istype P"));
313+
assertEquals(1, evaluateIntegerValue(instance, null, "p2.a"));
314+
assertEquals(2, evaluateIntegerValue(instance, null, "p2.b"));
315+
}
316+
302317
@Test
303318
public void testFeatureReferenceEvaluation() throws Exception {
304319
SysMLInteractive instance = getSysMLInteractiveInstance();

0 commit comments

Comments
 (0)