public void SeqCountWorks() { CPV v = new CPV(new object[] { 4, 5, 6 }); ISeq s = v.seq(); Expect(s.count()).To.Equal(3); Expect(s.next().count()).To.Equal(2); Expect(s.next().next().count()).To.Equal(1); }
public void SeqCountWorks() { CPV v = new CPV(new object[] { 4, 5, 6 }); ISeq s = v.seq(); Expect(s.count(), EqualTo(3)); Expect(s.next().count(), EqualTo(2)); Expect(s.next().next().count(), EqualTo(1)); }
public void SeqFirstAndRestWork() { CPV v = new CPV(new object[] { 4, 5, 6 }); ISeq s = v.seq(); Expect(s.first(), EqualTo(4)); Expect(s.next().first(), EqualTo(5)); Expect(s.next().next().first(), EqualTo(6)); Expect(s.next().next().next(), Null); }
public void SeqFirstAndRestWork() { CPV v = new CPV(new object[] { 4, 5, 6 }); ISeq s = v.seq(); Expect(s.first()).To.Equal(4); Expect(s.next().first()).To.Equal(5); Expect(s.next().next().first()).To.Equal(6); Expect(s.next().next().next()).To.Be.Null(); }
public void SeqWithMetaHasMeta() { IPersistentMap meta = new DummyMeta(); CPV v = new CPV(new object[] { 4, 5, 6 }); IObj s = (IObj)v.seq(); IObj obj = s.withMeta(meta); Expect(obj.meta(), SameAs(meta)); }
public void SeqReduceWithStartIterates() { IFn fn = DummyFn.CreateForReduce(); CPV v = new CPV(new object[] { 1, 2, 3 }); IReduce r = (IReduce)v.seq(); object ret = r.reduce(fn, 20); Expect(ret, EqualTo(26)); }
public void SeqOnPositiveCountYieldsValidSequence() { CPV v = new CPV(new object[] { 1, 2, 3 }); ISeq s = v.seq(); Expect(s.first(), EqualTo(1)); Expect(s.next().first(), EqualTo(2)); Expect(s.next().next().first(), EqualTo(3)); Expect(s.next().next().next(), Null); }
public void SeqOnPositiveCountYieldsValidSequence() { CPV v = new CPV(new object[] { 1, 2, 3 }); ISeq s = v.seq(); Expect(s.first()).To.Equal(1); Expect(s.next().first()).To.Equal(2); Expect(s.next().next().first()).To.Equal(3); Expect(s.next().next().next()).To.Be.Null(); }
public void SeqReduceWithStartIterates() { IFn fn = DummyFn.CreateForReduce(); CPV v = new CPV(new object[] { 1, 2, 3 }); IReduce r = (IReduce)v.seq(); object ret = r.reduce(fn, 20); Expect(ret).To.Be.An.Instance.Of <long>(); Expect((long)ret).To.Equal(26); }
public void SeqIndexedWorks() { CPV v = new CPV(new object[] { 4, 5, 6 }); ISeq s0 = v.seq(); IndexedSeq i0 = s0 as IndexedSeq; ISeq s1 = s0.next(); IndexedSeq i1 = s1 as IndexedSeq; Expect(i0.index(), EqualTo(0)); Expect(i1.index(), EqualTo(1)); }
public void SeqWithMetaHasMeta() { MockRepository mocks = new MockRepository(); IPersistentMap meta = mocks.StrictMock <IPersistentMap>(); mocks.ReplayAll(); CPV v = new CPV(new object[] { 4, 5, 6 }); IObj s = (IObj)v.seq(); IObj obj = s.withMeta(meta); Expect(obj.meta(), SameAs(meta)); mocks.VerifyAll(); }
public void SeqReduceWithNoStartIterates() { 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(); CPV v = new CPV(new object[] { 1, 2, 3 }); IReduce r = (IReduce)v.seq(); object ret = r.reduce(fn); Expect(ret, EqualTo(7)); mocks.VerifyAll(); }
public void SeqWithMetaHasMeta() { MockRepository mocks = new MockRepository(); IPersistentMap meta = mocks.StrictMock<IPersistentMap>(); mocks.ReplayAll(); CPV v = new CPV(new object[] { 4, 5, 6 }); IObj s = (IObj)v.seq(); IObj obj = s.withMeta(meta); Expect(obj.meta(), SameAs(meta)); mocks.VerifyAll(); }
public void SeqReduceWithStartIterates() { MockRepository mocks = new MockRepository(); IFn fn = mocks.StrictMock<IFn>(); RMExpect.Call(fn.invoke(20, 1)).Return(10); RMExpect.Call(fn.invoke(10, 2)).Return(5); RMExpect.Call(fn.invoke(5, 3)).Return(7); mocks.ReplayAll(); CPV v = new CPV(new object[] { 1, 2, 3 }); IReduce r = (IReduce)v.seq(); object ret = r.reduce(fn, 20); Expect(ret, EqualTo(7)); mocks.VerifyAll(); }
public void SeqOnPositiveCountYieldsValidSequence() { CPV v = new CPV(new object[] { 1, 2, 3 }); ISeq s = v.seq(); Expect(s.first(), EqualTo(1)); Expect(s.rest().first(), EqualTo(2)); Expect(s.rest().rest().first(), EqualTo(3)); Expect(s.rest().rest().rest(), Null); }
public void SeqOnPositiveCountYieldsNotNull() { CPV v = new CPV(new object[]{ 1,2,3}); Expect(v.seq(), Not.Null); }
public void SeqOnCount0YieldsNull() { CPV v = new CPV(new object[0]); Expect(v.seq(), Null); }
public void SeqIndexedWorks() { CPV v = new CPV(new object[] { 4, 5, 6 }); ISeq s0 = v.seq(); IndexedSeq i0 = s0 as IndexedSeq; ISeq s1 = s0.rest(); IndexedSeq i1 = s1 as IndexedSeq; Expect(i0.index(), EqualTo(0)); Expect(i1.index(), EqualTo(1)); }
public void SeqFirstAndRestWork() { CPV v = new CPV(new object[] { 4, 5, 6 }); ISeq s = v.seq(); Expect(s.first(), EqualTo(4)); Expect(s.rest().first(), EqualTo(5)); Expect(s.rest().rest().first(), EqualTo(6)); Expect(s.rest().rest().rest(), Null); }
public void SeqCountWorks() { CPV v = new CPV(new object[] { 4, 5, 6 }); ISeq s = v.seq(); Expect(s.count(), EqualTo(3)); Expect(s.rest().count(), EqualTo(2)); Expect(s.rest().rest().count(), EqualTo(1)); }
public void SeqReduceWithStartIterates() { IFn fn = DummyFn.CreateForReduce(); CPV v = new CPV(new object[] { 1, 2, 3 }); IReduce r = (IReduce)v.seq(); object ret = r.reduce(fn, 20); Expect(ret, EqualTo(26)); }
public void SeqWithMetaHasMeta() { IPersistentMap meta = new DummyMeta(); CPV v = new CPV(new object[] { 4, 5, 6 }); IObj s = (IObj)v.seq(); IObj obj = s.withMeta(meta); Expect(obj.meta(), SameAs(meta)); }
public void SeqOnCount0YieldsNull() { CPV v = new CPV(new object[0]); Expect(v.seq(), Null); }
public void SeqOnPositiveCountYieldsNotNull() { CPV v = new CPV(new object[] { 1, 2, 3 }); Expect(v.seq(), Not.Null); }