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 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);
        }
        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.º 4
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);
        }
Exemplo n.º 5
0
        public void RSeqReduceWithNoStartIterates()
        {
            MockRepository mocks = new MockRepository();
            IFn            fn    = mocks.StrictMock <IFn>();

            RMExpect.Call(fn.invoke(3, 2)).Return(5);
            RMExpect.Call(fn.invoke(5, 1)).Return(7);
            mocks.ReplayAll();

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

            Expect(ret, EqualTo(7));
            mocks.VerifyAll();
        }