Dummy IFn to use in reduce tests
Exemplo n.º 1
0
        public void ReduceWithNoStartIterates()
        {
            IFn     fn  = DummyFn.CreateForReduce();
            IReduce r   = (IReduce)_createFn(2L, 5L);
            object  ret = r.reduce(fn);

            Expect(ret, EqualTo(9));
        }
Exemplo n.º 2
0
        public void ReduceWithStartIterates()
        {
            IFn fn = DummyFn.CreateForReduce();

            Range  r   = new Range(2, 5);
            object ret = r.reduce(fn, 20);

            Expect(ret, EqualTo(29));
        }
Exemplo n.º 3
0
        public void ReduceWithNoStartIterates()
        {
            IFn     fn  = DummyFn.CreateForReduce();
            IReduce r   = (IReduce)_createFn(2L, 5L);
            object  ret = r.reduce(fn);

            Expect(ret).To.Be.An.Instance.Of <long>();
            Expect((long)ret).To.Equal(9);
        }
Exemplo n.º 4
0
        public void ReduceWithStartIterates()
        {
            IFn fn = DummyFn.CreateForReduce();

            PersistentList p   = (PersistentList)PersistentList.create(new object[] { 1, 2, 3 });
            object         ret = p.reduce(fn, 20);

            Expect(ret, EqualTo(26));
        }
        public void RSeqReduceWithStartIterates()
        {
            IFn fn = DummyFn.CreateForReduce();

            CPV     v   = new CPV(new object[] { 1, 2, 3 });
            IReduce r   = (IReduce)v.rseq();
            object  ret = r.reduce(fn, 20);

            Expect(ret, EqualTo(26));
        }
Exemplo n.º 6
0
        public void ReduceWithStartIterates()
        {
            IFn fn = DummyFn.CreateForReduce();

            object[]  array = new object[] { 2, 3, 4 };
            IArraySeq a     = ArraySeq.create(array);
            object    ret   = a.reduce(fn, 20);

            Expect(ret, EqualTo(29));
        }
        public void ReduceWithStartIterates()
        {
            IFn fn = DummyFn.CreateForReduce();

            PersistentList p   = (PersistentList)PersistentList.create(new object[] { 1, 2, 3 });
            object         ret = p.reduce(fn, 20);

            Expect(ret).To.Be.An.Instance.Of <long>();
            Expect((long)ret).To.Equal(26);
        }
Exemplo n.º 8
0
        public void AlterMeta_changes_meta()
        {
            IPersistentMap meta = new DummyMeta();
            IFn            fn   = DummyFn.CreateForMetaAlter(meta);

            ConcreteAReference c = new ConcreteAReference();

            c.alterMeta(fn, null);

            Expect(c.meta(), SameAs(meta));
        }
Exemplo n.º 9
0
        public void ReduceWithStartIterates()
        {
            IFn fn = DummyFn.CreateForReduce();

            object[]  array = new object[] { 2, 3, 4 };
            IArraySeq a     = ArraySeq.create(array);
            object    ret   = a.reduce(fn, 20);

            Expect(ret).To.Be.An.Instance.Of <long>();
            Expect((long)ret).To.Equal(29);
        }
Exemplo n.º 10
0
        public void RSeqReduceWithStartIterates()
        {
            IFn fn = DummyFn.CreateForReduce();

            CPV     v   = new CPV(new object[] { 1, 2, 3 });
            IReduce r   = (IReduce)v.rseq();
            object  ret = r.reduce(fn, 20);

            Expect(ret).To.Be.An.Instance.Of <long>();
            Expect((long)ret).To.Equal(26);
        }