public void testCollectionLiteral(String expression, String expectedElementTypeName, String collectionName, int partsSize, CollectionKindEnum collectionKind) { CollectionLiteralExp literalExp = doTestOK(expression); Assert.IsTrue(literalExp.getType() is CollectionType); CollectionType collectionType = (CollectionType)literalExp.getType(); Assert.AreEqual(collectionName, collectionType.getName()); Assert.AreEqual(expectedElementTypeName, collectionType.getElementType().getName()); Assert.AreEqual(partsSize, literalExp.getParts().Count); Assert.AreEqual(collectionKind, literalExp.getKind()); }
public void testSetLiteral_07() { CollectionLiteralExp literalExp = doTestOK("Bag{ Set{1, 2}, Set{4, 8} } "); CoreClassifier expectedType = (CoreClassifier)environment.lookup("Integer"); Assert.IsNotNull(expectedType); Assert.IsTrue(literalExp.getType() is BagType); CollectionType collectionType = (CollectionType)literalExp.getType(); Assert.IsTrue(collectionType.getElementType() is SetType); Assert.AreEqual(2, literalExp.getParts().Count); Assert.AreEqual(CollectionKindEnum.BAG, literalExp.getKind()); }