Exemplo n.º 1
0
        public void ReduceWithNoStartIterates()
        {
            MockRepository mocks = new MockRepository();
            IFn            fn    = mocks.StrictMock <IFn>();

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

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

            Expect(ret, EqualTo(7));

            mocks.VerifyAll();
        }
Exemplo n.º 2
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();
        }
Exemplo n.º 3
0
        public void ReduceWithNoStartIterates()
        {
            MockRepository mocks = new MockRepository();
            IFn            fn    = mocks.StrictMock <IFn>();

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

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

            Expect(ret, EqualTo(7));

            mocks.VerifyAll();
        }
Exemplo n.º 4
0
        public void AlterMeta_changes_meta()
        {
            MockRepository mocks = new MockRepository();
            IPersistentMap meta  = mocks.StrictMock <IPersistentMap>();
            IFn            fn    = mocks.StrictMock <IFn>();

            RMExpect.Call(fn.applyTo(null)).IgnoreArguments().Return(meta);
            mocks.ReplayAll();

            ConcreteAReference c = new ConcreteAReference();

            c.alterMeta(fn, null);

            Expect(c.meta(), EqualTo(meta));
            mocks.VerifyAll();
        }
Exemplo n.º 5
0
        public void ReduceWithNoStartIterates()
        {
            MockRepository mocks = new MockRepository();
            IFn            fn    = mocks.StrictMock <IFn>();

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

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

            Expect(ret, EqualTo(7));

            mocks.VerifyAll();
        }