Пример #1
0
        public void CollectionConformanceTest()
        {
            //Collections conform to OclAny
            TestConformant(OclCollectionType.Collection(OclCollectionKind.Collection, OclAny.Type), OclAny.Type);
            TestConformant(OclCollectionType.Collection(OclCollectionKind.Sequence, OclAny.Type), OclAny.Type);

            TestConformant(OclCollectionType.Collection(OclCollectionKind.Collection, OclInteger.Type), OclAny.Type);
            TestConformant(OclCollectionType.Collection(OclCollectionKind.Sequence, OclInteger.Type), OclAny.Type);

            //OclVoid conforms to collections
            TestConformant(OclVoidType.OclVoid, OclCollectionType.Collection(OclCollectionKind.Collection, OclAny.Type));
            TestConformant(OclVoidType.OclVoid, OclCollectionType.Collection(OclCollectionKind.Sequence, OclAny.Type));

            TestConformant(OclVoidType.OclVoid, OclCollectionType.Collection(OclCollectionKind.Collection, OclInteger.Type));
            TestConformant(OclVoidType.OclVoid, OclCollectionType.Collection(OclCollectionKind.Sequence, OclInteger.Type));

            //Colections conform to colection of the same kind or kind Collection and conformant element types
            TestConformantToSelf(OclCollectionType.Collection(OclCollectionKind.Collection, OclAny.Type));

            TestConformantToSelf(OclCollectionType.Collection(OclCollectionKind.Sequence, OclAny.Type));
            TestConformant(OclCollectionType.Collection(OclCollectionKind.Sequence, OclAny.Type), OclCollectionType.Collection(OclCollectionKind.Collection, OclAny.Type));

            TestConformantToSelf(OclCollectionType.Collection(OclCollectionKind.Collection, OclInteger.Type));
            TestConformant(OclCollectionType.Collection(OclCollectionKind.Collection, OclInteger.Type), OclCollectionType.Collection(OclCollectionKind.Collection, OclAny.Type));

            TestConformantToSelf(OclCollectionType.Collection(OclCollectionKind.Sequence, OclInteger.Type));
            TestConformant(OclCollectionType.Collection(OclCollectionKind.Sequence, OclInteger.Type), OclCollectionType.Collection(OclCollectionKind.Collection, OclAny.Type));
            TestConformant(OclCollectionType.Collection(OclCollectionKind.Sequence, OclInteger.Type), OclCollectionType.Collection(OclCollectionKind.Sequence, OclAny.Type));
            TestConformant(OclCollectionType.Collection(OclCollectionKind.Sequence, OclInteger.Type), OclCollectionType.Collection(OclCollectionKind.Collection, OclInteger.Type));

            TestNonConformant(OclCollectionType.Collection(OclCollectionKind.Set, OclInteger.Type), OclCollectionType.Collection(OclCollectionKind.Sequence, OclInteger.Type));
            TestNonConformant(OclCollectionType.Collection(OclCollectionKind.Set, OclInteger.Type), OclCollectionType.Collection(OclCollectionKind.Sequence, OclAny.Type));
            TestNonConformant(OclCollectionType.Collection(OclCollectionKind.Collection, OclInteger.Type), OclCollectionType.Collection(OclCollectionKind.Collection, OclString.Type));
        }
Пример #2
0
 public void CollectionTypeTest()
 {
     TestUtils.AreEqual(new OclSequence(OclInteger.Type).oclType(), OclCollectionType.Collection(OclCollectionKind.Sequence, OclInteger.Type));
     TestUtils.AreNotEqual(new OclSequence(OclInteger.Type).oclType(), OclCollectionType.Collection(OclCollectionKind.Collection, OclInteger.Type));
     TestUtils.AreEqual(new OclSet(OclInteger.Type).oclType(), OclCollectionType.Collection(OclCollectionKind.Set, OclInteger.Type));
     TestUtils.AreNotEqual(new OclSet(OclInteger.Type).oclType(), OclCollectionType.Collection(OclCollectionKind.Collection, OclInteger.Type));
     TestUtils.AreEqual(new OclOrderedSet(OclInteger.Type).oclType(), OclCollectionType.Collection(OclCollectionKind.OrderedSet, OclInteger.Type));
     TestUtils.AreNotEqual(new OclOrderedSet(OclInteger.Type).oclType(), OclCollectionType.Collection(OclCollectionKind.Collection, OclInteger.Type));
     TestUtils.AreEqual(new OclBag(OclInteger.Type).oclType(), OclCollectionType.Collection(OclCollectionKind.Bag, OclInteger.Type));
     TestUtils.AreNotEqual(new OclBag(OclInteger.Type).oclType(), OclCollectionType.Collection(OclCollectionKind.Collection, OclInteger.Type));
 }
Пример #3
0
 public void CollectionIncludingTypeTest()
 {
     TestUtils.AreEqual(OclCollectionType.Collection(OclCollectionKind.Sequence, OclReal.Type), new OclSequence(OclInteger.Type).including(OclReal.Type, (OclReal)0.5).oclType());
 }