本文整理汇总了C#中CPV类的典型用法代码示例。如果您正苦于以下问题:C# CPV类的具体用法?C# CPV怎么用?C# CPV使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CPV类属于命名空间,在下文中一共展示了CPV类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AssocWithNumericKeyInRangeChangesValue
public void AssocWithNumericKeyInRangeChangesValue()
{
//This just checks that APersistentVector.assoc calls CPV.assocN
CPV v = new CPV(new object[] { 4, 5, 6 });
Associative a = v.assoc(1, 10);
Expect(a.valAt(0), EqualTo(4));
Expect(a.valAt(1), EqualTo(10));
Expect(a.valAt(2), EqualTo(6));
Expect(a.count(), EqualTo(3));
}
示例2: EqualsOnNonPersistentVectorIsFalse
public void EqualsOnNonPersistentVectorIsFalse()
{
CPV v1 = new CPV(new object[] { 1, 2, 3 });
Expect(v1.equiv(7), False);
}
示例3: ContainsKeyOnIndexInRangeIsTrue
public void ContainsKeyOnIndexInRangeIsTrue()
{
CPV v = new CPV(new object[] { 4, 5, 6 });
Expect(v.containsKey(1.2));
}
示例4: ValAtOnNonNumericReturnsDefault
public void ValAtOnNonNumericReturnsDefault()
{
CPV v = new CPV(new object[] { 4, 5, 6 });
object val1 = v.valAt("a");
object val2 = v.valAt("a", "abc");
Expect(val1, Null);
Expect(val2, EqualTo("abc"));
}
示例5: ValAtOnIndexInRangeReturnsEntry
public void ValAtOnIndexInRangeReturnsEntry()
{
CPV v = new CPV(new object[] { 4, 5, 6 });
object val1 = v.valAt(1);
object val2 = v.valAt(1, "abc");
Expect(val1, EqualTo(5));
Expect(val2, EqualTo(5));
}
示例6: 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();
}
示例7: 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);
}
示例8: HashCodeRepeats
public void HashCodeRepeats()
{
CPV v = new CPV(new object[] { 1, 2, 3 });
Expect(v.GetHashCode(), EqualTo(v.GetHashCode()));
}
示例9: InvokeCallsNth
public void InvokeCallsNth()
{
CPV v = new CPV(new object[] { 5, 6, 7 });
Expect(v.invoke(0),EqualTo(5));
Expect(v.invoke(1),EqualTo(6));
Expect(v.invoke(2),EqualTo(7));
Expect(v.invoke("1"), EqualTo(6));
Expect(v.invoke(1.0), EqualTo(6));
Expect(v.invoke(1.2), EqualTo(6));
Expect(v.invoke(1.8), EqualTo(6)); // Rounds or not-- should it?
Expect(v.invoke(1.4M), EqualTo(6));
}
示例10: Explicit_IPersistentCollection_cons_works
public void Explicit_IPersistentCollection_cons_works()
{
CPV v = new CPV(new object[] { 1, 2 });
IPersistentCollection c = v as IPersistentCollection;
Expect(c, Not.Null);
IPersistentCollection c2 = c.cons(3);
Expect(c2.count(), EqualTo(3));
ISeq s2 = c2.seq();
Expect(s2.first(), EqualTo(1));
Expect(s2.rest().first(), EqualTo(2));
Expect(s2.rest().rest().first(), EqualTo(3));
Expect(s2.rest().rest().rest(), Null);
}
示例11: HashCodeDependsOnItems
public void HashCodeDependsOnItems()
{
CPV v1 = new CPV(new object[] { 1, 2, 3 });
CPV v2 = new CPV(new object[] { 1, 2, 4 });
Expect(v1.GetHashCode(), Not.EqualTo(v2.GetHashCode()));
}
示例12: EqualsOnSimilarISeqWorks
public void EqualsOnSimilarISeqWorks()
{
CPV v1 = new CPV(new object[] { 'a', 'b', 'c' });
StringSeq s1 = StringSeq.create("abc");
Expect(v1.equiv(s1));
}
示例13: EqualsOnPersistentVectorWithSameItemsIsTrue
public void EqualsOnPersistentVectorWithSameItemsIsTrue()
{
CPV v1 = new CPV(new object[] { 1, 2, 3 });
CPV v2 = new CPV(new object[] { 1, 2, 3 });
CPV v3 = new CPV(new object[] { 1 });
CPV v4 = new CPV(new object[] { 1 });
CPV v5 = new CPV(new object[] { });
CPV v6 = new CPV(new object[] { });
Expect(v1.equiv(v2));
Expect(v3.equiv(v4));
Expect(v5.equiv(v6));
}
示例14: EqualsOnPersistentVectorWithDifferentItemsIsFalse
public void EqualsOnPersistentVectorWithDifferentItemsIsFalse()
{
CPV v1 = new CPV(new object[] { 1, 2, 3 });
CPV v2 = new CPV(new object[] { 1, 2, 4 });
CPV v3 = new CPV(new object[] { 1, 2 });
CPV v4 = new CPV(new object[] { 1, 2, 3, 4 });
Expect(v1.equiv(v2), False);
Expect(v1.equiv(v3), False);
Expect(v1.equiv(v4), False);
}
示例15: 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));
}