public void NullPredicateInMaxRightMinLeftTest()
        {
            var lst = new LazySegmentTree <int, int>(10, new SimpleOracle());

            Assert.Throws <ArgumentNullException>(() => _ = lst.MaxRight(10, null));
            Assert.Throws <ArgumentNullException>(() => _ = lst.MinLeft(0, null));
        }
        public void InvalidArgumentInMaxRightMinLeftTest()
        {
            var lst = new LazySegmentTree <int, int>(10, new SimpleOracle());

            Assert.Throws <ArgumentException>(() => _ = lst.MaxRight(10, monoid => false));
            Assert.Throws <ArgumentException>(() => _ = lst.MinLeft(0, monoid => false));
        }
        public void ArgumentOutOfRangeInMaxRightMinLeftTest([Values(-1, 11)] int i)
        {
            var lst = new LazySegmentTree <int, int>(10, new SimpleOracle());

            Assert.Throws <ArgumentOutOfRangeException>(() => _ = lst.MaxRight(i, monoid => true));
            Assert.Throws <ArgumentOutOfRangeException>(() => _ = lst.MinLeft(i, monoid => true));
        }
        public void EdgeTest()
        {
            var lst = new LazySegmentTree <Monoid, Map>(10, new Oracle());

            for (var i = 0; i < 10; i++)
            {
                lst.Set(i, new Monoid(i, i + 1, -1));
            }
            Assert.That(lst.MaxRight(10, x => true), Is.EqualTo(10));
            Assert.That(lst.MinLeft(0, x => true), Is.Zero);
        }
        public void MaxLeftTest([Range(1, 30)] int n)
        {
            for (var ph = 0; ph < 10; ph++)
            {
                var lst         = new LazySegmentTree <Monoid, Map>(n, new Oracle());
                var timeManager = new TimeManager(n);
                for (var i = 0; i < n; i++)
                {
                    lst.Set(i, new Monoid(i, i + 1, -1));
                }
                var now = 0;
                for (var q = 0; q < 1000; q++)
                {
                    var ty = Utilities.RandomInteger(0, 2);
                    var(l, r) = Utilities.RandomPair(0, n);
                    if (ty == 0)
                    {
                        bool F(Monoid s)
                        {
                            if (s.L == -1)
                            {
                                return(true);
                            }
                            return(l <= s.L);
                        }

                        Assert.That(lst.MinLeft(r, F), Is.EqualTo(l));
                    }
                    else
                    {
                        now++;
                        lst.Apply(l, r, new Map(now));
                        timeManager.Action(l, r, now);
                    }
                }
            }
        }