@@ -387,6 +387,8 @@ public void testSequenceFunctionEvaluation() throws Exception {
387387
388388 assertElement ("LiteralBoolean true" , instance .eval ("SequenceFunctions::includes((1, 2, 3), 1)" , null ));
389389 assertElement ("LiteralBoolean false" , instance .eval ("SequenceFunctions::includes((1, 2, 3), 5)" , null ));
390+ assertElement ("LiteralBoolean true" , instance .eval ("SequenceFunctions::includes((1, 2, 3), (1, 3))" , null ));
391+ assertElement ("LiteralBoolean false" , instance .eval ("SequenceFunctions::includes((1, 2, 3), (1, 5))" , null ));
390392
391393 assertElement ("LiteralBoolean true" , instance .eval ("SequenceFunctions::includesOnly((1, 2, 3), (3, 2, 1))" , null ));
392394 assertElement ("LiteralBoolean false" , instance .eval ("SequenceFunctions::includesOnly((1, 2, 3), (1, 5))" , null ));
@@ -448,6 +450,52 @@ public void testSequenceFunctionEvaluation() throws Exception {
448450 assertList (new String []{}, instance .eval ("SequenceFunctions::intersection((), (4, 5))" , null ));
449451 }
450452
453+ public final String collectionTest =
454+ "package CollectionTest {\n "
455+ + " private import Collections::*;\n "
456+ + " attribute empty = new OrderedCollection(elements = null);\n "
457+ + " attribute collection1 = new OrderedCollection(elements = 1);\n "
458+ + " attribute collection5 = new OrderedCollection(elements = 5);\n "
459+ + " attribute collection15 = new OrderedCollection(elements = (1, 5));\n "
460+ + " attribute collection123 = new OrderedCollection(elements = (1, 2, 3));\n "
461+ + " attribute collection321 = new OrderedCollection(elements = (3, 2, 1));\n "
462+ + "}" ;
463+
464+ @ Test
465+ public void testCollectionFunctionEvaluation () throws Exception {
466+ SysMLInteractive instance = getSysMLInteractiveInstance ();
467+ process (instance , collectionTest );
468+
469+ assertElement ("LiteralInteger 3" , instance .eval ("CollectionFunctions::size(collection123)" , "CollectionTest" ));
470+
471+ assertElement ("LiteralBoolean true" , instance .eval ("CollectionFunctions::contains(collection123, 1)" , "CollectionTest" ));
472+ assertElement ("LiteralBoolean false" , instance .eval ("CollectionFunctions::contains(collection123, 5)" , "CollectionTest" ));
473+ assertElement ("LiteralBoolean true" , instance .eval ("CollectionFunctions::contains(collection123, (1, 3))" , "CollectionTest" ));
474+ assertElement ("LiteralBoolean false" , instance .eval ("CollectionFunctions::contains(collection123, (1, 5))" , "CollectionTest" ));
475+
476+ assertElement ("LiteralBoolean true" , instance .eval ("CollectionFunctions::containsAll(collection123, collection321)" , "CollectionTest" ));
477+ assertElement ("LiteralBoolean false" , instance .eval ("CollectionFunctions::containsAll(collection123, collection15)" , "CollectionTest" ));
478+
479+ assertElement ("LiteralBoolean true" , instance .eval ("CollectionFunctions::isEmpty(empty)" , "CollectionTest" ));
480+ assertElement ("LiteralBoolean false" , instance .eval ("CollectionFunctions::isEmpty(collection1)" , "CollectionTest" ));
481+ assertElement ("LiteralBoolean false" , instance .eval ("CollectionFunctions::isEmpty(collection123)" , "CollectionTest" ));
482+
483+ assertElement ("LiteralBoolean false" , instance .eval ("CollectionFunctions::notEmpty(empty)" , "CollectionTest" ));
484+ assertElement ("LiteralBoolean true" , instance .eval ("CollectionFunctions::notEmpty(collection1)" , "CollectionTest" ));
485+ assertElement ("LiteralBoolean true" , instance .eval ("CollectionFunctions::notEmpty(collection123)" , "CollectionTest" ));
486+
487+ assertElement ("LiteralBoolean true" , instance .eval ("CollectionFunctions::'=='(collection123, collection123)" , "CollectionTest" ));
488+ assertElement ("LiteralBoolean false" , instance .eval ("CollectionFunctions::'=='(collection123, collection321)" , "CollectionTest" ));
489+ assertElement ("LiteralBoolean false" , instance .eval ("CollectionFunctions::'=='(collection123, collection15)" , "CollectionTest" ));
490+
491+ assertList (new String []{"LiteralInteger 1" }, instance .eval ("CollectionFunctions::head(collection123)" , "CollectionTest" ));
492+ assertList (new String []{}, instance .eval ("CollectionFunctions::head(empty)" , "CollectionTest" ));
493+ assertList (new String []{"LiteralInteger 2" , "LiteralInteger 3" }, instance .eval ("CollectionFunctions::tail(collection123)" , "CollectionTest" ));
494+ assertList (new String []{}, instance .eval ("CollectionFunctions::tail(empty)" , "CollectionTest" ));
495+ assertList (new String []{"LiteralInteger 3" }, instance .eval ("CollectionFunctions::last(collection123)" , "CollectionTest" ));
496+ assertList (new String []{}, instance .eval ("CollectionFunctions::last(empty)" , "CollectionTest" ));
497+ }
498+
451499 @ Test
452500 public void testNumericalFunctionEvaluation () throws Exception {
453501 SysMLInteractive instance = getSysMLInteractiveInstance ();
0 commit comments