コード例 #1
0
ファイル: SortedSetTest.cs プロジェクト: mesheets/Theraot-CF
		public void ViewSymmetricExceptWith ()
		{
			var set = new SortedSet<int> { 1, 3, 5, 7, 9 };
			var view = set.GetViewBetween (4, 8);
			view.SymmetricExceptWith (new [] { 4, 5, 6, 6, 4 });
			Assert.IsTrue (view.SequenceEqual (new [] { 4, 6, 7 }));
			Assert.IsTrue (set.SequenceEqual (new [] { 1, 3, 4, 6, 7, 9 }));
		}
コード例 #2
0
ファイル: SortedSetTest.cs プロジェクト: mesheets/Theraot-CF
		public void UnionWith ()
		{
			var set = new SortedSet<int> { 1, 3, 5, 7, 9 };
			set.UnionWith (new [] { 5, 7, 3, 7, 11, 7, 5, 2 });
			Assert.IsTrue (set.SequenceEqual (new [] { 1, 2, 3, 5, 7, 9, 11 }));
		}
コード例 #3
0
ファイル: SortedSetTest.cs プロジェクト: mesheets/Theraot-CF
		public void SymmetricExceptWith ()
		{
			var set = new SortedSet<int> { 1, 3, 5, 7, 9 };
			set.SymmetricExceptWith (new [] { 5, 7, 3, 7, 11, 7, 5, 2 });
			Assert.IsTrue (set.SequenceEqual (new [] { 1, 2, 9, 11 }));
		}
コード例 #4
0
ファイル: SortedSetTest.cs プロジェクト: mesheets/Theraot-CF
		public void ViewIntersectWith ()
		{
			var set = new SortedSet<int> { 1, 3, 5, 7, 9 };
			var view = set.GetViewBetween (4, 8);
			view.IntersectWith (new [] { 1, 5, 9 });
			Assert.IsTrue (view.SequenceEqual (new [] { 5 }));
			Assert.IsTrue (set.SequenceEqual (new [] { 1, 3, 5, 9 }));
			view.IntersectWith (new [] { 1, 2 });
			Assert.IsTrue (view.SequenceEqual (new int [] {}));
			Assert.IsTrue (set.SequenceEqual (new [] { 1, 3, 9 }));
		}
コード例 #5
0
ファイル: SortedSetTest.cs プロジェクト: mesheets/Theraot-CF
		public void IntersectWith ()
		{
			var set = new SortedSet<int> { 1, 3, 5, 7, 9 };
			set.IntersectWith (new [] { 5, 7, 3, 7, 11, 7, 5, 2 });
			Assert.IsTrue (set.SequenceEqual (new [] { 3, 5, 7 }));
		}
コード例 #6
0
ファイル: SortedSetTest.cs プロジェクト: mesheets/Theraot-CF
		public void ViewClear ()
		{
			var set = new SortedSet<int> { 1, 3, 5, 7, 9 };
			var view = set.GetViewBetween (3, 7);

			view.Clear ();

			Assert.AreEqual (0, view.Count);
			Assert.IsTrue (set.SequenceEqual (new [] { 1, 9 }));
		}
コード例 #7
0
ファイル: SortedSetTest.cs プロジェクト: mesheets/Theraot-CF
		public void RemoveWhere ()
		{
			var set = new SortedSet<int> { 1, 2, 3, 4, 5, 6 };
			Assert.AreEqual (3, set.RemoveWhere (i => i % 2 == 0));
			Assert.AreEqual (3, set.Count);
			Assert.IsTrue (set.SequenceEqual (new [] { 1, 3, 5 }));

		}
コード例 #8
0
ファイル: SortedSetTest.cs プロジェクト: mesheets/Theraot-CF
		public void GetEnumerator ()
		{
			var set = new SortedSet<int> { 5, 3, 1, 2, 6, 4  };
			Assert.IsTrue (set.SequenceEqual (new [] { 1, 2, 3, 4, 5, 6 }));
		}