public void IPC_Cons_works() { Cons c1 = new Cons("abc", null); IPersistentCollection ipc1 = c1 as IPersistentCollection; IPersistentCollection ipc2 = ipc1.cons("def"); ISeq s = ipc2.seq(); Expect(s.first(), EqualTo("def")); Expect(s.next(), SameAs(c1)); }
public void IPC_Cons_works() { Cons c1 = new Cons("abc", null); IPersistentCollection ipc1 = c1 as IPersistentCollection; IPersistentCollection ipc2 = ipc1.cons("def"); ISeq s = ipc2.seq(); Expect(s.first()).To.Equal("def"); Expect(Object.ReferenceEquals(s.next(), c1)); }
public void ExplictIPersistentCollectionConsWorks() { MapEntry me = new MapEntry(1, "abc"); IPersistentCollection c = (IPersistentCollection)me; ISeq s = c.cons(2).seq(); Expect(me.count()).To.Equal(2); Expect(me.key()).To.Equal(1); Expect(me.val()).To.Equal("abc"); Expect(s.count()).To.Equal(3); Expect(s.first()).To.Equal(1); Expect(s.next().first()).To.Equal("abc"); Expect(s.next().next().first()).To.Equal(2); Expect(s.next().next().next()).To.Be.Null(); }
public void ExplictIPersistentCollectionConsWorks() { MapEntry me = new MapEntry(1, "abc"); IPersistentCollection c = (IPersistentCollection)me; ISeq s = c.cons(2).seq(); Expect(me.count(), EqualTo(2)); Expect(me.key(), EqualTo(1)); Expect(me.val(), EqualTo("abc")); Expect(s.count(), EqualTo(3)); Expect(s.first(), EqualTo(1)); Expect(s.next().first(), EqualTo("abc")); Expect(s.next().next().first(), EqualTo(2)); Expect(s.next().next().next(), Null); }
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.next().first(), EqualTo(2)); Expect(s2.next().next().first(), EqualTo(3)); Expect(s2.next().next().next(), Null); }
public void Explicit_IPersistentCollection_cons_works() { CPV v = new CPV(new object[] { 1, 2 }); IPersistentCollection c = v as IPersistentCollection; Expect(c).Not.To.Be.Null(); IPersistentCollection c2 = c.cons(3); Expect(c2.count()).To.Equal(3); ISeq s2 = c2.seq(); Expect(s2.first()).To.Equal(1); Expect(s2.next().first()).To.Equal(2); Expect(s2.next().next().first()).To.Equal(3); Expect(s2.next().next().next()).To.Be.Null(); }