public void TestAdd() { int value = Generator.GetInt32(); ImmutableSortedTreeSet <int> .Builder set = ImmutableSortedTreeSet.CreateBuilder <int>(); Assert.Empty(set); set.Add(value); Assert.Single(set); Assert.Equal(value, set.First()); int[] expected = { value }; int[] actual = set.ToArray(); Assert.Equal(expected, actual); }
public void TestAddMany() { int[] expected = { 600, 601, 602, 603, 700, 701, 702, 703, 800, 801, 802, 803 }; ImmutableSortedTreeSet <int> .Builder set = ImmutableSortedTreeSet.CreateBuilder <int>(); foreach (int item in expected) { set.Add(item); } Assert.Equal(expected.Length, set.Count); int[] actual = set.ToArray(); Assert.Equal(expected, actual); }