Dummy IFn to use in reduce tests
コード例 #1
0
ファイル: RangeTests.cs プロジェクト: nasser/Clojure.Runtime
        public void ReduceWithNoStartIterates()
        {
            IFn     fn  = DummyFn.CreateForReduce();
            IReduce r   = (IReduce)_createFn(2L, 5L);
            object  ret = r.reduce(fn);

            Expect(ret, EqualTo(9));
        }
コード例 #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));
        }
コード例 #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);
        }
コード例 #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));
        }
コード例 #5
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, EqualTo(26));
        }
コード例 #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));
        }
コード例 #7
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).To.Be.An.Instance.Of <long>();
            Expect((long)ret).To.Equal(26);
        }
コード例 #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));
        }
コード例 #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);
        }
コード例 #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);
        }