Ejemplo n.º 1
0
        public void TransitiveRelationTest()
        {
            var s = new Set <int>();

            s.Add(2);
            s.Add(3);
            s.Add(4);

            var r = new TransitiveRelation2 <int>();

            r.Add(new OrderedTuple2 <int>(2, 3));
            r.Add(new OrderedTuple2 <int>(3, 4));
            s.relations.Add(r);

            Assert.AreEqual(true, s.Is <TransitiveRelation2 <int> >(2, 4));
            Assert.AreEqual(true, s.Is <TransitiveRelation2 <int> >(2, 3));
            Assert.AreEqual(false, s.Is <TransitiveRelation2 <int> >(2, 5));
            Assert.AreEqual(false, s.Is <TransitiveRelation2 <int> >(4, 2));
        }
Ejemplo n.º 2
0
        public void TransitiveRelationTest()
        {
            var s = new Set <int>();

            s.elems.Add(2);
            s.elems.Add(3);
            s.elems.Add(4);

            var r = new TransitiveRelation2 <int>();

            r.elems.Add(new OrderedTuple2 <int>(2, 3));
            r.elems.Add(new OrderedTuple2 <int>(3, 4));
            s.relations.Add(r);

            Assert.AreEqual((typeof(TransitiveRelationAttribute), true),
                            s.Is <TransitiveRelation2 <int> >(2, 4));
            Assert.AreEqual((typeof(RelationKindAttribute), true),
                            s.Is <TransitiveRelation2 <int> >(2, 3));
            Assert.AreEqual((typeof(RelationKindAttribute), false),
                            s.Is <TransitiveRelation2 <int> >(2, 5));
            Assert.AreEqual((typeof(RelationKindAttribute), false),
                            s.Is <TransitiveRelation2 <int> >(4, 2));
        }