public IValueSet Union(IEnumerable <IValueSet> valueSets) { IValueSet Current = this; foreach (IValueSet Set in valueSets) { Current = Current.Union(Set); } return(Current); }
public void TestString_Cov_01() { var s1 = ForString.Related(Equal, "a"); var s2 = ForString.Related(Equal, "b"); Assert.True(s1.Intersect(s2).IsEmpty); Assert.True(s1.Complement().Union(s2.Complement()).Complement().IsEmpty); Assert.Equal(s1.Union(s2).Complement(), s1.Complement().Intersect(s2.Complement())); IValueSet b = s1; Assert.Same(b.Intersect(b), b); Assert.Same(b.Union(b), b); Assert.False(s1.Union(s2).All(Equal, "a")); }
IValueSet IValueSetFactory.Random(int expectedSize, Random random) { TTC tc = default; T[] values = tc.RandomValues(expectedSize, random, expectedSize * 2); IValueSet <T> result = EnumeratedValueSet <T, TTC> .AllValues.Complement(); Debug.Assert(result.IsEmpty); foreach (T value in values) { result = result.Union(Related(Equal, value)); } return(result); }
public void TestDouble_Cov_01() { var s1 = ForDouble.Related(LessThan, 3.14d); IValueSet b = s1; Assert.Same(s1, s1.Intersect(s1)); Assert.Same(s1, s1.Union(s1)); var s2 = ForDouble.Related(GreaterThan, 31.4d); var s3 = b.Complement().Intersect(s2.Complement()); Assert.Equal("NaN,[3.1400000000000001..31.399999999999999]", s3.ToString()); var s4 = b.Union(s2).Complement(); Assert.Equal(s3, s4); }
public void TestBool_Cov_01() { var t = ForBool.Related(Equal, true); var f = ForBool.Related(Equal, false); var em = t.Intersect(f); Assert.True(em.IsEmpty); var q = t.Intersect(t); Assert.Same(t, q); IValueSet b = t; Assert.Same(b.Intersect(b), b); Assert.Same(b.Union(b), b); }