Example #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)));
        }
Example #2
0
        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)));
        }
Example #3
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)));
        }
Example #4
0
        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)));
        }
Example #5
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)));
        }
Example #6
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)));
        }
Example #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)));
        }
Example #8
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)));
        }
Example #9
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)));
        }
Example #10
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)));
        }
Example #11
0
    public void BlinqShouldEqualLinqNativeArraySequenceEqualArray([ArrayValues] int[] sourceArr, [ArrayValues] int[] secondArr)
    {
        var sourceNativeArr = new NativeArray <int>(sourceArr, Allocator.Persistent);
        var secondNativeArr = new NativeArray <int>(secondArr, Allocator.Persistent);
        var expected        = ExceptionAndValue(() => Linq.SequenceEqual(sourceNativeArr, secondNativeArr));
        var actual          = ExceptionAndValue(() => Blinq.SequenceEqual(sourceNativeArr, secondNativeArr));

        AssertAreEqual(expected, actual);
        sourceNativeArr.Dispose();
        secondNativeArr.Dispose();
    }
Example #12
0
        public void UnitRbq_Reset()
        {
            var rb = new RankedBag <int>(new int[] { 1, 2, 5, 8, 9 })
            {
                Capacity = 4
            };

            System.Collections.Generic.IEnumerable <int> bagEtor = rb.Reverse().Skip(1).SkipWhile(x => x % 2 == 0);

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 5, 2, 1 }, bagEtor));

            ((System.Collections.IEnumerator)bagEtor).Reset();

            Assert.IsTrue(SLE.SequenceEqual(new int[] { 5, 2, 1 }, bagEtor));
        }
Example #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)));
        }
Example #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)));
        }
Example #15
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)));
        }
Example #16
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)));
        }
Example #17
0
        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)));
        }
Example #18
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)));
        }
Example #19
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)));
        }
Example #20
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)));
        }
Example #21
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)));
        }
Example #22
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)));
        }
Example #23
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)));
        }
Example #24
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)));
        }
Example #25
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)));
        }
Example #26
0
        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)));
        }
Example #27
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)));
        }
Example #28
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)));
        }
Example #29
0
        public void UnitRmvq_SkipWhile3Ctor()
        {
            var rm = new RankedMap <int, int> {
                Capacity = 4
            };

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

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

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

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

            Assert.IsTrue(SLE.SequenceEqual(new int[] { -4, -5 }, rm.Values.SkipWhile((v, i) => v > -3 || i % 2 == 0)));
        }
Example #30
0
        public void UnitRdq_SkipWhile3F()
        {
            Setup(4);
            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.Skip(0).SkipWhile((p, i) => false)));
            Assert.AreEqual(0, SLE.Count(dary1.Skip(0).SkipWhile((p, i) => true)));

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

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

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

            Assert.IsTrue(SLE.SequenceEqual(new SCG.KeyValuePair <int, int>[] { p3 }, dary1.Skip(0).SkipWhile((p, i) => p.Key % 2 == 0 || i < 1)));
            Assert.AreEqual(0, SLE.Count(dary1.Skip(0).SkipWhile((p, i) => true)));
        }