Beispiel #1
0
        public void UnitRdvq_Skip()
        {
            Setup(4);

            Assert.AreEqual(0, SLE.Count(dary1.Values.Skip(-1)));
            Assert.AreEqual(0, SLE.Count(dary1.Values.Skip(0)));
            Assert.AreEqual(0, SLE.Count(dary1.Values.Skip(1)));

            dary1.Add(1, 11);
            dary1.Add(2, 22);

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 11, 22 }, dary1.Values.Skip(-1)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 11, 22 }, dary1.Values.Skip(0)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 22 }, dary1.Values.Skip(1)));

            Assert.AreEqual(0, SLE.Count(dary1.Values.Skip(0).Skip(2)));
            Assert.AreEqual(0, SLE.Count(dary1.Values.Skip(0).Skip(3)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 11, 22 }, dary1.Values.Skip(0).Skip(-1)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 11, 22 }, dary1.Values.Skip(0).Skip(0)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 22 }, dary1.Values.Skip(0).Skip(1)));

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 22 }, dary1.Values.Skip(1).Skip(-1)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 22 }, dary1.Values.Skip(1).Skip(0)));

            Assert.AreEqual(0, SLE.Count(dary1.Values.Skip(2).Skip(0)));
            Assert.AreEqual(0, SLE.Count(dary1.Values.Skip(2).Skip(1)));

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 22, 11 }, dary1.Values.Reverse().Skip(-1)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 22, 11 }, dary1.Values.Reverse().Skip(0)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 11 }, dary1.Values.Reverse().Skip(1)));
            Assert.AreEqual(0, SLE.Count(dary1.Values.Reverse().Skip(2)));
            Assert.AreEqual(0, SLE.Count(dary1.Values.Reverse().Skip(3)));
        }
Beispiel #2
0
        public void UnitRdq_Skip()
        {
            Setup(4);

            Assert.AreEqual(0, SLE.Count(dary1.Skip(-1)));
            Assert.AreEqual(0, SLE.Count(dary1.Skip(0)));
            Assert.AreEqual(0, SLE.Count(dary1.Skip(1)));

            dary1.Add(1, 11); dary1.Add(2, 22);
            var p1 = new SCG.KeyValuePair <int, int> (1, 11);
            var p2 = new SCG.KeyValuePair <int, int> (2, 22);

            Assert.IsTrue(SLE.SequenceEqual(new SCG.KeyValuePair <int, int>[] { p1, p2 }, dary1.Skip(-1)));
            Assert.IsTrue(SLE.SequenceEqual(new SCG.KeyValuePair <int, int>[] { p1, p2 }, dary1.Skip(0)));
            Assert.IsTrue(SLE.SequenceEqual(new SCG.KeyValuePair <int, int>[] { p2 }, dary1.Skip(1)));

            Assert.AreEqual(0, SLE.Count(dary1.Skip(0).Skip(2)));
            Assert.AreEqual(0, SLE.Count(dary1.Skip(0).Skip(3)));
            Assert.IsTrue(SLE.SequenceEqual(new SCG.KeyValuePair <int, int>[] { p1, p2 }, dary1.Skip(0).Skip(-1)));
            Assert.IsTrue(SLE.SequenceEqual(new SCG.KeyValuePair <int, int>[] { p1, p2 }, dary1.Skip(0).Skip(0)));
            Assert.IsTrue(SLE.SequenceEqual(new SCG.KeyValuePair <int, int>[] { p2 }, dary1.Skip(0).Skip(1)));

            Assert.IsTrue(SLE.SequenceEqual(new SCG.KeyValuePair <int, int>[] { p2 }, dary1.Skip(1).Skip(-1)));
            Assert.IsTrue(SLE.SequenceEqual(new SCG.KeyValuePair <int, int>[] { p2 }, dary1.Skip(1).Skip(0)));

            Assert.AreEqual(0, SLE.Count(dary1.Skip(2).Skip(0)));
            Assert.AreEqual(0, SLE.Count(dary1.Skip(2).Skip(1)));

            Assert.IsTrue(SLE.SequenceEqual(new SCG.KeyValuePair <int, int>[] { p2, p1 }, dary1.Reverse().Skip(-1)));
            Assert.IsTrue(SLE.SequenceEqual(new SCG.KeyValuePair <int, int>[] { p2, p1 }, dary1.Reverse().Skip(0)));
            Assert.IsTrue(SLE.SequenceEqual(new SCG.KeyValuePair <int, int>[] { p1 }, dary1.Reverse().Skip(1)));
            Assert.AreEqual(0, SLE.Count(dary1.Reverse().Skip(2)));
            Assert.AreEqual(0, SLE.Count(dary1.Reverse().Skip(3)));
        }
Beispiel #3
0
        public void UnitRdkq_Skip()
        {
            Setup();

            Assert.AreEqual(0, SLE.Count(dary1.Keys.Skip(-1)));
            Assert.AreEqual(0, SLE.Count(dary1.Keys.Skip(0)));
            Assert.AreEqual(0, SLE.Count(dary1.Keys.Skip(1)));

            dary1.Add(1, -1);
            dary1.Add(2, -2);

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1, 2 }, dary1.Keys.Skip(-1)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1, 2 }, dary1.Keys.Skip(0)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 2 }, dary1.Keys.Skip(1)));
            Assert.AreEqual(0, SLE.Count(dary1.Keys.Skip(2)));
            Assert.AreEqual(0, SLE.Count(dary1.Keys.Skip(3)));

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1, 2 }, dary1.Keys.Skip(0).Skip(-1)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1, 2 }, dary1.Keys.Skip(0).Skip(0)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 2 }, dary1.Keys.Skip(0).Skip(1)));
            Assert.AreEqual(0, SLE.Count(dary1.Skip(0).Skip(3)));

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 2, 1 }, dary1.Keys.Reverse().Skip(-1)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 2, 1 }, dary1.Keys.Reverse().Skip(0)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1 }, dary1.Keys.Reverse().Skip(1)));
            Assert.AreEqual(0, SLE.Count(dary1.Keys.Reverse().Skip(2)));
            Assert.AreEqual(0, SLE.Count(dary1.Keys.Reverse().Skip(3)));
        }
Beispiel #4
0
        public void UnitRbq_Skip()
        {
            var rb = new RankedBag <int> {
                Capacity = 5
            };

            Assert.AreEqual(0, SLE.Count(rb.Skip(0)));
            Assert.AreEqual(0, SLE.Count(rb.Skip(-1)));
            Assert.AreEqual(0, SLE.Count(rb.Skip(1)));

            rb.Add(1);
            rb.Add(2);

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1, 2 }, rb.Skip(-1)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1, 2 }, rb.Skip(0)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 2 }, rb.Skip(1)));
            Assert.AreEqual(0, SLE.Count(rb.Skip(2)));
            Assert.AreEqual(0, SLE.Count(rb.Skip(3)));

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1, 2 }, rb.Skip(0).Skip(-1)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1, 2 }, rb.Skip(0).Skip(0)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 2 }, rb.Skip(0).Skip(1)));
            Assert.AreEqual(0, SLE.Count(rb.Skip(0).Skip(3)));

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 2, 1 }, rb.Reverse().Skip(-1)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 2, 1 }, rb.Reverse().Skip(0)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1 }, rb.Reverse().Skip(1)));
            Assert.AreEqual(0, SLE.Count(rb.Reverse().Skip(2)));
            Assert.AreEqual(0, SLE.Count(rb.Reverse().Skip(3)));
        }
        public void UnitRmkq_Skip()
        {
            var rm = new RankedMap <int, int> {
                Capacity = 5
            };

            Assert.AreEqual(0, SLE.Count(rm.Keys.Skip(-1)));
            Assert.AreEqual(0, SLE.Count(rm.Keys.Skip(0)));
            Assert.AreEqual(0, SLE.Count(rm.Keys.Skip(1)));

            rm.Add(1, -1);
            rm.Add(2, -2);

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1, 2 }, rm.Keys.Skip(-1)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1, 2 }, rm.Keys.Skip(0)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 2 }, rm.Keys.Skip(1)));
            Assert.AreEqual(0, SLE.Count(rm.Keys.Skip(2)));
            Assert.AreEqual(0, SLE.Count(rm.Keys.Skip(3)));

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1, 2 }, rm.Keys.Skip(0).Skip(-1)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1, 2 }, rm.Keys.Skip(0).Skip(0)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 2 }, rm.Keys.Skip(0).Skip(1)));
            Assert.AreEqual(0, SLE.Count(rm.Skip(0).Skip(3)));

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 2, 1 }, rm.Keys.Reverse().Skip(-1)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 2, 1 }, rm.Keys.Reverse().Skip(0)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1 }, rm.Keys.Reverse().Skip(1)));
            Assert.AreEqual(0, SLE.Count(rm.Keys.Reverse().Skip(2)));
            Assert.AreEqual(0, SLE.Count(rm.Keys.Reverse().Skip(3)));
        }
Beispiel #6
0
        public JsonResult GetAllCodigosMovimientoMab(string sidx, string sord, int page, int rows)
        {
            var registros      = Rule.GetAllCodigosMovimientoMabSinGrupoMabAsignado();
            int totalRegistros = Enumerable.Count <CodigoMovimientoMabModel>(registros);
            int totalPages     = (int)Math.Ceiling((decimal)totalRegistros / (decimal)rows);

            registros = Enumerable.ToList <CodigoMovimientoMabModel>(registros.Skip((page - 1) * rows).Take(rows));
            var jsonData = new
            {
                total   = totalPages,
                page    = page,
                records = totalRegistros,
                rows    = from a in registros
                          select new
                {
                    cell = new string[]
                    {
                        a.Id.ToString(),
                a.Codigo,
                a.Descripcion,
                a.Uso,
                a.GrupoMabId.ToString()
                    }
                }
            };

            return(Json(jsonData, JsonRequestBehavior.AllowGet));
        }
Beispiel #7
0
        public void UnitRsq_SkipWhile3F()
        {
            Setup(5);

            Assert.AreEqual(0, SLE.Count(setI.Skip(0).SkipWhile((x, i) => false)));
            Assert.AreEqual(0, SLE.Count(setI.Skip(0).SkipWhile((x, i) => true)));
            Assert.AreEqual(0, SLE.Count(setI.SkipWhile((x, i) => true).SkipWhile((x, i) => true)));

            setI.Add(1);

            Assert.AreEqual(0, SLE.Count(setI.Skip(0).SkipWhile((x, i) => true)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1 }, setI.Skip(0).SkipWhile((x, i) => false)));

            setI.Add(2);
            setI.Add(3);

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 2, 3 }, setI.Skip(0).SkipWhile((x, i) => x % 2 != 0)));

            for (int i = 4; i < 50; ++i)
            {
                setI.Add(i);
            }

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 48, 49 }, setI.Skip(30).SkipWhile((x, i) => x % 3 != 0 || i < 15)));
        }
        public void UnitRmvq_Skip()
        {
            var rm = new RankedMap <int, int> {
                Capacity = 5
            };

            Assert.AreEqual(0, SLE.Count(rm.Values.Skip(-1)));
            Assert.AreEqual(0, SLE.Count(rm.Values.Skip(0)));
            Assert.AreEqual(0, SLE.Count(rm.Values.Skip(1)));

            rm.Add(1, 11);
            rm.Add(2, 22);

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 11, 22 }, rm.Values.Skip(-1)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 11, 22 }, rm.Values.Skip(0)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 22 }, rm.Values.Skip(1)));

            Assert.AreEqual(0, SLE.Count(rm.Values.Skip(0).Skip(2)));
            Assert.AreEqual(0, SLE.Count(rm.Values.Skip(0).Skip(3)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 11, 22 }, rm.Values.Skip(0).Skip(-1)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 11, 22 }, rm.Values.Skip(0).Skip(0)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 22 }, rm.Values.Skip(0).Skip(1)));

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 22 }, rm.Values.Skip(1).Skip(-1)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 22 }, rm.Values.Skip(1).Skip(0)));

            Assert.AreEqual(0, SLE.Count(rm.Values.Skip(2).Skip(0)));
            Assert.AreEqual(0, SLE.Count(rm.Values.Skip(2).Skip(1)));

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 22, 11 }, rm.Values.Reverse().Skip(-1)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 22, 11 }, rm.Values.Reverse().Skip(0)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 11 }, rm.Values.Reverse().Skip(1)));
            Assert.AreEqual(0, SLE.Count(rm.Values.Reverse().Skip(2)));
            Assert.AreEqual(0, SLE.Count(rm.Values.Reverse().Skip(3)));
        }
Beispiel #9
0
        public void UnitRsq_SkipWhile3R()
        {
            Setup(5);

            Assert.AreEqual(0, SLE.Count(setI.Reverse().SkipWhile((x, i) => false)));
            Assert.AreEqual(0, SLE.Count(setI.Reverse().SkipWhile((x, i) => true)));
            Assert.AreEqual(0, SLE.Count(setI.Reverse().SkipWhile((x, i) => true).SkipWhile((x, i) => true)));

            setI.Add(1);

            Assert.AreEqual(0, SLE.Count(setI.Reverse().SkipWhile((x, i) => true)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1 }, setI.Reverse().SkipWhile((x, i) => false)));

            setI.Add(2);
            setI.Add(3);

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 2, 1 }, setI.Reverse().SkipWhile((x, i) => x % 2 != 0)));

            for (int i = 4; i < 50; ++i)
            {
                setI.Add(i);
            }

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 3, 2, 1 }, setI.Reverse().Skip(20).SkipWhile((x, i) => x % 3 != 0 || i < 24)));
        }
Beispiel #10
0
        public void UnitRbq_SkipWhile3R()
        {
            var rb = new RankedBag <int> {
                Capacity = 5
            };

            Assert.AreEqual(0, SLE.Count(rb.Reverse().SkipWhile((x, i) => false)));
            Assert.AreEqual(0, SLE.Count(rb.Reverse().SkipWhile((x, i) => true)));
            Assert.AreEqual(0, SLE.Count(rb.Reverse().SkipWhile((x, i) => true).SkipWhile((x, i) => true)));

            rb.Add(1);

            Assert.AreEqual(0, SLE.Count(rb.Reverse().SkipWhile((x, i) => true)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1 }, rb.Reverse().SkipWhile((x, i) => false)));

            rb.Add(2);
            rb.Add(3);

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 2, 1 }, rb.Reverse().SkipWhile((x, i) => x % 2 != 0)));

            for (int i = 4; i < 50; ++i)
            {
                rb.Add(i);
            }

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 3, 2, 1 }, rb.Reverse().Skip(20).SkipWhile((x, i) => x % 3 != 0 || i < 24)));
        }
Beispiel #11
0
        public void UnitRsq_Skip()
        {
            Setup(4);

            Assert.AreEqual(0, SLE.Count(setI.Skip(-1)));
            Assert.AreEqual(0, SLE.Count(setI.Skip(0)));
            Assert.AreEqual(0, SLE.Count(setI.Skip(1)));
            Assert.AreEqual(0, SLE.Count(setI.Skip(0).Skip(-1)));
            Assert.AreEqual(0, SLE.Count(setI.Skip(0).Skip(0)));
            Assert.AreEqual(0, SLE.Count(setI.Skip(0).Skip(1)));
            Assert.AreEqual(0, SLE.Count(setI.Reverse().Skip(-1)));
            Assert.AreEqual(0, SLE.Count(setI.Reverse().Skip(0)));
            Assert.AreEqual(0, SLE.Count(setI.Reverse().Skip(1)));

            setI.Add(1);

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1 }, setI.Skip(-1)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1 }, setI.Skip(0)));
            Assert.AreEqual(0, SLE.Count(setI.Skip(1)));
            Assert.AreEqual(0, SLE.Count(setI.Skip(2)));
            Assert.AreEqual(0, SLE.Count(setI.Skip(1).Skip(1).Skip(1)));

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1 }, setI.Skip(0).Skip(-1)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1 }, setI.Skip(0).Skip(0)));
            Assert.AreEqual(0, SLE.Count(setI.Skip(0).Skip(1)));
            Assert.AreEqual(0, SLE.Count(setI.Skip(0).Skip(2)));

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1 }, setI.Reverse().Skip(-1)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1 }, setI.Reverse().Skip(0)));
            Assert.AreEqual(0, SLE.Count(setI.Reverse().Skip(1)));
            Assert.AreEqual(0, SLE.Count(setI.Reverse().Skip(2)));
            Assert.AreEqual(0, SLE.Count(setI.Reverse().Skip(1).Skip(1)));

            setI.Add(2);
            setI.Add(3);

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1, 2, 3 }, setI.Skip(-1)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1, 2, 3 }, setI.Skip(0)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 2, 3 }, setI.Skip(1)));
            Assert.AreEqual(0, SLE.Count(setI.Skip(3)));

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 2, 3 }, setI.Skip(0).Skip(1)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 3 }, setI.Skip(1).Skip(1)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 3 }, setI.Skip(0).Skip(2)));
            Assert.AreEqual(0, SLE.Count(setI.Skip(0).Skip(3)));

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 3, 2, 1 }, setI.Reverse().Skip(-1)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 3, 2, 1 }, setI.Reverse().Skip(0)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 2, 1 }, setI.Reverse().Skip(1)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1 }, setI.Reverse().Skip(1).Skip(1)));
            Assert.AreEqual(0, SLE.Count(setI.Reverse().Skip(3)));

            for (int i = 4; i <= 50; ++i)
            {
                setI.Add(i);
            }

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 46, 47, 48, 49, 50 }, setI.Skip(30).Skip(15)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 5, 4, 3, 2, 1 }, setI.Reverse().Skip(30).Skip(15)));
        }
Beispiel #12
0
    public void BlinqShouldEqualLinqNativeArraySequenceCountPredicate([ArrayValues] int[] sourceArr)
    {
        var sourceNativeArr = new NativeArray <int>(sourceArr, Allocator.Persistent);
        var expected        = ExceptionAndValue(() => Linq.Count(sourceNativeArr, EqualsOne.Invoke));
        var actual          = ExceptionAndValue(() => Blinq.Count(sourceNativeArr, EqualsOne));

        AssertAreEqual(expected, actual);
        sourceNativeArr.Dispose();
    }
Beispiel #13
0
        public void UnitRdq_SkipWhile3Ctor()
        {
            Setup(4);
            var p1 = new SCG.KeyValuePair <int, int> (1, 11);
            var p2 = new SCG.KeyValuePair <int, int> (2, 22);

            Assert.AreEqual(0, SLE.Count(dary1.SkipWhile((p, i) => false)));
            Assert.AreEqual(0, SLE.Count(dary1.SkipWhile((p, i) => true)));

            dary1.Add(p1.Key, p1.Value);
            dary1.Add(p2.Key, p2.Value);

            Assert.IsTrue(SLE.SequenceEqual(new SCG.KeyValuePair <int, int>[] { p1, p2 }, dary1.SkipWhile((p, i) => false)));
            Assert.IsTrue(SLE.SequenceEqual(new SCG.KeyValuePair <int, int>[] { p2 }, dary1.SkipWhile((p, i) => p.Key % 2 != 0)));
            Assert.AreEqual(0, SLE.Count(dary1.SkipWhile((p, i) => true)));
        }
Beispiel #14
0
        public void UnitRsq_SkipWhile2Ctor()
        {
            Setup(5);

            Assert.AreEqual(0, SLE.Count(setI.SkipWhile(x => false)));
            Assert.AreEqual(0, SLE.Count(setI.SkipWhile(x => true)));

            setI.Add(1);

            Assert.AreEqual(0, SLE.Count(setI.SkipWhile(x => true)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1 }, setI.SkipWhile(x => false)));

            setI.Add(2);
            setI.Add(3);

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 2, 3 }, setI.SkipWhile(x => x % 2 != 0)));
        }
Beispiel #15
0
        public void UnitRdkq_SkipWhile2F()
        {
            Setup();

            Assert.AreEqual(0, SLE.Count(dary1.Keys.Skip(0).SkipWhile(x => false)));
            Assert.AreEqual(0, SLE.Count(dary1.Keys.Skip(0).SkipWhile(x => true)));

            dary1.Add(1, -1);

            Assert.AreEqual(0, SLE.Count(dary1.Keys.Skip(0).SkipWhile(x => true)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1 }, dary1.Keys.Skip(0).SkipWhile(x => false)));

            dary1.Add(2, -2);
            dary1.Add(3, -3);

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 2, 3 }, dary1.Keys.Skip(0).SkipWhile(x => x % 2 != 0)));
        }
Beispiel #16
0
        public void UnitRdvq_SkipWhile2R()
        {
            Setup(4);

            Assert.AreEqual(0, SLE.Count(dary1.Values.Reverse().SkipWhile(x => false)));
            Assert.AreEqual(0, SLE.Count(dary1.Values.Reverse().SkipWhile(x => true)));

            dary1.Add(1, -1);

            Assert.AreEqual(0, SLE.Count(dary1.Values.Reverse().SkipWhile(x => true)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { -1 }, dary1.Values.Reverse().SkipWhile(x => false)));

            dary1.Add(2, -2);
            dary1.Add(3, -3);

            Assert.IsTrue(SLE.SequenceEqual(new int[] { -2, -1 }, dary1.Values.Reverse().SkipWhile(x => x % 2 != 0)));
        }
Beispiel #17
0
        public void StressRsq_SkipWhile()
        {
            Setup(5);

            for (int x1 = 0; x1 < 20; ++x1)
            {
                setI.Clear();
                for (int x3 = 0; x3 < x1; ++x3)
                {
                    setI.Add(x3);
                }

                System.Collections.Generic.IEnumerable <int> q0 = setI.SkipWhile(x => false);

                Assert.AreEqual(x1, SLE.Count(q0));
            }
        }
        public void UnitRmq_SkipWhile3Ctor()
        {
            var rm = new RankedMap <int, int> {
                Capacity = 4
            };
            var p1 = new SCG.KeyValuePair <int, int> (1, 11);
            var p2 = new SCG.KeyValuePair <int, int> (2, 22);

            Assert.AreEqual(0, SLE.Count(rm.SkipWhile((p, i) => false)));
            Assert.AreEqual(0, SLE.Count(rm.SkipWhile((p, i) => true)));

            rm.Add(p1.Key, p1.Value);
            rm.Add(p2.Key, p2.Value);

            Assert.IsTrue(SLE.SequenceEqual(new SCG.KeyValuePair <int, int>[] { p1, p2 }, rm.SkipWhile((p, i) => false)));
            Assert.IsTrue(SLE.SequenceEqual(new SCG.KeyValuePair <int, int>[] { p2 }, rm.SkipWhile((p, i) => p.Key % 2 != 0)));
            Assert.AreEqual(0, SLE.Count(rm.SkipWhile((p, i) => true)));
        }
Beispiel #19
0
        public void UnitRsq_SkipWhile3Ctor()
        {
            Setup(5);

            Assert.AreEqual(0, SLE.Count(setI.SkipWhile((x, i) => false)));
            Assert.AreEqual(0, SLE.Count(setI.SkipWhile((x, i) => true)));

            setI.Add(1);

            Assert.AreEqual(0, SLE.Count(setI.SkipWhile((x, i) => true)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1 }, setI.SkipWhile((x, i) => false)));

            setI.Add(2);
            setI.Add(3);
            setI.Add(4);

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 4 }, setI.SkipWhile((x, i) => x % 2 != 0 || i < 3)));
        }
Beispiel #20
0
        public void UnitRdvq_SkipWhile3F()
        {
            Setup(4);

            Assert.AreEqual(0, SLE.Count(dary1.Values.Skip(0).SkipWhile((v, i) => false)));
            Assert.AreEqual(0, SLE.Count(dary1.Values.Skip(0).SkipWhile((v, i) => true)));

            dary1.Add(1, -1);
            dary1.Add(2, -2);

            Assert.AreEqual(0, SLE.Count(dary1.Values.Skip(0).SkipWhile((v, i) => true)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { -1, -2 }, dary1.Values.Skip(0).SkipWhile((v, i) => false)));

            dary1.Add(3, -3);
            dary1.Add(4, -4);

            Assert.IsTrue(SLE.SequenceEqual(new int[] { -3, -4 }, dary1.Values.Skip(0).SkipWhile((v, i) => v > -2 || i % 2 != 0)));
        }
Beispiel #21
0
        public void UnitRdkq_SkipWhile3R()
        {
            Setup(4);

            Assert.AreEqual(0, SLE.Count(dary1.Keys.Reverse().SkipWhile((k, i) => false)));
            Assert.AreEqual(0, SLE.Count(dary1.Keys.Reverse().SkipWhile((k, i) => true)));

            dary1.Add(1, -1);
            dary1.Add(2, -2);

            Assert.AreEqual(0, SLE.Count(dary1.Keys.Reverse().SkipWhile((k, i) => true)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 2, 1 }, dary1.Keys.Reverse().SkipWhile((k, i) => false)));

            dary1.Add(3, -3);
            dary1.Add(4, -4);

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 2, 1 }, dary1.Keys.Reverse().SkipWhile((k, i) => i < 1 || k % 2 != 0)));
        }
Beispiel #22
0
        public void UnitRbq_SkipWhile2R()
        {
            var rb = new RankedBag <int> {
                Capacity = 4
            };

            Assert.AreEqual(0, SLE.Count(rb.Reverse().SkipWhile(x => false)));
            Assert.AreEqual(0, SLE.Count(rb.Reverse().SkipWhile(x => true)));

            rb.Add(-1);

            Assert.AreEqual(0, SLE.Count(rb.Reverse().SkipWhile(x => true)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { -1 }, rb.Reverse().SkipWhile(x => false)));

            rb.Add(-2);
            rb.Add(-3);

            Assert.IsTrue(SLE.SequenceEqual(new int[] { -2, -3 }, rb.Reverse().SkipWhile(x => x % 2 != 0)));
        }
        public void UnitRmvq_SkipWhile2F()
        {
            var rm = new RankedMap <int, int> {
                Capacity = 4
            };

            Assert.AreEqual(0, SLE.Count(rm.Values.Skip(0).SkipWhile(x => false)));
            Assert.AreEqual(0, SLE.Count(rm.Values.Skip(0).SkipWhile(x => true)));

            rm.Add(1, -1);

            Assert.AreEqual(0, SLE.Count(rm.Values.Skip(0).SkipWhile(x => true)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { -1 }, rm.Values.Skip(0).SkipWhile(x => false)));

            rm.Add(2, -2);
            rm.Add(3, -3);

            Assert.IsTrue(SLE.SequenceEqual(new int[] { -2, -3 }, rm.Values.Skip(0).SkipWhile(x => x % 2 != 0)));
        }
Beispiel #24
0
        public void UnitRdkq_SkipWhile3Ctor()
        {
            Setup(4);

            Assert.AreEqual(0, SLE.Count(dary1.Keys.SkipWhile((k, i) => false)));
            Assert.AreEqual(0, SLE.Count(dary1.Keys.SkipWhile((k, i) => true)));

            dary1.Add(1, -1);
            dary1.Add(2, -2);

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1, 2 }, dary1.Keys.SkipWhile((k, i) => false)));
            Assert.AreEqual(0, SLE.Count(dary1.Keys.SkipWhile((k, i) => true)));

            dary1.Add(3, -3);
            dary1.Add(4, -4);
            dary1.Add(5, -5);

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 4, 5 }, dary1.Keys.SkipWhile((k, i) => i < 2 || k % 2 != 0)));
        }
        public void UnitRmkq_SkipWhile2R()
        {
            var rm = new RankedMap <int, int> {
                Capacity = 4
            };

            Assert.AreEqual(0, SLE.Count(rm.Keys.Reverse().SkipWhile(x => false)));
            Assert.AreEqual(0, SLE.Count(rm.Keys.Reverse().SkipWhile(x => true)));

            rm.Add(1, -1);

            Assert.AreEqual(0, SLE.Count(rm.Keys.Reverse().SkipWhile(x => true)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1 }, rm.Keys.Reverse().SkipWhile(x => false)));

            rm.Add(2, -2);
            rm.Add(3, -3);

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 2, 1 }, rm.Keys.Reverse().SkipWhile(x => x % 2 != 0)));
        }
Beispiel #26
0
        public void StressRbq_SkipWhile()
        {
            var rb = new RankedBag <int> {
                Capacity = 4
            };
            int n = 25;

            for (int x1 = 0; x1 < n; ++x1)
            {
                rb.Clear();
                for (int x3 = 0; x3 < x1; ++x3)
                {
                    rb.Add(x3);
                }

                System.Collections.Generic.IEnumerable <int> q0 = rb.SkipWhile(x => false);
                Assert.AreEqual(x1, SLE.Count(q0));
            }
        }
        public void UnitRmvq_SkipWhile3R()
        {
            var rm = new RankedMap <int, int> {
                Capacity = 4
            };

            Assert.AreEqual(0, SLE.Count(rm.Values.Reverse().SkipWhile((v, i) => false)));
            Assert.AreEqual(0, SLE.Count(rm.Values.Reverse().SkipWhile((v, i) => true)));

            rm.Add(1, -1);
            rm.Add(2, -2);

            Assert.AreEqual(0, SLE.Count(rm.Values.Reverse().SkipWhile((v, i) => true)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { -2, -1 }, rm.Values.Reverse().SkipWhile((v, i) => false)));

            rm.Add(3, -3);
            rm.Add(4, -4);

            Assert.IsTrue(SLE.SequenceEqual(new int[] { -2, -1 }, rm.Values.Reverse().SkipWhile((v, i) => v < -3 || i % 2 != 0)));
        }
        public void UnitRmkq_SkipWhile3F()
        {
            var rm = new RankedMap <int, int> {
                Capacity = 4
            };

            Assert.AreEqual(0, SLE.Count(rm.Keys.Skip(0).SkipWhile((k, i) => false)));
            Assert.AreEqual(0, SLE.Count(rm.Keys.Skip(0).SkipWhile((k, i) => true)));

            rm.Add(1, -1);
            rm.Add(2, -2);

            Assert.AreEqual(0, SLE.Count(rm.Keys.Skip(0).SkipWhile((k, i) => true)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1, 2 }, rm.Keys.Skip(0).SkipWhile((k, i) => false)));

            rm.Add(3, -3);
            rm.Add(4, -4);

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 3, 4 }, rm.Keys.Skip(0).SkipWhile((k, i) => i < 1 || k % 2 == 0)));
        }
Beispiel #29
0
        public void UnitRbq_SkipWhile3Ctor()
        {
            var rb = new RankedBag <int> {
                Capacity = 5
            };

            Assert.AreEqual(0, SLE.Count(rb.SkipWhile((x, i) => false)));
            Assert.AreEqual(0, SLE.Count(rb.SkipWhile((x, i) => true)));

            rb.Add(1);

            Assert.AreEqual(0, SLE.Count(rb.SkipWhile((x, i) => true)));
            Assert.IsTrue(SLE.SequenceEqual(new int[] { 1 }, rb.SkipWhile((x, i) => false)));

            rb.Add(2);
            rb.Add(3);
            rb.Add(4);

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 4 }, rb.SkipWhile((x, i) => x % 2 != 0 || i < 3)));
        }
Beispiel #30
0
        public void UnitRdq_SkipWhile2R()
        {
            Setup(5);
            var p1 = new SCG.KeyValuePair <int, int> (1, -1);
            var p2 = new SCG.KeyValuePair <int, int> (2, -2);
            var p3 = new SCG.KeyValuePair <int, int> (3, -3);

            Assert.AreEqual(0, SLE.Count(dary1.Reverse().SkipWhile(x => false)));
            Assert.AreEqual(0, SLE.Count(dary1.Reverse().SkipWhile(x => true)));

            dary1.Add(p1.Key, p1.Value);

            Assert.IsTrue(SLE.SequenceEqual(new SCG.KeyValuePair <int, int>[] { p1 }, dary1.Reverse().SkipWhile(x => false)));
            Assert.AreEqual(0, SLE.Count(dary1.Reverse().SkipWhile(x => true)));

            dary1.Add(p2.Key, p2.Value);
            dary1.Add(p3.Key, p3.Value);

            Assert.IsTrue(SLE.SequenceEqual(new SCG.KeyValuePair <int, int>[] { p2, p1 }, dary1.Reverse().SkipWhile(x => x.Key % 2 != 0)));
        }