public void ProductTest() { OclBag a = TestUtils.CreateIntBag(1, 2); OclBag b = TestUtils.CreateIntBag(1, 3); OclTupleType tupleType = OclTupleType.Tuple(OclTupleType.Part("first", OclInteger.Type), OclTupleType.Part("second", OclInteger.Type)); OclSet pr = new OclSet(tupleType, new OclTuple(tupleType, (OclInteger)1, (OclInteger)1), new OclTuple(tupleType, (OclInteger)1, (OclInteger)3), new OclTuple(tupleType, (OclInteger)2, (OclInteger)1), new OclTuple(tupleType, (OclInteger)2, (OclInteger)3) ); TestUtils.AreEqual(pr, a.product(b)); }
public void TupleTypeTest() { OclClassifier type1 = OclTupleType.Tuple(OclTupleType.Part("i", OclInteger.Type), OclTupleType.Part("s", OclString.Type)); OclClassifier type11 = OclTupleType.Tuple(OclTupleType.Part("i", OclInteger.Type), OclTupleType.Part("s", OclString.Type)); OclClassifier type2 = OclTupleType.Tuple(OclTupleType.Part("i", OclReal.Type), OclTupleType.Part("s", OclString.Type)); OclClassifier type3 = OclTupleType.Tuple(OclTupleType.Part("x", OclInteger.Type), OclTupleType.Part("s", OclString.Type)); OclClassifier type4 = OclTupleType.Tuple(OclTupleType.Part("s", OclString.Type), OclTupleType.Part("i", OclInteger.Type)); TestUtils.AreEqual(type1, type11); TestUtils.AreNotEqual(type1, type2); TestUtils.AreNotEqual(type1, type3); TestUtils.AreNotEqual(type1, type4); TestConformantToSelf(type1); TestUtils.AreEqual(OclBoolean.True, type1.conformsTo(type11)); TestUtils.AreEqual(OclBoolean.True, type11.conformsTo(type1)); TestConformant(type1, type2); TestNonConformant(type1, type3); TestNonConformant(type1, type4); }