public void IterationDeleteTest(int from, int to) { var intSet = new Kibnet.IntSet(); for (int i = from; i < to; i++) { intSet.Add(i); } for (int i = from; i < to; i++) { Assert.True(intSet.Contains(i)); intSet.Remove(i); for (int j = from; j < to; j++) { if (i >= j) { Assert.False(intSet.Contains(j)); } else { Assert.True(intSet.Contains(j)); } } } }
public void SimpleDeleteTest() { var intSet = new Kibnet.IntSet(); for (int i = 100000; i < 200000; i++) { intSet.Add(i); Assert.True(intSet.Contains(i)); intSet.Remove(i); Assert.False(intSet.Contains(i)); } }
public void SimpleContainsTest() { var intSet = new Kibnet.IntSet(); for (int i = 0; i < 100000; i++) { intSet.Add(i); } for (int i = 0; i < 100000; i++) { Assert.True(intSet.Contains(i)); } for (int i = 100000; i < 200000; i++) { Assert.False(intSet.Contains(i)); } }
public void EmptySetTest(int from, int to) { var intSet = new Kibnet.IntSet(); foreach (var i in TestHelper.GetEnumerable(from, to)) { Assert.False(intSet.Contains(i)); } }
public void BoundContainsTest(int value) { var intSet = new Kibnet.IntSet(); { intSet.Add(value); } Assert.True(intSet.Contains(value)); }
public void FullSetTest(int from, int to) { var intSet = new Kibnet.IntSet(false, true); intSet.Add(0); foreach (var i in TestHelper.GetEnumerable(from, to)) { Assert.True(intSet.Contains(i)); } }
public void FullEnumeratorTest() { var intSet = new Kibnet.IntSet(false, true); var last = -1; foreach (var i in intSet.Take(100000)) { Assert.Equal(last + 1, i); Assert.True(intSet.Contains(i)); last = i; } }
public void Card0FullTest() { var intSet = new Kibnet.IntSet(); intSet.Add(0); var card0 = intSet.root.Cards.FirstOrDefault(card => card != null); card0.Full = true; card0.Cards = null; intSet.Add(0); Assert.True(intSet.Contains(0)); }
public void NotEvensTest(int from, int to) { var intSet = new Kibnet.IntSet(); foreach (var i in TestHelper.GetEnumerable(from, to)) { if (i % 2 != 0) { intSet.Add(i); } } foreach (var i in TestHelper.GetEnumerable(from, to)) { if (i % 2 != 0) { Assert.True(intSet.Contains(i)); } else { Assert.False(intSet.Contains(i)); } } }