public void IntersectWithIsCorrect() { var set = new MySet <int> { 1, 3, 0, 2, 4 }; var list = new List <int>() { 0, 1, 5 }; set.IntersectWith(list); Assert.IsTrue(set.Contains(0)); Assert.IsTrue(set.Contains(1)); Assert.IsFalse(set.Contains(5)); Assert.IsFalse(set.Contains(3)); }
public void TestSetMerge() { MySet myset1 = new MySet(SimpleBitmap.BitmapOf); myset1.Add(new Node() { Name = "a", Number = 1 }); myset1.Add(new Node() { Name = "a", Number = 3 }); MySet myset2 = new MySet(SimpleBitmap.BitmapOf); myset2.Add(new Node() { Name = "a", Number = 2 }); myset2.Add(new Node() { Name = "b", Number = 1 }); MySet myset3 = MySet.Merge(myset1, myset2, SimpleBitmap.BitmapOf); Assert.IsTrue(myset3.Contains(new Node() { Name = "a", Number = 1 })); Assert.IsTrue(myset3.Contains(new Node() { Name = "a", Number = 2 })); Assert.IsTrue(myset3.Contains(new Node() { Name = "a", Number = 3 })); Assert.IsTrue(myset3.Contains(new Node() { Name = "b", Number = 1 })); }
public void TestSet() { MySet myset = new MySet(SimpleBitmap.BitmapOf); var node = new Node() { Name = "Name", Number = 1 }; myset.Add(node); Assert.IsTrue(myset.Contains(node)); Assert.IsFalse(myset.Contains(new Node() { Name = "Name", Number = 2 })); Assert.IsFalse(myset.Contains(new Node() { Name = "Name_", Number = 1 })); }
public void ExceptWithIsCorrect() { var set = new MySet <int>(); set.Add(1); set.Add(3); set.Add(0); set.Add(2); set.Add(4); var list = new List <int>() { 0, 1, 5 }; set.ExceptWith(list); Assert.IsFalse(set.Contains(0)); Assert.IsFalse(set.Contains(1)); Assert.IsTrue(set.Contains(4)); }
public void ClearIsCorrect() { var set = new MySet <string>(); set.Add("abc"); set.Add("aaa"); set.Add("bbb"); set.Add("ccc"); set.Clear(); Assert.AreEqual(0, set.Count); Assert.IsFalse(set.Contains("aaa")); }
public void ContainsFailTest() { MySet <int> s = new MySet <int>(); for (int i = 0; i < 1000; i++) { s.Add(i); } bool expected = true; bool actual = s.Contains(2000); Assert.AreNotEqual(expected, actual); }
public void UnionIsCorrect() { var set = new MySet <int>() { 0, 2, 4, 5, 6, 8 }; var list = new List <int>() { 0, 1, 2, 3, 4, 6, 7, 8 }; set.UnionWith(list); Assert.IsTrue(set.Contains(0)); Assert.IsTrue(set.Contains(1)); Assert.IsTrue(set.Contains(2)); Assert.IsTrue(set.Contains(3)); Assert.IsTrue(set.Contains(4)); Assert.IsTrue(set.Contains(5)); Assert.IsTrue(set.Contains(6)); Assert.IsTrue(set.Contains(7)); Assert.IsTrue(set.Contains(8)); Assert.AreEqual(9, set.Count); }
public void AdditionIsCorrect() { var set = new MySet <int>(); set.Add(1); set.Add(3); set.Add(0); set.Add(2); set.Add(4); Assert.IsTrue(set.Contains(1)); Assert.IsTrue(set.Contains(2)); Assert.IsTrue(set.Contains(3)); Assert.IsTrue(set.Contains(4)); Assert.IsTrue(set.Contains(0)); Assert.IsFalse(set.Contains(-1)); }
public void SymmetricExceptIsCorrect() { var set = new MySet <int>() { 0, 2, 4, 5, 6, 8 }; var list = new List <int>() { 0, 1, 2, 3, 4, 6, 7, 8 }; set.SymmetricExceptWith(list); Assert.IsTrue(set.Contains(1)); Assert.IsTrue(set.Contains(3)); Assert.IsTrue(set.Contains(7)); Assert.IsFalse(set.Contains(0)); Assert.IsFalse(set.Contains(2)); Assert.IsFalse(set.Contains(8)); }
public void ContainsTrueTest() { set.Add(1); Assert.IsTrue(set.Contains(1)); }
static void Main(string [] args) { Console.WriteLine(_haltingSet.Contains(args[0])); }