Exemple #1
0
        public void when_set_is_empty_popany_is_not_applicable(IntSet set)
        {
            Assume.That(set.IsEmpty);

            MutableIntSet editedSet = set.EditCopy();
            int           value     = editedSet.PopAny();
        }
        public void set_has_correct_content_after_removing_value(IntSet set, int value)
        {
            MutableIntSet editedSet    = set.EditCopy();
            int           initialCount = editedSet.Count;

            editedSet.Remove(value);
            int finalCount = editedSet.Count;

            Assert.IsFalse(editedSet.Contains(value));
            Assert.IsTrue(finalCount == initialCount || finalCount + 1 == initialCount);
        }
        public void set_has_correct_content_after_adding_set(IntSet set, IntSet other)
        {
            MutableIntSet editedSet = set.EditCopy();

            editedSet.AddAll(other);
            Assert.IsTrue(editedSet.IsSupersetOf(other));
            Assert.IsTrue(set.Union(other).SetEquals(editedSet));
            IntSet result = editedSet.CompleteAndDestroy();

            Assert.IsTrue(result.IsSupersetOf(other));
            Assert.IsTrue(set.Union(other).SetEquals(result));
        }
        public void set_has_correct_content_after_popany_value(IntSet set)
        {
            Assume.That(!set.IsEmpty);

            MutableIntSet editedSet    = set.EditCopy();
            int           initialCount = editedSet.Count;
            int           value        = editedSet.PopAny();
            int           finalCount   = editedSet.Count;

            Assert.IsFalse(editedSet.Contains(value));
            Assert.AreEqual(initialCount, finalCount + 1);
        }
Exemple #5
0
        public void AddTransition(int from, IntSet symbols, int to)
        {
            var outgoing = Dstates[from].Outgoing;

            foreach (var transition in outgoing)
            {
                if (transition.To == to)
                {
                    transition.Symbols.AddAll(symbols);
                    return;
                }
            }

            outgoing.Add(new TdfaTransition(from, symbols.EditCopy(), to));
        }
Exemple #6
0
        public void addall_with_set_of_different_size(IntSet set)
        {
            var otherSetType = new BitSetType(10);
            var other        = otherSetType.Of(2, 5, 9);

            MutableIntSet editedSet = set.EditCopy();

            editedSet.AddAll(other);
            Assert.IsTrue(editedSet.IsSupersetOf(other));
            Assert.IsTrue(set.Union(other).SetEquals(editedSet));
            IntSet result = editedSet.CompleteAndDestroy();

            Assert.IsTrue(result.IsSupersetOf(other));
            Assert.IsTrue(set.Union(other).SetEquals(result));
        }
        public void set_has_correct_content_after_adding_value(IntSet set, int value)
        {
            MutableIntSet editedSet = set.EditCopy();

            Assert.AreEqual(set.Contains(value), editedSet.Contains(value));
            editedSet.Add(value);
            Assert.IsTrue(editedSet.Contains(value));

            Assert.IsTrue(editedSet.Contains(value));
            Assert.IsTrue(set.Union(IntSet.Of(value)).SetEquals(editedSet));
            IntSet result = editedSet.CompleteAndDestroy();

            Assert.IsTrue(result.Contains(value));
            Assert.IsTrue(set.IsSubsetOf(result));
            Assert.IsTrue(set.Union(IntSet.Of(value)).SetEquals(result));
        }
        public void addall_with_set_of_different_size(IntSet set)
        {
            var otherSetType = new BitSetType(10);
            var other = otherSetType.Of(2, 5, 9);

            MutableIntSet editedSet = set.EditCopy();
            editedSet.AddAll(other);
            Assert.IsTrue(editedSet.IsSupersetOf(other));
            Assert.IsTrue(set.Union(other).SetEquals(editedSet));
            IntSet result = editedSet.CompleteAndDestroy();
            Assert.IsTrue(result.IsSupersetOf(other));
            Assert.IsTrue(set.Union(other).SetEquals(result));
        }
        public void when_set_is_empty_popany_is_not_applicable(IntSet set)
        {
            Assume.That(set.IsEmpty);

            MutableIntSet editedSet = set.EditCopy();
            int value = editedSet.PopAny();
        }
 public void set_has_correct_content_after_removing_value(IntSet set, int value)
 {
     MutableIntSet editedSet = set.EditCopy();
     int initialCount = editedSet.Count;
     editedSet.Remove(value);
     int finalCount = editedSet.Count;
     Assert.IsFalse(editedSet.Contains(value));
     Assert.IsTrue(finalCount == initialCount || finalCount + 1 == initialCount);
 }
        public void set_has_correct_content_after_popany_value(IntSet set)
        {
            Assume.That(!set.IsEmpty);

            MutableIntSet editedSet = set.EditCopy();
            int initialCount = editedSet.Count;
            int value = editedSet.PopAny();
            int finalCount = editedSet.Count;
            Assert.IsFalse(editedSet.Contains(value));
            Assert.AreEqual(initialCount, finalCount + 1);
        }
        public void set_has_correct_content_after_adding_value(IntSet set, int value)
        {
            MutableIntSet editedSet = set.EditCopy();
            Assert.AreEqual(set.Contains(value), editedSet.Contains(value));
            editedSet.Add(value);
            Assert.IsTrue(editedSet.Contains(value));

            Assert.IsTrue(editedSet.Contains(value));
            Assert.IsTrue(set.Union(IntSet.Of(value)).SetEquals(editedSet));
            IntSet result = editedSet.CompleteAndDestroy();
            Assert.IsTrue(result.Contains(value));
            Assert.IsTrue(set.IsSubsetOf(result));
            Assert.IsTrue(set.Union(IntSet.Of(value)).SetEquals(result));
        }
 public void set_has_correct_content_after_adding_set(IntSet set, IntSet other)
 {
     MutableIntSet editedSet = set.EditCopy();
     editedSet.AddAll(other);
     Assert.IsTrue(editedSet.IsSupersetOf(other));
     Assert.IsTrue(set.Union(other).SetEquals(editedSet));
     IntSet result = editedSet.CompleteAndDestroy();
     Assert.IsTrue(result.IsSupersetOf(other));
     Assert.IsTrue(set.Union(other).SetEquals(result));
 }