本文整理汇总了C#中CPV.seq方法的典型用法代码示例。如果您正苦于以下问题:C# CPV.seq方法的具体用法?C# CPV.seq怎么用?C# CPV.seq使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPV
的用法示例。
在下文中一共展示了CPV.seq方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SeqWithMetaHasMeta
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();
}
示例2: SeqOnPositiveCountYieldsValidSequence
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);
}
示例3: SeqReduceWithStartIterates
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();
}
示例4: SeqOnCount0YieldsNull
public void SeqOnCount0YieldsNull()
{
CPV v = new CPV(new object[0]);
Expect(v.seq(), Null);
}
示例5: SeqOnPositiveCountYieldsNotNull
public void SeqOnPositiveCountYieldsNotNull()
{
CPV v = new CPV(new object[]{ 1,2,3});
Expect(v.seq(), Not.Null);
}
示例6: SeqIndexedWorks
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));
}
示例7: SeqFirstAndRestWork
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);
}
示例8: SeqCountWorks
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));
}
示例9: SeqWithMetaHasMeta
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));
}
示例10: SeqReduceWithStartIterates
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));
}