Beispiel #1
0
        public void Exclude()
        {
            CheckExclude(Range.EndsWith(5, true), Range.Create(2, 3, true, true), "..(2)", "(3)..5");
            CheckExclude(Range.EndsWith(5, true), Range.Create(2, 5, true, false), "..(2)", "5");
            CheckExclude(Range.EndsWith(5, true), Range.Create(2, 5, true, true), "..(2)");
            CheckExclude(Range.EndsWith(5, false), Range.Create(2, 5, true, true), "..(2)");
            CheckExclude(Range.EndsWith(5, false), Range.Create(2, 5, true, false), "..(2)");

            CheckExclude(Range.Create(0, 5, true, true), Range.Create(2, 5, true, true), "0..(2)");
            CheckExclude(Range.Create(0, 5, true, true), Range.Create(2, 10, true, true), "0..(2)");
            CheckExclude(Range.Create(0, 5, true, true), Range.StartsWith(2, true), "0..(2)");
            CheckExclude(Range.Create(0, 5, true, true), Range.StartsWith(5, false), "0..5");
            CheckExclude(Range.Create(0, 5, true, true), Range.StartsWith(5, true), "0..(5)");
        }
Beispiel #2
0
        public void Union()
        {
            CheckUnion(Range <int> .Empty, Range <int> .Full, "...");

            CheckUnion(Range <int> .Empty, Range.StartsWith(5, true), "5..");
            CheckUnion(Range <int> .Empty, Range.StartsWith(5, false), "(5)..");

            CheckUnion(Range.StartsWith(5, false), Range.EndsWith(10, true), "...");
            CheckUnion(Range.StartsWith(5, false), Range.EndsWith(10, false), "...");

            CheckUnion(Range.StartsWith(5, true), Range.StartsWith(10, true), "5..");
            CheckUnion(Range.StartsWith(5, false), Range.StartsWith(10, true), "(5)..");

            CheckUnion(Range.EndsWith(5, true), Range.EndsWith(10, true), "..10");
            CheckUnion(Range.EndsWith(5, false), Range.EndsWith(10, false), "..(10)");
        }
Beispiel #3
0
        public void Intersect()
        {
            CheckIntersect(Range.Full <int>(), Range.Full <int>(), Range.Full <int>());
            CheckIntersect(Range.Full <int>(), Range.Empty <int>(), Range.Empty <int>());
            CheckIntersect(Range.Full <int>(), Range.StartsWith(10), Range.StartsWith(10));
            CheckIntersect(Range.Empty <int>(), Range.Empty <int>(), Range.Empty <int>());

            CheckIntersect(Range.EndsWith(10, true), Range.Create(0, 10, true, true), Range.Create(0, 10, true));
            CheckIntersect(Range.EndsWith(10, false), Range.Create(0, 10, true, true), Range.Create(0, 10, true, false));

            CheckIntersect(Range.EndsWith(10, false), Range.StartsWith(10, true));
            CheckIntersect(Range.EndsWith(10, false), Range.StartsWith(10, false));

            CheckIntersect(Range.EndsWith(10, true), Range.StartsWith(10, true), Range.Simple(10));

            CheckIntersect(Range.EndsWith(10, true), Range.Create(0, 9, true), Range.Create(0, 9, true));
            CheckIntersect(Range.EndsWith(10, true), Range.Create(0, 9, true, false), Range.Create(0, 9, true, false));

            CheckIntersect(Range.Create(0, 10, true), Range.Create(0, 2, false, false), Range.Create(0, 2, false, false));
        }