Exemplo n.º 1
0
        public void OperationsTest()
        {
            OclOrderedSet source = TestUtils.CreateIntOrderedSet(1, 2, 3, 1);

            TestUtils.AreEqual((OclInteger)3, source.size());
            TestUtils.AreEqual((OclBoolean)true, source.includes((OclInteger)1));
            TestUtils.AreEqual((OclBoolean)false, source.excludes((OclInteger)1));
            TestUtils.AreEqual((OclInteger)1, source.count((OclInteger)1));
            TestUtils.AreEqual((OclBoolean)false, source.includesAll(TestUtils.CreateIntSet(1, 4)));
            TestUtils.AreEqual((OclBoolean)false, source.excludesAll(TestUtils.CreateIntSet(1, 4)));
            TestUtils.AreEqual((OclBoolean)false, source.isEmpty());
            TestUtils.AreEqual((OclBoolean)true, source.notEmpty());

            TestUtils.AreEqual(TestUtils.CreateIntOrderedSet(1, 2, 3, 4), source.append(OclInteger.Type, (OclInteger)4));
            TestUtils.AreEqual(TestUtils.CreateIntOrderedSet(4, 1, 2, 3), source.prepend(OclInteger.Type, (OclInteger)4));
            TestUtils.AreEqual(TestUtils.CreateIntOrderedSet(1, 4, 2, 3), source.insertAt(OclInteger.Type, (OclInteger)2, (OclInteger)4));
            TestUtils.AreEqual(TestUtils.CreateIntOrderedSet(2, 3), source.subOrderedSet((OclInteger)2, (OclInteger)3));
            TestUtils.AreEqual((OclInteger)2, source.at <OclInteger>((OclInteger)2));
            TestUtils.AreEqual((OclInteger)3, source.indexOf((OclInteger)3));

            TestUtils.AreEqual((OclInteger)1, source.first <OclInteger>());
            TestUtils.AreEqual((OclInteger)3, source.last <OclInteger>());

            TestUtils.AreEqual(TestUtils.CreateIntOrderedSet(3, 2, 1), source.reverse());
        }